Skip to content

Commit

Permalink
Feat: add trade asset differenciation (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
Melisa Anabella Rossi authored Jul 2, 2024
1 parent 0d6db51 commit 1f68dda
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
20 changes: 8 additions & 12 deletions report/schemas.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2472,15 +2472,13 @@ export type Trade = {
received: TradeAssetWithBeneficiary[];
};

// Warning: (ae-forgotten-export) The symbol "CollectionItemTradeAsset" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ERC20TradeAsset" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ERC721TradeAsset" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "TradeAsset" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type TradeAsset = {
assetType: TradeAssetType;
contractAddress: string;
value: string;
extra: string;
};
export type TradeAsset = CollectionItemTradeAsset | ERC20TradeAsset | ERC721TradeAsset;

// Warning: (ae-missing-release-tag) "TradeAssetType" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand All @@ -2491,8 +2489,6 @@ export enum TradeAssetType {
// (undocumented)
ERC20 = 1,
// (undocumented)
ERC20_WITH_FEES = 4,
// (undocumented)
ERC721 = 2
}

Expand Down Expand Up @@ -2829,10 +2825,10 @@ export namespace WorldConfiguration {
// src/dapps/sale.ts:18:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/sale.ts:19:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
// src/dapps/sale.ts:42:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/trade.ts:49:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/trade.ts:50:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
// src/dapps/trade.ts:61:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/trade.ts:62:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
// src/dapps/trade.ts:64:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/trade.ts:65:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
// src/dapps/trade.ts:76:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/trade.ts:77:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
// src/platform/item/emote/adr74/emote-data-adr74.ts:7:3 - (ae-incompatible-release-tags) The symbol "representations" is marked as @public, but its signature references "EmoteRepresentationADR74" which is marked as @alpha
// src/platform/item/third-party-props.ts:6:3 - (ae-incompatible-release-tags) The symbol "merkleProof" is marked as @public, but its signature references "MerkleProof" which is marked as @alpha
// src/platform/scene/feature-toggles.ts:11:3 - (ae-forgotten-export) The symbol "EnabledDisabled" needs to be exported by the entry point index.d.ts
Expand Down
23 changes: 19 additions & 4 deletions src/dapps/trade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,32 @@ export type TradeChecks = {
export enum TradeAssetType {
ERC20 = 1,
ERC721 = 2,
COLLECTION_ITEM = 3,
ERC20_WITH_FEES = 4
COLLECTION_ITEM = 3
}

export type TradeAsset = {
export type BaseTradeAsset = {
assetType: TradeAssetType
contractAddress: string
value: string
extra: string
}

export type CollectionItemTradeAsset = BaseTradeAsset & {
assetType: TradeAssetType.COLLECTION_ITEM
itemId: string
}

export type ERC20TradeAsset = BaseTradeAsset & {
assetType: TradeAssetType.ERC20
amount: number
}

export type ERC721TradeAsset = BaseTradeAsset & {
assetType: TradeAssetType.ERC721
tokenId: string
}

export type TradeAsset = CollectionItemTradeAsset | ERC20TradeAsset | ERC721TradeAsset

export type TradeAssetWithBeneficiary = TradeAsset & {
beneficiary: string
}
Expand Down

0 comments on commit 1f68dda

Please sign in to comment.