- Updated dependencies [
dafeca247]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#1095
6e1fc78fdThanks @b4rtaz! - Fixed thepriceTokenAddressproperty in theEvmNftTradetype. -
Updated dependencies [
6e1fc78fd]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
8caf91365Thanks @b4rtaz! - AddedresolveENSDomainmethod to the EvmApi module. -
Updated dependencies [
8caf91365]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#1071
98a35355fThanks @ErnoW! - Fix parsing of some values to wei from API -
Updated dependencies [
98a35355f]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#1063
2f102c48cThanks @ErnoW! - AddgetTransactionVerboseendpoint atMoralis.EvmApi.transaction.getTransactionVerbose() -
#1062
4ad15182bThanks @ErnoW! - AddgetErc20Approvalsendpoint atMoralis.EvmApi.token.getErc20Approvals() -
#1056
3e031685bThanks @ErnoW! - AddgetErc20Transfersendpoint atMoralis.EvmApi.token.getErc20Transfers() -
#1061
2d99b05c7Thanks @ErnoW! - AddgetErc20Burnsendpoint atMoralis.EvmApi.token.getErc20Burns() -
#1066
9fba6e55aThanks @ErnoW! - Add processed media for nfts -
#1064
6d8dbacb7Thanks @ErnoW! - Add internal transactions param to several operations andMoralis.Evm.transaction.getInternalTransactions()
- Updated dependencies [
2f102c48c,4ad15182b,3e031685b,2d99b05c7,9fba6e55a,6d8dbacb7,ecc414aaf]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
e96c34ab4]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
Updated dependencies [
8981730d6]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
Updated dependencies [
36ebc0d82,521534f81]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
7949ea1fe]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
abb77d713]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#980
a16b47566Thanks @FedericoAmura! - Updated operations to properly support updated endpoints. New endpoint to get the native balance for multiple addresses:- added
Moralis.EvmApi.getNativeBalancesForAddresses()
Endpoints to get/add/remove addresses to an authenticated profile:
- added
Moralis.Auth.getAddresses() - added
Moralis.Auth.requestBind() - added
Moralis.Auth.verifyRequestBind() - added
Moralis.Auth.removeBind() - added
Moralis.Auth.verifyRemoveBind()
- added
-
#986
301490a3dThanks @ErnoW! - Fix response ofEvmApi.nft.getNFTTransfersByBlock:result.valueshows now the value correctly in wei (As a BigNumber)result.tokenAddressshows not the correct token address
-
Updated dependencies [
a16b47566,301490a3d]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
98bd66b8eThanks @b4rtaz! - Added thedisableTotalparameter to requests of paginated methods. -
Updated dependencies [
98bd66b8e,98bd66b8e,98bd66b8e]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#912
26848dc2dThanks @ErnoW! - Update api types to include latest features and fixes of evmApi and streams. This includes:- removal of deprecated
subdomainandproviderUrlparams - evm endpooint for
getMultipleNFTs - evm endpoint updated for
getNFTContractTransfersto includefromBlock,toBlock,fromDateandtoDateparams - streams support for
getNativeBalances
- removal of deprecated
-
Updated dependencies [
26848dc2d]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
33230c43c]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#902
b703c5517Thanks @b4rtaz! - Fixed thegetWalletNFTTransfers()method. Now the method returns correct values of NFT transfers. -
Updated dependencies [
439d6e564,2dcf75f8a,52a8160d9,b703c5517]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- #865
a8c2175c2Thanks @FedericoAmura! - Get transactions verbose support added.
-
#882
f709e1179Thanks @b4rtaz! - Fixed thegetContractEvents()method. -
#883
31ef229adThanks @b4rtaz! - Fixed thegetNFTTrades()method. -
Updated dependencies [
a8c2175c2,338ee39e8,f709e1179,31ef229ad,248089ffa]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
0cefcef6,0cefcef6]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#846
1374573dThanks @ErnoW! - # Api responses (breaking change)For any api call, you get a resultAdapter response. The value of the
toJSON()value has changed. Now it is the same value as.raw. Previously this caused a lot of confusion, and as both return a json. The value of this method has changed. So if you used.toJSON()on an api result you can:- Use
.result, this will probably contain dataTypes with lots of utility functions. If you only care about the data, you can call.format()or.toJSON()on this datatype. This is the prefered way as it provides you wilt additional utilites and extra properties. We suggest you to use Typescript, to easily see the available properties/methods on these datatypes. - Or. use the new values (or values from
.raw), these values are identical as they are provided by the internal api, without any data transformation. The types might be different than before, so please check this (we suggest to use Typescript, as all responses are typed, otherwise you can log the output and see any differences)
If you're using some of our internal packages @moralisweb3/core for example then these names have been changed to differentiate between server-side packages, and packages that are compatible with client-side and server-side. We name these common-*. This is a first step to provide better client-side support:
@moralisweb3/core->@moralisweb3/common-core@moralisweb3/evm-utils->@moralisweb3/common-evm-utils@moralisweb3/sol-utils->@moralisweb3/common-sol-utils
Change your dependencies in package.json and the corresponding imports in your code to the new names.
For the time being, the old packages will remain, and we use them to forward to the common-* package, this will be removed in a future version, so please update to the new package name.
For easy integration we created a nextJs package. See
packages/next. This contains:- hooks to all api endpoints
- adapter to integrate into NextJs authentication via Moralis Auth
For a demo check out
demos/nextjsThe parameters and return types are now exported for every api operation. These are exported from
moralis/common-evm-utilsfor evm api methodsmoralis/common-sol-utilsfor sol api methodsmoralis/common-auth-utilsfor auth methodsmoralis/common-streams-utilsfor streams methods
For example:
import Moralis from 'moralis'; import { GetContractNFTsRequest, EvmChain, GetContractNFTsResponse } from 'moralis/common-evm-utils'; const getBlockOptions: GetContractNFTsRequest = { address: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', chain: EvmChain.ETHEREUM, }; let result: GetContractNFTsResponse; const response = await Moralis.EvmApi.nft.getContractNFTs(getBlockOptions); result = response.result;
As a first step to provide better client-side support, all datatypes are now usable in server-side and client-side.
- Use
- Updated dependencies [
f1336a35,62036ef3,1374573d]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#818
08622cd9Thanks @ErnoW! - IncludetransactionIndexandlogIndexinErc20Transferresults -
Updated dependencies [
a18b46ae,08622cd9]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#809
d3672e8fThanks @ErnoW! - Fix missing chainId error in getContractLogs call -
Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#749
d87f37c5Thanks @ErnoW! - Due to inconsistencies in the api regardingcontractTypeon NFT datatypes, we have removed the tight validation check. This means that the type is not 'ERC721' | 'ERC1155' anymore, but a string. This allows other contractTypes to be parsed without throwing errors -
Updated dependencies [
11ba50f7,d87f37c5]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#734
9aada1f8Thanks @sogunshola! - Fixed wrong params definition ingetContractEventsandgetContractLogsendpoints -
Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
77eb29bf]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#720
e5fb3d6cThanks @b4rtaz! - Fixed TypeScript definition for thegetTokenPriceAPI method. -
Updated dependencies [
bfea2ba5,42893723]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#699
d79800adThanks @ErnoW! - Fix parsing of API error messages, now the MoralisError will show themessagethat is returned from the api. -
Updated dependencies [
d79800ad]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#673
62275677Thanks @b4rtaz! - Support not definedcontractTypefor NFT types. -
Updated dependencies [
62275677]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
c719cc2f]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
7fffd1e4]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- #652
7e83894Thanks @ErnoW! - Add Moralis.EvmApi.nft.getWalletNFTCollections() to return all nft collections of a specified address
-
#646
7bf5ec6Thanks @b4rtaz! - Evm api endpoints have been renamed. All methods now are listed under these categories: nft, token, defi, events, transaction, balance, block, resolve, ipfs, utils. Below you can find an overview of all the new methods. The old methods, still work and will be redirected to the new methods. In the next major release, these old methods will be removed.- native.getNFTTransfersByBlock => nft.getNFTTransfersByBlock
- account.getNFTs => nft.getWalletNFTs
- account.getNFTTransfers => nft.getWalletNFTTransfers
- account.getNFTsForContract (Will deprecate. Same func as getNFTs)
- token.getNFTTrades => nft.getNFTTrades
- token.getNFTLowestPrice => nft.getNFTLowestPrice
- token.searchNFTs => nft.searchNFTs
- token.getNFTTransfersFromToBlock => nft.getNFTTransfersFromToBlock
- token.getAllTokenIds => nft.getContractNFTs
- token.getNFTOwners => nft.getNFTOwners
- token.getNFTMetadata => nft.getNFTContractMetadata
- token.reSyncMetadata => nft.reSyncMetadata
- token.getTokenIdMetadata => nft.getNFTMetadata (switch name with token.getNFTMetadata)
- token.getTokenIdOwners => nft.getNFTTokenIdOwners
- token.getWalletTokenIdTransfers => nft.getNFTTransfers
- contract.syncNFTContract => nft.syncNFTContract
- token.getContractNFTTransfers => nft.getNFTContractTransfers
- account.getTokenBalances => token.getWalletTokenBalances
- account.getTokenTransfers => token.getWalletTokenTransfers
- token.getTokenMetadata => token.getTokenMetadata
- token.getTokenMetadataBySymbol => token.getTokenMetadataBySymbol
- token.getTokenPrice => token.getTokenPrice
- token.getTokenAddressTransfers => token.getTokenTransfers (switch name with account.getTokenTransfers)
- token.getTokenAllowance => token.getTokenAllowance
- defi.getPairReserves => defi.getPairReserves
- defi.getPairAddress => defi.getPairAddress
- native.getContractEvents => events.getContractEvents
- native.getLogsByAddress => events.getContractLogs
- native.getTransaction => transaction.getTransaction
- account.getTransactions => transaction.getWalletTransactions
- account.getNativeBalance => balance.getNativeBalance
- native.getBlock => block.getBlock
- native.getDateToBlock => block.getDateToBlock
- resolve.resolveDomain => resolve.resolveDomain
- resolve.resolveAddress => resolve.resolveAddress
- storage.uploadFolder => ipfs.uploadFolder
- native.runContractFunction => utils.runContractFunction
- info.web3ApiVersion => utils.web3ApiVersion
- info.endpointWeights => utils.endpointWeights
-
#646
7bf5ec6Thanks @b4rtaz! - Fixed a pagination bug for some endpoints. -
Updated dependencies [
7e83894]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- #622
0e07f58Thanks @b4rtaz! - Some of EvmApi methods returnnullwhen a resource (block, transaction, nft, etc.) is not found.
-
#628
a6b30fcThanks @b4rtaz! - Fixed a wrong calculated pagination size. Added thehasNext()method to a paginated result. Now you must call it before you call thenext()method.let response = await Moralis.EvmApi.token.getNFTOwners({ /* ... */ }); while (response.hasNext()) { response = await response.next(); // ... }
-
Updated dependencies [
a6b30fc]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#619
5bfb635Thanks @b4rtaz! - Fixed creating a body of POST requests. -
Updated dependencies [
5bfb635,7fa4654]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#597
761d0d7Thanks @b4rtaz! - Corrected TypeScript definition of themaybe()method. This affects on a few EVM types. -
Updated dependencies [
a0ece52,761d0d7,d542326]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#593
dbca06eThanks @ErnoW! - Update types for EvmApi, SolApi and Auth, based on api definitions -
Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#589
a06bc92Thanks @ErnoW! - Fix tokenAddress to use token_address from the api instead of the to_address -
Updated dependencies []:
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#579
30f69c3Thanks @b4rtaz! - NullablecontractTypefor the getNFTMetadata() method support. -
Updated dependencies [
30f69c3]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
639053eThanks @ErnoW! - # Release of v2.0This release contains many breaking changes as it moves from a Javascript SDK (for react-native, browser, and NodeJs) to a NodeJs-only SDK.
Note: we will still support the v1.x version as a
moralis-v1package (see https://github.com/MoralisWeb3/Moralis-JS-SDK-v1).These changes are to focus on Backend-only features, to facilitate self-hosted servers. Below you will find an overview of removed features and how to replace them:
- Plugins: plugins in Moralis are mostly a wrapper around an API, where the API secret is managed on the moralis backend. When using the moralis sdk in NodeJs, you can safely implement your API secret, and implement any api (opensea/pinata etc.) directly without the need of utilities in the moralis sdk
- Connecting to EVM: If you want to connect to EVM chains client-side, then this sdk is not suitable anymore. There are other open-source libraries that will have lots of utilities that can help you with this (web3js, ethers, wagmi, useDapp, web3-react)
- Server interaction: interacting with the server can be done by installing the parse-server sdk (parse).
The new sdk comes with the following featurs:
Moralis.EvmApi: A set of methods to interact and read from EVM chainsMoralis.SolApi: A set of methods to interact and read from Solana networksMoralis.Auth: Utilities to implement web3 authentication in NodeJs
To get started, simply call
Moralis.start({ apiKey: 'YOUR_API_KEY' })Then you can access the apis via
Moralis.EvmApi.account.getNFTs(options)Moralis.SolApi.account.getNFTs(options)Moralis.Auth.requestMessage(options)
For more info see the docs: http://docs.moralis.io Or reach out in our forums: https://forum.moralis.io
- #512
d450294Thanks @ErnoW! - Remove Evm and Server logic. This is SDK will focus mainly on NodeJs backend implementations.
- #518
6eae2a9Thanks @sogunshola! - Several optimisations and add test for api-utils.
- #482
820caa1Thanks @sogunshola! - Perfromance improvement: Return object rather than undefined
-
#560
d413073Thanks @ErnoW! - Improve Erc20Value logic by:- geters for Erc20 for:
token.decimals,token.name,token.symbol,token.contractAddress,token.chain,token.logo,token.logoHashandtoken.thumbnail, - adding an optional token reference for
Erc20Value. This can be used by callingErc20Value.create(amount, { token }) - fixes and additions for output of
Erc20Value:erc20Value.valuenow returns the value in a decimal string"123.567"erc20Value.amountreturns the Bignumber value withtout taking decimals into accounterc20Value.decimalsreturns the decimalserc20Value.toNumber()returns the value in a decimal number (or throws an error if the value is too big):123.456erc20Value.display()returns the value in a readable string with the token symbol if available:"123.456 LINK"(or"123.456")
Moralis.EvmApi.getTokenBalances()now returns anErc20Valueobject with associated token information.
- geters for Erc20 for:
- #511
30b7f4bThanks @sogunshola! - Refactor evmApi package to use apiUtils
-
#568
51e0446Thanks @ErnoW! - Improve Evm datatypes and apply them to the EvmApi consistently:- Removed unused datatypes (mainly related to EvmTransactions)
- Add missing datatypes
- Add more properties to the EvmNft and EvmTransaction datatype
- Add constant lookups for BigNumberm EvmAddress and EvmChain
-
#535
279507cThanks @b4rtaz! - Replaced BigNumber from @ethersproject by own implementation. -
Updated dependencies [
6eae2a9,0c47bae,ed75131,d413073,639053e,30b7f4b,4683492,7f0fc3f,61b8759,81effa1,fa082b6,d10214e,d525351,36dd9a9,9e67989,fa082b6,01b7480,d450294,70e6227,51e0446,279507c]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
fa082b6,fa082b6]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#568
51e0446Thanks @ErnoW! - Improve Evm datatypes and apply them to the EvmApi consistently:- Removed unused datatypes (mainly related to EvmTransactions)
- Add missing datatypes
- Add more properties to the EvmNft and EvmTransaction datatype
- Add constant lookups for BigNumberm EvmAddress and EvmChain
- Updated dependencies [
51e0446]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#563
e818e2dThanks @ErnoW! - Addamountproperty for Moralis.account.getNFTs -
Updated dependencies [
4683492]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#560
d413073Thanks @ErnoW! - Improve Erc20Value logic by:- geters for Erc20 for:
token.decimals,token.name,token.symbol,token.contractAddress,token.chain,token.logo,token.logoHashandtoken.thumbnail, - adding an optional token reference for
Erc20Value. This can be used by callingErc20Value.create(amount, { token }) - fixes and additions for output of
Erc20Value:erc20Value.valuenow returns the value in a decimal string"123.567"erc20Value.amountreturns the Bignumber value withtout taking decimals into accounterc20Value.decimalsreturns the decimalserc20Value.toNumber()returns the value in a decimal number (or throws an error if the value is too big):123.456erc20Value.display()returns the value in a readable string with the token symbol if available:"123.456 LINK"(or"123.456")
Moralis.EvmApi.getTokenBalances()now returns anErc20Valueobject with associated token information.
- geters for Erc20 for:
- Updated dependencies [
d413073]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
#558
0c47baeThanks @b4rtaz! - Deleted redundant search parameters in API URLs. -
Updated dependencies [
0c47bae]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- #555
3f511edThanks @ErnoW! - Include all files from/libin npm builds. This fixes a bug where only the index.js file and .d.ts files were included in builds.
- Updated dependencies [
36dd9a9,3f511ed]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- Updated dependencies [
2948339]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
-
Updated dependencies [
81effa1,81effa1,70e6227]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- #512
d450294Thanks @ErnoW! - Remove Evm and Server logic. This is SDK will focus mainly on NodeJs backend implementations.
- #518
6eae2a9Thanks @sogunshola! - Several optimisations and add test for api-utils.
- #511
30b7f4bThanks @sogunshola! - Refactor evmApi package to use apiUtils
-
#535
279507cThanks @b4rtaz! - Replaced BigNumber from @ethersproject by own implementation. -
Updated dependencies [
6eae2a9,ed75131,30b7f4b,7f0fc3f,61b8759,d10214e,01b7480,d450294,279507c]:- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- @moralisweb3/[email protected]
- #482
820caa1Thanks @sogunshola! - Perfromance improvement: Return object rather than undefined
- #488
f466f90Thanks @b4rtaz! - Deleted the default module instances from packages, except the umbrella package (moralis).
-
#481
fb59ac9Thanks @ErnoW! - Fix getPairAddress endpoint url -
Updated dependencies [
d4a752e,f466f90,f466f90,9e67989,d525351,9e67989,55f54e1,ba6fd72]:- @moralisweb3/[email protected]
- Updated dependencies [
44b062f]:- @moralisweb3/[email protected]
-
#443
6ce5c1fThanks @ErnoW! - Alpha Release of SDK v2The SDK has been rewritten from the ground up with the aim to have a future-proof SDK that is better scalable and comes with lots of developer-experience improvements:
- First hand Typescript support
- Modular system where Functionalities split up in smaller libraries
- More consistent data handling (like addresses and chains)
- Better Error handling and error codes that help debugging
- Logging system, for easier debugging
- More flexible by providing configuration options
This first alpha release has limited functionalities and is not feature-complete compared to v1 yet. Functionalities that are included are:
- Support to be used in package managers (as npm/yarn)
- Connect to an EVM network with Metamask or Walletconnect
- Authenticate to the server via Metamask, Walletconnect or Signup/Signin with password
- Evm utilities functions as transferNative, transferErc20, and executeFunction
- EvmApi (previously web3Api)
Not supported in this release yet
- NodeJs and react-native support
- CDN import by using a script tag
- Plugins
- Solana support
- Additional connectors besides Metamask and Walletconnect
A new concept in this release is the use of Moralis datatypes. For example, all chains will be an instance of the
EvmChainclass. Then to get the chain in decimal value (like1for etherem mainnet), just calladdress.decimal. Or to get the value as hex-string, calladdress.hex.These datatypes will be used everywhere within the Moralis sdk.
- Everywhere, where data is returned, we transform them to correct dataTypes. For example, all addresses returned by the EvmApi, metamask, or Moralis.Evm.Transfer will be an
EvmAddress - Anywhere where you can provide an datatype as input, you can provide: an instance of the dataType, or any of the accepted input values for that dataType. For example: anywhere where a
chainparam is accepted, you can provide"0x1",1,"ethereum"or an excisting instance ofEvmChain
For example:
- After calling Moralis.Evm.connect, you will get an account that is an instance of
EvmAddress, and a chain that is an instance ofEvmChain - When providing a contractAddress in the EvmApi, you can provide an instance of
EvmAddress, a lowercase address, or a checksum address
These classes come with more utilities, depending on the dataType, but in general these are common methods:
DataType.create("inputvalue"), to create a new instance of the datatype. In most cases the inputvalue can be of different types. For example for EvmChain this can be:"0x1",1,"ethereum". All values will create the same instance of the DataType.dataType.equals(value), will check equality of 2 different dataTypes. For example:const chain = EvmChain.create('ethereum'); chain.equals(1); // -> true chain.equals('0x1'); // -> true chain.equals(EvmChain.create(1)); // -> true
dataType.format(): will format the dataType to a readable format. For some dataTypes, this formatting behaviour can be set in the config (when calling Moralis.start)- For object types (like
Erc20):dataType.toJSON(), will format the internal value to a JSON object
Overview of the most used dataTypes are:
EvmChain: a chain/chainIdEvmAddressan evm addressErc20: a Erc20EvmNft: a Erc721 or Erc1155Erc20Value: a Erc20 value, with utilities to read the value (taking the decimals into account)EvmNative: a representation of native currency with utils to format to wei, gwei or etherEvmTransaction: a non published transactionEvmTransactionResponse: a published transactionEvmTransactionReceipt: a confirmed transaction
You can use all functionalities of Moralis by installing the main package
moralis.But you can also opt-in to only install individual packages. To do so:
- Make sure to install the core package, this one is always required:
npm install @moralisweb3/common-coreoryarn add @moralisweb3/common-core - Install the specific packages that you want. For example
npm install @moralisweb3/evm-apioryarn add @moralisweb3/evm-api - Register the installed package to the Core module, at the top of your code, before any interaction with Moralis:
import Core from '@moralisweb3/common-core'; import EvmApi from '@moralisweb3/evm-api';
Core.registerModules([EvmApi]);
4. Then to start/initialise: ```javascript Core.start(yourConfig)Notes:
- some modules require certain configurations to be set. For example, to use the server module, you should provide
serverUrlandappIdin the config - Some functionalities have dependencies on other modules. If these are not installed, you will get an error that these modules are required. For example authenticating via metamask requires not only the Server module to be installed, but also the Evm module
When calling Moralis.start, you will have more options to configure the usage of moralis. These are the options that you can specift:
logLevel: the detail level of console.logs that you will see. This allows for easy debugging. By defaultdefaultEvmApiChain: the default chain that is used in EvmApi callsauthenticationMessage: the default authentication message when signing messages to authenticateappId: your server appIdserverUrl: your serverUrlapiKey: your apiKey. Used for making apiCalls directly via REST instead of using your server. Only use this in your nodeJs backends.formatEvmChainId: then default way of formatting chains (when calling chain.format())formatEvmAddress: the default way of formatting addresses (when calling address.format())
- Register modules via
Core.registerModules([TheModule]) - Remove module via
Moralis.Core.modules.removeModule("moduleName")
- Set configuration via
Moralis.config.set("key", value) - Read configuration via
Moralis.Core.config.get("key")
Moralis.startaccepts more configuration options
Supported connectors by moralis are exported as its own package. To use them, you need to install them seperately (except for the metamask connector, that is included by default).
Then register the connector like:
import WalletConnectConnector from '@moralisweb3/evm-wallet-connect-connector'; Moralis.Evm.connectors.register(WalletConnectConnector);
If you wish to remove them (not recommended but there might be an exotic use-case):
Moralis.Evm.connectors.remove('wallet-connect'); // Use the name of the connector
- By default, the provided chain will be used that is supplied as param
- Otherwise, the chain will be used that is used to connect to the evm (after calling
Moralis.Evm.connect) - Otherwise, the default chain will be used. It can be set in the config when calling Moralis.start:
Moralis.start({defaultEvmApiChain: 'polygon'}). This value will default to 'eth'
- By default, the provided address will be used that is supplied as param
- Otherwise for some endpoints that, the address will be used that is used to connect to the evm (after calling
Moralis.Evm.connect). These are mainly theEvmApi.accountendpoints
Since the SDK has been completely rewritten, we advise to check the Typescript types, sourcecode, or response values. As some values might have changed or renamed. A lot of types have been changed to use Moralis datatypes (as EvmChain, EvmAddress etc.)
Moralis.transferhas been split up in different functions:Moralis.Evm.transferNativeMoralis.Evm.transferErc20,transferErc721andtransferErc1155Switch metamask network has been changed. It is no longer required to connect to metamask before calling this method. It can be called as
MetamaskConnector.switchNetwork('0x3');(or any EvmChain value)Add metamask network has been changed. It is no longer required to connect to metamask before calling this method. It can be called as
MetamaskConnector.addNetwork('0x3');(or any EvmChain value)Moralis.enableWeb3has been renamed toMoralis.Evm.connect. Connecting works by specifying the walletName and additional options.To connect via metamask:
Moralis.Evm.connect("metamask", {silent: false})install the walletconnect connector package:
@moralisweb3/evm-wallet-connect-connectorThen import it and register the connector
import WalletConnectConnector from '@moralisweb3/evm-wallet-connect-connector'; Moralis.Evm.connectors.register(WalletConnectConnector);
Then call:
Moralis.Evm.connect("walletconnect", options)- To read the connected account has been renamed to
Moralis.Evm.accountand returns anEvmAddess - To read the connected chain has been renamed to
Moralis.Evm.chainand returns anEvmChain
Listening to events about connecting to a network can be done by using:
- onConnecting
- onConnected
- onDisconnected
- onConnectingError
- onAccountChanged
- onChainChanged
- onProviderUpdated
Moralis.Server.authenticate('evm', { connector: 'metamask' })}
Make sure that the Walletconnect connector is added to
Moralis.Evm:install the walletconnect connector package:
@moralisweb3/evm-wallet-connect-connectorThen import it and register the connector
import WalletConnectConnector from '@moralisweb3/evm-wallet-connect-connector'; Moralis.Evm.connectors.register(WalletConnectConnector);
Then call
Moralis.Server.authenticate('evm', { connector: 'wallet-connect', chainId: 56 })}
Setting authentication messages can be done by providing
{authenticationMessage: "Your message"}in Moralis.startSignup to the server can now be done via a single function
Morlais.server.signUp({username, password, email, fields})Renamed to
Moralis.Server.signIn({username, password})To get the current user you now can use:
- For getting the user synchronously:
Moralis.Server.currentUser() - For getting the user asynchronously:
Moralis.Server.currentUserAsync()
- To link an EvmAddress, call
Moralis.Server.linkEvmAddress, it accepts any EvmAddress value - To unlink an EvmAddress, call
Moralis.Server.unlinkEvmAddress, it accepts any EvmAddress value
Server classes as
Moralis.Query,Moralis.Useretc. have been renamed toMoralis.Server.Query,Moralis.Server.Useretc. Any missing classes or methods can be accessed by usingMoralis.Server.instance(). This will return the instance of the server which has theQuery,Useretc. namespaces in it.Listening to state changes regarding authentication can be done via:
- onInitialized
- onAuthenticating
- onAuthenticated
- onAutenticatingError
- onLoggedOut
Web3Apihas been renamed toEvmApi.Response of any EvmApi request has been changed. You now get 3 result
response.result: the returned data from the api has been transformed into more usable datatypes and more consistent formattingresponse.toJSON(): the result fromresponse.resultbut transformed into JSON objects and primitive typesraw: the result as it is returned from the api without any changes. This is the same object a you get with manual requests, or as was implemented in v1.
- Updated dependencies [
6ce5c1f]:- @moralisweb3/[email protected]