@@ -11,9 +11,7 @@ import {
11
11
CraftingRecipe ,
12
12
CraftingInputActions ,
13
13
CraftingOutputActions ,
14
- ERC20Item ,
15
14
ERC1155Item ,
16
- CraftingItem ,
17
15
CraftingInput ,
18
16
CraftingOutput ,
19
17
} from "./types/CraftingTypes"
@@ -101,43 +99,36 @@ export class CraftingContract {
101
99
}
102
100
103
101
public async addRecipe (
104
- recipe : CraftingRecipe ,
105
- overrides ?: ethers . Overrides
102
+ recipe : CraftingRecipe
103
+ // overrides?: ethers.Overrides
106
104
) : Promise < ethers . BigNumber > {
107
- let craftingInputs = recipe . craftingInputs . map (
108
- ( el ) : CraftingInputItemStruct => {
109
- return {
110
- tokenType : "tokenId" in el . item ? 1155 : 20 ,
111
- tokenAddress : el . item . tokenAddrress ,
112
- tokenId :
113
- "tokenId" in el . item
114
- ? ( el . item as ERC1155Item ) . tokenId
115
- : 0 ,
116
- amount : el . item . amount ,
117
- tokenAction : el . action ,
118
- }
119
- }
105
+ const craftingInputs = recipe . craftingInputs . map (
106
+ ( el ) : CraftingInputItemStruct => ( {
107
+ tokenType : "tokenId" in el . item ? 1155 : 20 ,
108
+ tokenAddress : el . item . tokenAddrress ,
109
+ tokenId :
110
+ "tokenId" in el . item ? ( el . item as ERC1155Item ) . tokenId : 0 ,
111
+ amount : el . item . amount ,
112
+ tokenAction : el . action ,
113
+ } )
120
114
)
121
- let craftingOutputs = recipe . craftingOutputs . map (
122
- ( el ) : CraftingOutputItemStruct => {
123
- return {
124
- tokenType : "tokenId" in el . item ? 1155 : 20 ,
125
- tokenAddress : el . item . tokenAddrress ,
126
- tokenId :
127
- "tokenId" in el . item
128
- ? ( el . item as ERC1155Item ) . tokenId
129
- : 0 ,
130
- amount : el . item . amount ,
131
- tokenAction : el . action ,
132
- }
133
- }
115
+ const craftingOutputs = recipe . craftingOutputs . map (
116
+ ( el ) : CraftingOutputItemStruct => ( {
117
+ tokenType : "tokenId" in el . item ? 1155 : 20 ,
118
+ tokenAddress : el . item . tokenAddrress ,
119
+ tokenId :
120
+ "tokenId" in el . item ? ( el . item as ERC1155Item ) . tokenId : 0 ,
121
+ amount : el . item . amount ,
122
+ tokenAction : el . action ,
123
+ } )
134
124
)
135
- let recipeStruct : RecipeStruct = {
125
+ const recipeStruct : RecipeStruct = {
136
126
inputs : craftingInputs ,
137
127
outputs : craftingOutputs ,
138
128
isActive : recipe . isActive ,
139
129
}
140
- await ( await this . contract . addRecipe ( recipeStruct , overrides ) ) . wait ( 1 )
130
+ const tx = await this . contract . addRecipe ( recipeStruct )
131
+ await tx . wait ( 1 )
141
132
return this . numRecipes ( )
142
133
}
143
134
public connect ( _signer : ethers . Signer ) {
0 commit comments