Skip to content

Commit 9e3d958

Browse files
committed
Incorporate Web3API changes / updates.
1 parent ab63f76 commit 9e3d958

20 files changed

+537
-215
lines changed

Assembly-CSharp.Player.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@
347347
<Compile Include="Assets\Scripts\Moralis\MoralisDotNet\Platform\Queries\Live\OperationTypes.cs" />
348348
<Compile Include="Assets\Scripts\IWeaponCollisionHandler.cs" />
349349
<Compile Include="Assets\Scripts\Moralis\MoralisDotNet\Platform\Services\ServiceHub.cs" />
350+
<Compile Include="Assets\Scripts\Moralis\Moralis.Web3Api.Core\Models\Trade.cs" />
351+
<Compile Include="Assets\Scripts\Moralis\Moralis.Web3Api.Core\Models\TradeCollection.cs" />
352+
<Compile Include="Assets\Scripts\Moralis\Moralis.Web3Api.Core\Models\Erc20TransactionCollection.cs" />
350353
</ItemGroup>
351354
<ItemGroup>
352355
<None Include="Assets\3rdParty\TextMesh Pro\Shaders\TMPro.cginc" />

Assembly-CSharp.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@
347347
<Compile Include="Assets\Scripts\Moralis\MoralisDotNet\Platform\Queries\Live\OperationTypes.cs" />
348348
<Compile Include="Assets\Scripts\IWeaponCollisionHandler.cs" />
349349
<Compile Include="Assets\Scripts\Moralis\MoralisDotNet\Platform\Services\ServiceHub.cs" />
350+
<Compile Include="Assets\Scripts\Moralis\Moralis.Web3Api.Core\Models\Trade.cs" />
351+
<Compile Include="Assets\Scripts\Moralis\Moralis.Web3Api.Core\Models\TradeCollection.cs" />
352+
<Compile Include="Assets\Scripts\Moralis\Moralis.Web3Api.Core\Models\Erc20TransactionCollection.cs" />
350353
</ItemGroup>
351354
<ItemGroup>
352355
<None Include="Assets\3rdParty\TextMesh Pro\Shaders\TMPro.cginc" />

Assets/Scripts/Moralis/Moralis.Web3Api.Core/Interfaces/ITokenApi.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public interface ITokenApi
4343
/// <param name="offset">offset</param>
4444
/// <param name="limit">limit</param>
4545
/// <returns>Returns the trades</returns>
46-
TradesCollection GetNFTTrades (string address, ChainList chain, int? fromBlock=null, string toBlock=null, string fromDate=null, string toDate=null, string providerUrl=null, string marketplace=null, int? offset=null, int? limit=null);
46+
TradeCollection GetNFTTrades (string address, ChainList chain, int? fromBlock=null, string toBlock=null, string fromDate=null, string toDate=null, string providerUrl=null, string marketplace=null, int? offset=null, int? limit=null);
4747

4848
/// <summary>
4949
/// Get the lowest price found for a nft token contract for the last x days (only trades paid in ETH)
@@ -56,7 +56,7 @@ public interface ITokenApi
5656
/// <param name="providerUrl">web3 provider url to user when using local dev chain</param>
5757
/// <param name="marketplace">marketplace from where to get the trades (only opensea is supported at the moment)</param>
5858
/// <returns>Returns the trade with the lowest price</returns>
59-
TradesCollection GetNFTLowestPrice (string address, ChainList chain, int? days=null, string providerUrl=null, string marketplace=null);
59+
Trade GetNFTLowestPrice (string address, ChainList chain, int? days=null, string providerUrl=null, string marketplace=null);
6060

6161
/// <summary>
6262
/// Returns metadata (name, symbol, decimals, logo) for a given token contract address.
@@ -103,7 +103,7 @@ public interface ITokenApi
103103
/// <param name="offset">offset</param>
104104
/// <param name="limit">limit</param>
105105
/// <returns>Returns a collection of token contract transactions.</returns>
106-
List<Erc20Transaction> GetTokenAdressTransfers (string address, ChainList chain, string subdomain=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null);
106+
Erc20TransactionCollection GetTokenAddressTransfers (string address, ChainList chain, string subdomain=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null);
107107

