Skip to content

Commit

Permalink
fix: fixed priceTokenAddress property. (#1095)
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz authored Apr 13, 2023
1 parent f9df5ee commit 6e1fc78
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/clever-ligers-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@moralisweb3/common-evm-utils': patch
'@moralisweb3/evm-api': patch
---

Fixed the `priceTokenAddress` property in the `EvmNftTrade` type.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface EvmNftTradeInput {
tokenAddress: EvmAddressish;
marketplaceAddress: EvmAddressish;
price: EvmNativeish;
priceTokenAddress?: null | EvmAddressish;
priceTokenAddress?: EvmAddressish;
blockTimestamp: DateInput;
blockNumber: BigNumberish;
blockHash: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function deserializeResponse(jsonResponse: GetNFTTradesJSONResponse, request: Ge
sellerAddress: EvmAddress.create(trade.seller_address, core),
buyerAddress: EvmAddress.create(trade.buyer_address, core),
marketplaceAddress: EvmAddress.create(trade.marketplace_address, core),
priceTokenAddress: maybe(trade.price_token_address, (address) => EvmAddress.create(address, core)),
tokenAddress: EvmAddress.create(trade.token_address as string, core),
price: EvmNative.create(trade.price, 'wei'),
blockTimestamp: new Date(trade.block_timestamp),
Expand Down
5 changes: 5 additions & 0 deletions packages/common/evmUtils/src/operations/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,11 @@ export interface components {
* @example 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
*/
marketplace_address: string;
/**
* @description The address of the token used to pay for the NFT
* @example 0x60e4d786628fea6478f785a6d7e704777c86a7c6
*/
price_token_address?: string;
/**
* @description The value that was sent in the transaction (ETH/BNB/etc..)
* @example 1000000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const mockGetNFTTrades = MockScenarios.create(
token_address: '0x9c57d0278199c931cf149cc769f37bb7847091e7',
marketplace_address: '0x00000000006c3852cbef3e08e8df289169ede581',
price: '69990000000000000',
price_token_address: null,
price_token_address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
block_timestamp: '2022-12-06T00:32:11.000Z',
block_number: '16122185',
block_hash: '0xd01990eb290c77fe3e7db77a83c0ff465cc3dd5f74b9eb53d9b2c2ea178c7009',
Expand Down
1 change: 1 addition & 0 deletions packages/evmApi/integration/test/getNFTTrades.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('getNFTTrades', () => {
expect(trade.sellerAddress.lowercase).toBe('0xc970bd05d27466f10e0d1c8653d6bca217ef04f2');
expect(trade.buyerAddress.lowercase).toBe('0x9f7509cdc8b846c65482f5d2829ab47360095d82');
expect(trade.tokenAddress.lowercase).toBe('0x9c57d0278199c931cf149cc769f37bb7847091e7');
expect(trade.priceTokenAddress?.lowercase).toBe('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2');
expect(trade.marketplaceAddress.lowercase).toBe('0x00000000006c3852cbef3e08e8df289169ede581');
expect(trade.price.wei).toBe('69990000000000000');
expect(trade.blockTimestamp.getTime()).toBe(1670286731000);
Expand Down

1 comment on commit 6e1fc78

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage

Title Lines Statements Branches Functions
api-utils Coverage: 30%
30.34% (61/201) 30.35% (17/56) 30.76% (12/39)
auth Coverage: 89%
92.38% (97/105) 83.33% (20/24) 86.2% (25/29)
evm-api Coverage: 100%
100% (89/89) 66.66% (6/9) 100% (57/57)
common-aptos-utils Coverage: 4%
4.5% (149/3305) 4.64% (25/538) 5.52% (45/814)
common-evm-utils Coverage: 70%
71.11% (1423/2001) 32.04% (314/980) 48.22% (393/815)
sol-api Coverage: 96%
96.66% (29/30) 66.66% (6/9) 91.66% (11/12)
common-sol-utils Coverage: 74%
74.55% (167/224) 66.66% (18/27) 65.38% (51/78)
common-streams-utils Coverage: 91%
91.42% (1184/1295) 77.57% (415/535) 82.08% (426/519)
streams Coverage: 88%
88.19% (575/652) 68.81% (64/93) 87.94% (124/141)

Please sign in to comment.