File tree Expand file tree Collapse file tree 1 file changed +1
-19
lines changed
Assets/Thirdweb/Core/Scripts Expand file tree Collapse file tree 1 file changed +1
-19
lines changed Original file line number Diff line number Diff line change @@ -165,25 +165,7 @@ public async Task<TransactionResult> SetAllowance(string spender, string amount)
165
165
}
166
166
else
167
167
{
168
- CurrencyValue currentAllowance = await Allowance ( spender ) ;
169
- BigInteger diff = BigInteger . Parse ( amount . ToWei ( ) ) - BigInteger . Parse ( currentAllowance . value ) ;
170
-
171
- var result = new TransactionResult ( ) ;
172
- if ( diff == 0 )
173
- {
174
- ThirdwebDebug . LogWarning ( $ "Allowance is already of amount { amount } - Skipping request...") ;
175
- result = null ;
176
- }
177
- else if ( diff < 0 )
178
- {
179
- return await TransactionManager . ThirdwebWrite ( contractAddress , new TokenERC20Contract . DecreaseAllowanceFunction ( ) { Spender = spender , SubtractedValue = diff * - 1 } ) ;
180
- }
181
- else
182
- {
183
- return await TransactionManager . ThirdwebWrite ( contractAddress , new TokenERC20Contract . IncreaseAllowanceFunction ( ) { Spender = spender , AddedValue = diff } ) ;
184
- }
185
-
186
- return result ;
168
+ return await TransactionManager . ThirdwebWrite ( contractAddress , new TokenERC20Contract . ApproveFunction ( ) { Spender = spender , Amount = BigInteger . Parse ( amount . ToWei ( ) ) } ) ;
187
169
}
188
170
}
189
171
You can’t perform that action at this time.
0 commit comments