108108
/// <summary>
109109
/// Gets the amount which the spender is allowed to withdraw from the spender
@@ -144,31 +144,6 @@ public interface ITokenApi
144144
/// <returns>Returns the matching NFTs</returns>
145145
NftMetadataCollection SearchNFTs (string q, ChainList chain, string format=null, string filter=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null);
146146

147-
/// <summary>
148-
/// Gets data, including metadata (where available), for all token ids for the given contract address.
149-
/// * Results are sorted by the block the token id was minted (descending) and limited to 100 per page by default
150-
/// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection
151-
///
152-
/// </summary>
153-
/// <param name="address">Address of the contract</param>
154-
/// <param name="chain">The chain to query</param>
155-
/// <param name="format">The format of the token id</param>
156-
/// <param name="offset">offset</param>
157-
/// <param name="limit">limit</param>
158-
/// <returns>Returns a collection of nfts</returns>
159-
NftCollection GetAllTokenIds (string address, ChainList chain, string format=null, int? offset=null, int? limit=null);
160-
161-
/// <summary>
162-
/// Gets the transfers of the tokens matching the given parameters
163-
/// </summary>
164-
/// <param name="address">Address of the contract</param>
165-
/// <param name="chain">The chain to query</param>
166-
/// <param name="format">The format of the token id</param>
167-
/// <param name="offset">offset</param>
168-
/// <param name="limit">limit</param>
169-
/// <returns>Returns a collection of NFT transfers</returns>
170-
NftTransferCollection GetContractNFTTransfers (string address, ChainList chain, string format=null, int? offset=null, int? limit=null);
171-
172147
/// <summary>
173148
/// Gets the transfers of the tokens from a block number to a block number
174149
/// </summary>
@@ -195,6 +170,31 @@ public interface ITokenApi
195170
/// <returns>Returns a collection of NFT transfers</returns>
196171
NftTransferCollection GetNftTransfersFromToBlock (ChainList chain, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, string format=null, int? offset=null, int? limit=null);
197172

173+
/// <summary>
174+
/// Gets data, including metadata (where available), for all token ids for the given contract address.
175+
/// * Results are sorted by the block the token id was minted (descending) and limited to 100 per page by default
176+
/// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection
177+
///
178+
/// </summary>
179+
/// <param name="address">Address of the contract</param>
180+
/// <param name="chain">The chain to query</param>
181+
/// <param name="format">The format of the token id</param>
182+
/// <param name="offset">offset</param>
183+
/// <param name="limit">limit</param>
184+
/// <returns>Returns a collection of nfts</returns>
185+
NftCollection GetAllTokenIds (string address, ChainList chain, string format=null, int? offset=null, int? limit=null);
186+
187+
/// <summary>
188+
/// Gets the transfers of the tokens matching the given parameters
189+
/// </summary>
190+
/// <param name="address">Address of the contract</param>
191+
/// <param name="chain">The chain to query</param>
192+
/// <param name="format">The format of the token id</param>
193+
/// <param name="offset">offset</param>
194+
/// <param name="limit">limit</param>
195+
/// <returns>Returns a collection of NFT transfers</returns>
196+
NftTransferCollection GetContractNFTTransfers (string address, ChainList chain, string format=null, int? offset=null, int? limit=null);
197+
198198
/// <summary>
199199
/// Gets all owners of NFT items within a given contract collection
200200
/// * Use after /nft/contract/{token_address} to find out who owns each token id in a collection

Assets/Scripts/Moralis/Moralis.Web3Api.Core/Models/BlockDate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class BlockDate
1616
/// </summary>
1717
[DataMember(Name = "date", EmitDefaultValue = false)]
1818
[JsonProperty(PropertyName = "date")]
19-
public decimal? Date { get; set; }
19+
public DateTime? Date { get; set; }
2020

