mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 00:31:34 +03:00
Semantics improvements
This commit is contained in:
@@ -2,17 +2,17 @@ import { ethers } from 'ethers';
|
||||
import type { Source } from '../types.js';
|
||||
|
||||
export default function getAvailableFundsSources(
|
||||
expenseType: 'amount' | 'network_fee' | 'orion_fee',
|
||||
expenseType: 'amount' | 'network_fee' | 'service_fee',
|
||||
assetAddress: string,
|
||||
route: 'aggregator' | 'orion_pool',
|
||||
route: 'aggregator' | 'pool',
|
||||
): Source[] {
|
||||
switch (route) {
|
||||
case 'aggregator':
|
||||
if (assetAddress === ethers.constants.AddressZero) return ['exchange']; // We can't take native crypto from wallet
|
||||
return ['exchange', 'wallet']; // We can take any token amount from exchange + wallet. Order is important!
|
||||
case 'orion_pool':
|
||||
case 'pool':
|
||||
if (expenseType === 'network_fee') return ['wallet']; // Network fee is always taken from wallet
|
||||
return ['exchange', 'wallet']; // We can take any token amount from exchange + wallet (specify 'value' for 'orion_pool'). Order is important!
|
||||
return ['exchange', 'wallet']; // We can take any token amount from exchange + wallet (specify 'value' for 'pool'). Order is important!
|
||||
default:
|
||||
throw new Error('Unknown route item');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user