-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
Problem
Calling prepareBatchConversionPaymentTransaction() with options: IRequestPaymentOptions with conversion?: IConversionSettings; without currency: RequestLogicTypes.ICurrency; throws a TypeError, even though the function still works without it.
Possible Solutions
Options:
- Make the
currencyproperty of theIConversionSettingstype optional. - Adjust the input type of
prepareBatchConversionPaymentTransaction().
Reference
requestNetwork/packages/payment-processor/src/payment/batch-conversion-proxy.ts
Lines 71 to 98 in 0e12025
| /** | |
| * Prepares a transaction to pay a batch of requests with an ERC20 currency | |
| * that can be different from the request currency (eg. fiat). | |
| * It can be used with a Multisig contract. | |
| * @param enrichedRequests List of EnrichedRequests to pay. | |
| * @param options It contains 3 paramaters required to prepare a batch payments: | |
| * - conversion: It must contains the currencyManager. | |
| * - skipFeeUSDLimit: It checks the value of batchFeeAmountUSDLimit of the batch proxy deployed. | |
| * Setting the value to true skips the USD fee limit, and reduces gas consumption. | |
| * - version: The version of the batch conversion proxy. | |
| */ | |
| export function prepareBatchConversionPaymentTransaction( | |
| enrichedRequests: EnrichedRequest[], | |
| options: IRequestPaymentOptions, | |
| ): IPreparedTransaction { | |
| const encodedTx = encodePayBatchConversionRequest( | |
| enrichedRequests, | |
| options.skipFeeUSDLimit, | |
| options.conversion, | |
| ); | |
| const value = getBatchTxValue(enrichedRequests); | |
| const proxyAddress = getBatchConversionProxyAddress(enrichedRequests[0].request, options.version); | |
| return { | |
| data: encodedTx, | |
| to: proxyAddress, | |
| value, | |
| }; | |
| } |
requestNetwork/packages/payment-processor/src/types.ts
Lines 34 to 43 in 0e12025
| export interface IConversionSettings { | |
| /** should be a valid currency type and accepted token value */ | |
| currency: RequestLogicTypes.ICurrency; | |
| /** maximum number of tokens to be spent when the conversion is made */ | |
| maxToSpend?: BigNumberish; | |
| /** a currency manager to access currencies property, like decimals */ | |
| currencyManager?: CurrencyTypes.ICurrencyManager; | |
| /** maximum time in seconds of how old chainlink rate can be used, default is zero for infinitely old */ | |
| maxRateAge?: number; | |
| } |
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🎫 Backlog