2121
/// <summary>
2222
/// The blocknumber
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System;
2+
using System.Text;
3+
using System.Collections;
4+
using System.Collections.Generic;
5+
using System.Runtime.Serialization;
6+
using Newtonsoft.Json;
7+
8+
namespace Moralis.Web3Api.Models
9+
{
10+
[DataContract]
11+
public class Erc20TransactionCollection
12+
{
13+
/// <summary>
14+
/// The total number of matches for this query
15+
/// example: 2000
16+
/// </summary>
17+
[DataMember(Name = "total", EmitDefaultValue = false)]
18+
[JsonProperty(PropertyName = "total")]
19+
public int? Total { get; set; }
20+
21+
/// <summary>
22+
/// The page of the current result
23+
/// example: 2
24+
/// </summary>
25+
[DataMember(Name = "page", EmitDefaultValue = false)]
26+
[JsonProperty(PropertyName = "page")]
27+
public int? Page { get; set; }
28+
29+
/// <summary>
30+
/// The number of results per page
31+
/// example: 100
32+
/// </summary>
33+
[DataMember(Name = "page_size", EmitDefaultValue = false)]
34+
[JsonProperty(PropertyName = "page_size")]
35+
public int? PageSize { get; set; }
36+
37+
/// <summary>
38+
/// </summary>
39+
[DataMember(Name = "result", EmitDefaultValue = false)]
40+
[JsonProperty(PropertyName = "result")]
41+
public List<Erc20Transaction> Result { get; set; }
42+
43+
44+
/// <summary>
45+
/// Get the string presentation of the object
46+
/// </summary>
47+
/// <returns>String presentation of the object</returns>
48+
public override string ToString()
49+
{
50+
var sb = new StringBuilder();
51+
sb.Append("class Erc20TransactionCollection{");
52+
sb.Append(" Total ").Append(Total).Append("\n");
53+
sb.Append(" Page ").Append(Page).Append("\n");
54+
sb.Append(" PageSize ").Append(PageSize).Append("\n");
55+
sb.Append(" Result ").Append(Result).Append("\n");
56+
sb.Append("}");
57+
58+
return sb.ToString();
59+
}
60+
61+
/// <summary>
62+
/// Get the JSON string presentation of the object
63+
/// </summary>
64+
/// <returns>JSON string presentation of the object</returns>
65+
public string ToJson()
66+
{
67+
return JsonConvert.SerializeObject(this, Formatting.Indented);
68+
}
69+
70+
}
71+
}

Assets/Scripts/Moralis/Moralis.Web3Api.Core/Models/Erc20TransactionCollection.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
using System;
2+
using System.Text;
3+
using System.Collections;
4+
using System.Collections.Generic;
5+
using System.Runtime.Serialization;
6+
using Newtonsoft.Json;
7+
8+
namespace Moralis.Web3Api.Models
9+
{
10+
[DataContract]
11+
public class Trade
12+
{
13+
/// <summary>
14+
/// The transaction hash
15+
/// example: 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
16+
/// </summary>
17+
[DataMember(Name = "transaction_hash", EmitDefaultValue = false)]
18+
[JsonProperty(PropertyName = "transaction_hash")]
19+
public string TransactionHash { get; set; }
20+
21+
/// <summary>
22+
/// The transaction index
23+
/// </summary>
24+
[DataMember(Name = "transaction_index", EmitDefaultValue = false)]
25+
[JsonProperty(PropertyName = "transaction_index")]
26+
public string TransactionIndex { get; set; }
27+
28+
/// <summary>
29+
/// The token id(s) traded
30+
/// </summary>
31+
[DataMember(Name = "token_ids", EmitDefaultValue = false)]
32+
[JsonProperty(PropertyName = "token_ids")]
33+
public List<object> TokenIds { get; set; }
34+
35+
/// <summary>
36+
/// The address that sold the NFT
37+
/// example: 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
38+
/// </summary>
39+
[DataMember(Name = "seller_address", EmitDefaultValue = false)]
40+
[JsonProperty(PropertyName = "seller_address")]
41+
public string SellerAddress { get; set; }
42+
43+
/// <summary>
44+
/// The address that bought the NFT
45+
/// example: 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
46+
/// </summary>
47+
[DataMember(Name = "buyer_address", EmitDefaultValue = false)]
48+
[JsonProperty(PropertyName = "buyer_address")]
49+
public string BuyerAddress { get; set; }
50+
51+
/// <summary>
52+
/// The address of the contract that traded the NFT
53+
/// example: 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
54+
/// </summary>
55+
[DataMember(Name = "marketplace_address", EmitDefaultValue = false)]
56+
[JsonProperty(PropertyName = "marketplace_address")]
57+
public string MarketplaceAddress { get; set; }
58+
59+
/// <summary>
60+
/// The value that was sent in the transaction (ETH/BNB/etc..)
61+
/// example: 1000000000000000
62+
/// </summary>
63+
[DataMember(Name = "price", EmitDefaultValue = false)]
64+
[JsonProperty(PropertyName = "price")]
65+
public string Price { get; set; }
66+
67+
/// <summary>
68+
/// The block timestamp
69+
/// example: 6/4/2021 4:00:15 PM
70+
/// </summary>
71+
[DataMember(Name = "block_timestamp", EmitDefaultValue = false)]
72+
[JsonProperty(PropertyName = "block_timestamp")]
73+
public string BlockTimestamp { get; set; }
74+
75+
/// <summary>
76+
/// The blocknumber of the transaction
77+
/// example: 13680123
78+
/// </summary>
79+
[DataMember(Name = "block_number", EmitDefaultValue = false)]
80+
[JsonProperty(PropertyName = "block_number")]
81+
public string BlockNumber { get; set; }
82+
83+
/// <summary>
84+
/// The block hash
85+
/// example: 0x4a7c916ca4a970358b9df90051008f729685ff05e9724a9dddba32630c37cb96
86+
/// </summary>
87+
[DataMember(Name = "block_hash", EmitDefaultValue = false)]
88+
[JsonProperty(PropertyName = "block_hash")]
89+
public string BlockHash { get; set; }
90+
91+
92+
/// <summary>
93+
/// Get the string presentation of the object
94+
/// </summary>
95+
/// <returns>String presentation of the object</returns>
96+
public override string ToString()
97+
{
98+
var sb = new StringBuilder();
99+
sb.Append("class Trade{");
100+
sb.Append(" TransactionHash ").Append(TransactionHash).Append("\n");
101+
sb.Append(" TransactionIndex ").Append(TransactionIndex).Append("\n");
102+
sb.Append(" TokenIds ").Append(TokenIds).Append("\n");
103+
sb.Append(" SellerAddress ").Append(SellerAddress).Append("\n");
104+
sb.Append(" BuyerAddress ").Append(BuyerAddress).Append("\n");
105+
sb.Append(" MarketplaceAddress ").Append(MarketplaceAddress).Append("\n");
106+
sb.Append(" Price ").Append(Price).Append("\n");
107+
sb.Append(" BlockTimestamp ").Append(BlockTimestamp).Append("\n");
108+
sb.Append(" BlockNumber ").Append(BlockNumber).Append("\n");
109+
sb.Append(" BlockHash ").Append(BlockHash).Append("\n");
110+
sb.Append("}");
111+
112+
return sb.ToString();
113+
}
114+
115+
/// <summary>
116+
/// Get the JSON string presentation of the object
117+
/// </summary>
118+
/// <returns>JSON string presentation of the object</returns>
119+
public string ToJson()
120+
{
121+
return JsonConvert.SerializeObject(this, Formatting.Indented);
122+
}
123+
124+
}
125+
}

Assets/Scripts/Moralis/Moralis.Web3Api.Core/Models/Trade.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)