@dhedge/trading-widget 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +79 -78
  2. package/core-kit/abi/index.d.ts +1 -1
  3. package/core-kit/abi/synthetix-v3/ierc-7412.d.ts +12 -0
  4. package/core-kit/abi/synthetix-v3/index.d.ts +0 -1
  5. package/core-kit/const/default-data.d.ts +1 -1
  6. package/core-kit/const/tokens/arbitrum.d.ts +2 -0
  7. package/core-kit/const/tokens/base.d.ts +2 -0
  8. package/core-kit/const/tokens/optimism.d.ts +2 -0
  9. package/core-kit/const/tokens/polygon.d.ts +1 -0
  10. package/core-kit/hooks/trading/index.d.ts +1 -0
  11. package/core-kit/hooks/trading/synthetix-v3/use-available-withdraw-liquidity.d.ts +47 -0
  12. package/core-kit/hooks/trading/synthetix-v3/use-oracles-update-transaction-data.d.ts +10 -2
  13. package/core-kit/hooks/trading/synthetix-v3/use-withdraw-liquidity.d.ts +5 -0
  14. package/core-kit/types/pool.types.d.ts +1 -0
  15. package/core-kit/types/synthetix-v3.types.d.ts +8 -2
  16. package/core-kit/types/web3.types.d.ts +1 -1
  17. package/core-kit/utils/formatter.d.ts +1 -1
  18. package/core-kit/utils/synthetix-v3/eip-7412.d.ts +21 -10
  19. package/core-kit/utils/synthetix-v3/parse-error.d.ts +1 -1
  20. package/core-kit/utils/synthetix-v3/pyth-adapter.d.ts +10 -9
  21. package/{index-12329f48.js → index-6f9f1263.js} +9580 -9406
  22. package/index-fcb38d25.cjs +207 -0
  23. package/index.cjs +1 -1
  24. package/index.d.ts +3 -3
  25. package/index.js +206 -199
  26. package/package.json +1 -1
  27. package/{pyth-adapter-6c8739a2.cjs → pyth-adapter-919fe86e.cjs} +6 -6
  28. package/{pyth-adapter-f139cf42.js → pyth-adapter-9c02b4f7.js} +53 -40
  29. package/trading-widget/components/withdraw/button/valid-withdraw-button/valid-withdraw-button.hooks.d.ts +3 -0
  30. package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +1 -0
  31. package/core-kit/abi/synthetix-v3/ierc-2771-context.d.ts +0 -15
  32. package/core-kit/utils/synthetix-v3/multicall-forwarder-batcher.d.ts +0 -8
  33. package/index-e8439723.cjs +0 -207
package/README.md CHANGED
@@ -414,84 +414,85 @@ path: `component.meta[name]`
414
414
  <code>translation</code>
415
415
  <code><b>/</b></code>
416
416
  <code>Translation keys</code>
417
- </summary>
418
-
419
- > | name | type | default value | description |
420
- > |----------------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
421
- > | `depositSlippageWarning` | string | Excludes entry fee. Slippage may be amplified by the leverage. See the docs for more info. | |
422
- > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
423
- > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
424
- > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
425
- > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
426
- > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
427
- > | `dailyEarnings` | string | Daily Earnings | |
428
- > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
429
- > | `yearlyEarnings` | string | Yearly Earnings | |
430
- > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
431
- > | `tradeDetails` | string | Trade details | |
432
- > | `maxSlippage` | string | Max slippage | |
433
- > | `minReceiveAmount` | string | You will receive no less than this amount. | |
434
- > | `minReceived` | string | Minimum Received | |
435
- > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
436
- > | `infinite` | string | Infinite | |
437
- > | `tokenAllowance` | string | Token Allowance | |
438
- > | `entryFee` | string | Entry Fee | |
439
- > | `entryFeeExplanation` | string | When you deposit, the token takes a small entry fee. This fee helps cover the costs when we rebalance the underlying funds, and it's shared among all token holders. | |
440
- > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
441
- > | `minDepositUsd` | string | Minimum deposit in USD. | |
442
- > | `minDeposit` | string | Minimum Deposit | |
443
- > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
444
- > | `slippageTolerance` | string | Slippage tolerance | |
445
- > | `bypassEntryFee` | string | Bypass Entry Fee | |
446
- > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
447
- > | `auto` | string | Auto | |
448
- > | `autoSlippageDescription` | string | App is testing different slippage ranges, starting low and increasing until it's likely to pass | |
449
- > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
450
- > | `deposit` | string | Buy | |
451
- > | `withdraw` | string | Sell | |
452
- > | `yourBalance` | string | Your Balance | |
453
- > | `max` | string | Max | |
454
- > | `allAssets` | string | All Assets | |
455
- > | `all` | string | All | |
456
- > | `payWith` | string | Pay with | |
457
- > | `buyEstimated` | string | Buy (estimated) | |
458
- > | `sell` | string | Sell | |
459
- > | `receiveEstimated` | string | Receive (estimated) | |
460
- > | `confirmInWallet` | string | Please confirm in wallet | |
461
- > | `pending` | string | Pending... | |
462
- > | `approve` | string | Approve | |
463
- > | `connectWallet` | string | Connect Wallet | |
464
- > | `minimumPurchase` | string | Minimum purchase is ${value} | |
465
- > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
466
- > | `poolIsPrivate` | string | This vault is currently private | |
467
- > | `updateOracles` | string | Update Oracles | |
468
- > | `checkingOracles` | string | Checking Oracles | |
469
- > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
470
- > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
471
- > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
472
- > | `termsOfUse` | string | Terms Of Use | |
473
- > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
474
- > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
475
- > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
476
- > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
477
- > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
478
- > | `termOfUseDepositAccept` | string | Accept & Deposit | |
479
- > | `back` | string | Back | |
480
- > | `highSlippage` | string | High Slippage Alert | |
481
- > | `responsibleHighSlippage` | string | By proceeding with this trade, you acknowledge and accept the possibility of experiencing high slippage, resulting in a potential difference between the expected and executed price. | |
482
- > | `highSlippageListTitle` | string | Please consider the following before confirming | |
483
- > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
484
- > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
485
- > | `confirm` | string | Confirm | |
486
- > | `selectToken` | string | Select Token | |
487
- > | `sendingOrderToWallet` | string | Sending order to your wallet | |
488
- > | `settingUpTx` | string | Setting up transaction | |
489
- > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
490
- > | `approveSpending` | string | Approve {symbol} spending | |
491
- > | `pay` | string | Pay | |
492
- > | `multiAssetFractions` | string | multi asset fractions | |
493
- > | `explorer` | string | Explorer | |
494
- > | `as` | string | As | |
417
+ </summary>|
418
+
419
+ > | name | type | default value | description |
420
+ > |-----------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
421
+ > | `depositSlippageWarning` | string | Excludes entry fee. Slippage may be amplified by the leverage. See the docs for more info. | |
422
+ > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
423
+ > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
424
+ > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
425
+ > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
426
+ > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
427
+ > | `dailyEarnings` | string | Daily Earnings | |
428
+ > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
429
+ > | `yearlyEarnings` | string | Yearly Earnings | |
430
+ > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
431
+ > | `tradeDetails` | string | Trade details | |
432
+ > | `maxSlippage` | string | Max slippage | |
433
+ > | `minReceiveAmount` | string | You will receive no less than this amount. | |
434
+ > | `minReceived` | string | Minimum Received | |
435
+ > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
436
+ > | `infinite` | string | Infinite | |
437
+ > | `tokenAllowance` | string | Token Allowance | |
438
+ > | `entryFee` | string | Entry Fee | |
439
+ > | `entryFeeExplanation` | string | When you deposit, the token takes a small entry fee. This fee helps cover the costs when we rebalance the underlying funds, and it's shared among all token holders. | |
440
+ > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
441
+ > | `minDepositUsd` | string | Minimum deposit in USD. | |
442
+ > | `minDeposit` | string | Minimum Deposit | |
443
+ > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
444
+ > | `slippageTolerance` | string | Slippage tolerance | |
445
+ > | `bypassEntryFee` | string | Bypass Entry Fee | |
446
+ > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
447
+ > | `auto` | string | Auto | |
448
+ > | `autoSlippageDescription` | string | App is testing different slippage ranges, starting low and increasing until it's likely to pass | |
449
+ > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
450
+ > | `deposit` | string | Buy | |
451
+ > | `withdraw` | string | Sell | |
452
+ > | `yourBalance` | string | Your Balance | |
453
+ > | `max` | string | Max | |
454
+ > | `allAssets` | string | All Assets | |
455
+ > | `all` | string | All | |
456
+ > | `payWith` | string | Pay with | |
457
+ > | `buyEstimated` | string | Buy (estimated) | |
458
+ > | `sell` | string | Sell | |
459
+ > | `receiveEstimated` | string | Receive (estimated) | |
460
+ > | `confirmInWallet` | string | Please confirm in wallet | |
461
+ > | `pending` | string | Pending... | |
462
+ > | `approve` | string | Approve | |
463
+ > | `connectWallet` | string | Connect Wallet | |
464
+ > | `minimumPurchase` | string | Minimum purchase is ${value} | |
465
+ > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
466
+ > | `poolIsPrivate` | string | This vault is currently private | |
467
+ > | `updateOracles` | string | Update Oracles | |
468
+ > | `checkingOracles` | string | Checking Oracles | |
469
+ > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
470
+ > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
471
+ > | `withdrawalLiquidityDisabled` | string | Intended withdraw value is greater than available liquidity ({symbol} {value}) | |
472
+ > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
473
+ > | `termsOfUse` | string | Terms Of Use | |
474
+ > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
475
+ > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
476
+ > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
477
+ > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
478
+ > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
479
+ > | `termOfUseDepositAccept` | string | Accept & Deposit | |
480
+ > | `back` | string | Back | |
481
+ > | `highSlippage` | string | High Slippage Alert | |
482
+ > | `responsibleHighSlippage` | string | By proceeding with this trade, you acknowledge and accept the possibility of experiencing high slippage, resulting in a potential difference between the expected and executed price. | |
483
+ > | `highSlippageListTitle` | string | Please consider the following before confirming | |
484
+ > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
485
+ > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
486
+ > | `confirm` | string | Confirm | |
487
+ > | `selectToken` | string | Select Token | |
488
+ > | `sendingOrderToWallet` | string | Sending order to your wallet | |
489
+ > | `settingUpTx` | string | Setting up transaction | |
490
+ > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
491
+ > | `approveSpending` | string | Approve {symbol} spending | |
492
+ > | `pay` | string | Pay | |
493
+ > | `multiAssetFractions` | string | multi asset fractions | |
494
+ > | `explorer` | string | Explorer | |
495
+ > | `as` | string | As | |
495
496
 
496
497
  ###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
497
498
  ###### Default values: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.defaults.ts`
@@ -6,6 +6,6 @@ export { PoolFactoryAbi } from './pool-factory';
6
6
  export { PoolLogicAbi } from './pool-logic';
7
7
  export { PoolManagerLogicAbi } from './pool-manager-logic';
8
8
  export { RewardDistributionAbi } from './reward-distribution';
9
- export { ITrustedMulticallForwarderAbi, IERC2771ContextAbi, IERC7412Abi, SynthetixV3CoreAbi, SynthetixV3AssetGuard, SynthetixV3ContractGuard, } from './synthetix-v3';
9
+ export { ITrustedMulticallForwarderAbi, IERC7412Abi, SynthetixV3CoreAbi, SynthetixV3AssetGuard, SynthetixV3ContractGuard, } from './synthetix-v3';
10
10
  export { FlatcoinPointsModuleAbi } from './flatcoin-points-module';
11
11
  export { EasySwapperV2Abi } from './easy-swapper-v2';
@@ -18,6 +18,14 @@ export declare const IERC7412Abi: readonly [{
18
18
  readonly internalType: "bytes32";
19
19
  }];
20
20
  readonly stateMutability: "view";
21
+ }, {
22
+ readonly type: "error";
23
+ readonly name: "Errors";
24
+ readonly inputs: readonly [{
25
+ readonly name: "errors";
26
+ readonly type: "bytes[]";
27
+ readonly internalType: "bytes[]";
28
+ }];
21
29
  }, {
22
30
  readonly type: "error";
23
31
  readonly name: "FeeRequired";
@@ -37,5 +45,9 @@ export declare const IERC7412Abi: readonly [{
37
45
  readonly name: "oracleQuery";
38
46
  readonly type: "bytes";
39
47
  readonly internalType: "bytes";
48
+ }, {
49
+ readonly name: "feeRequired";
50
+ readonly type: "uint256";
51
+ readonly internalType: "uint256";
40
52
  }];
41
53
  }];
@@ -1,6 +1,5 @@
1
1
  export { SynthetixV3AssetGuard } from './synthetix-v3-asset-guard';
2
2
  export { SynthetixV3ContractGuard } from './synthetix-v3-contract-guard';
3
- export { IERC2771ContextAbi } from './ierc-2771-context';
4
3
  export { IERC7412Abi } from './ierc-7412';
5
4
  export { ITrustedMulticallForwarderAbi } from './i-trusted-multicall-forwarder';
6
5
  export { SynthetixV3CoreAbi } from './synthetix-v3-core';
@@ -12,7 +12,7 @@ export declare const EMPTY_POOL_CONFIG: PoolConfig;
12
12
  export declare const DEFAULT_DEPOSIT_METHOD: DepositMethodName;
13
13
  export declare const DEFAULT_WITHDRAW_SLIPPAGE = 3;
14
14
  export declare const DEFAULT_DEPOSIT_SLIPPAGE = 0;
15
- export declare const DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP = 0.1;
15
+ export declare const DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP = 0.2;
16
16
  export declare const DEFAULT_SWAP_TRANSACTION_SLIPPAGE = 0.3;
17
17
  export declare const DEFAULT_WITHDRAW_SLIPPAGE_SCALE: number[];
18
18
  export declare const DEFAULT_DEPOSIT_SLIPPAGE_SCALE: number[];
@@ -3,3 +3,5 @@ export declare const BRIDGED_USDC_ARBITRUM: TradingToken;
3
3
  export declare const USDC_ARBITRUM: TradingToken;
4
4
  export declare const WETH_ARBITRUM: TradingToken;
5
5
  export declare const WBTC_ARBITRUM: TradingToken;
6
+ export declare const TBTC_ARBITRUM: TradingToken;
7
+ export declare const WSTETH_ARBITRUM: TradingToken;
@@ -4,3 +4,5 @@ export declare const USDCBC_BASE: TradingToken;
4
4
  export declare const WETH_BASE: TradingToken;
5
5
  export declare const CBETH_BASE: TradingToken;
6
6
  export declare const RETH_BASE: TradingToken;
7
+ export declare const TBTC_BASE: TradingToken;
8
+ export declare const WSTETH_BASE: TradingToken;
@@ -8,3 +8,5 @@ export declare const DAI_OPTIMISM: TradingToken;
8
8
  export declare const WBTC_OPTIMISM: TradingToken;
9
9
  export declare const SETH_OPTIMISM: TradingToken;
10
10
  export declare const LINK_OPTIMISM: TradingToken;
11
+ export declare const TBTC_OPTIMISM: TradingToken;
12
+ export declare const WSTETH_OPTIMISM: TradingToken;
@@ -7,3 +7,4 @@ export declare const WBTC_POLYGON: TradingToken;
7
7
  export declare const WMATIC_POLYGON: TradingToken;
8
8
  export declare const USDT_POLYGON: TradingToken;
9
9
  export declare const DAI_POLYGON: TradingToken;
10
+ export declare const TBTC_POLYGON: TradingToken;
@@ -12,3 +12,4 @@ export { useDepositProjectedEarnings } from './projected-earnings/use-deposit-pr
12
12
  export { useProjectedEarningsCore } from './projected-earnings/use-projected-earnings-core';
13
13
  export { useSwapDataQuery } from './use-swap-data-query';
14
14
  export { useSendTokenDebouncedValue } from './use-send-token-debounced-value';
15
+ export { useAvailableWithdrawLiquidity } from './synthetix-v3/use-available-withdraw-liquidity';
@@ -0,0 +1,47 @@
1
+ export declare const useAvailableWithdrawLiquidity: (params?: {
2
+ enabled?: boolean;
3
+ }) => import("wagmi").UseReadContractReturnType<readonly [{
4
+ readonly inputs: readonly [{
5
+ readonly internalType: "uint128";
6
+ readonly name: "accountId";
7
+ readonly type: "uint128";
8
+ }, {
9
+ readonly internalType: "uint128";
10
+ readonly name: "poolId";
11
+ readonly type: "uint128";
12
+ }, {
13
+ readonly internalType: "address";
14
+ readonly name: "collateralType";
15
+ readonly type: "address";
16
+ }];
17
+ readonly name: "getPositionDebt";
18
+ readonly outputs: readonly [{
19
+ readonly internalType: "int256";
20
+ readonly name: "debtD18";
21
+ readonly type: "int256";
22
+ }];
23
+ readonly stateMutability: "nonpayable";
24
+ readonly type: "function";
25
+ }, {
26
+ readonly inputs: readonly [{
27
+ readonly internalType: "uint128";
28
+ readonly name: "accountId";
29
+ readonly type: "uint128";
30
+ }, {
31
+ readonly internalType: "address";
32
+ readonly name: "collateralType";
33
+ readonly type: "address";
34
+ }];
35
+ readonly name: "getAccountAvailableCollateral";
36
+ readonly outputs: readonly [{
37
+ readonly internalType: "uint256";
38
+ readonly name: "";
39
+ readonly type: "uint256";
40
+ }];
41
+ readonly stateMutability: "view";
42
+ readonly type: "function";
43
+ }], "getAccountAvailableCollateral", [bigint, `0x${string}`], {
44
+ address: `0x${string}`;
45
+ value: number;
46
+ formatted: string;
47
+ }>;
@@ -6,10 +6,18 @@ interface UseOraclesUpdateQueryVariables {
6
6
  chainId: number;
7
7
  vaultAddress: string;
8
8
  }
9
+ type UseOraclesUpdateQueryResult = {
10
+ isOracleDataUpdateNeeded: boolean;
11
+ prependedTxns: TransactionRequest[];
12
+ };
13
+ export declare const DEFAULT_ORACLES_DATA_RESPONSE: {
14
+ isOracleDataUpdateNeeded: boolean;
15
+ prependedTxns: never[];
16
+ };
9
17
  export declare const useOraclesUpdateTransactionData: ({ publicClient, account, chainId, vaultAddress, }: {
10
18
  publicClient: NonNullable<ReturnType<typeof usePublicClient>> | undefined;
11
- } & UseOraclesUpdateQueryVariables, options?: Omit<UseQueryOptions<TransactionRequest | null, DefaultError, TransactionRequest | null, [
19
+ } & UseOraclesUpdateQueryVariables, options?: Omit<UseQueryOptions<UseOraclesUpdateQueryResult, DefaultError, UseOraclesUpdateQueryResult, [
12
20
  string,
13
21
  UseOraclesUpdateQueryVariables
14
- ]>, 'queryKey' | 'queryFn'>) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<TransactionRequest | null, Error>;
22
+ ]>, 'queryKey' | 'queryFn'>) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<UseOraclesUpdateQueryResult, Error>;
15
23
  export {};
@@ -0,0 +1,5 @@
1
+ export declare const useWithdrawLiquidity: () => {
2
+ noLiquidity: boolean;
3
+ symbol: string | undefined;
4
+ availableLiquidity: string | undefined;
5
+ };
@@ -13,4 +13,5 @@ export interface PoolComposition {
13
13
  export interface PoolCompositionWithFraction extends PoolComposition {
14
14
  fraction: string;
15
15
  fractionUsd: string;
16
+ fractionUsdNumber: number;
16
17
  }
@@ -1,7 +1,13 @@
1
- import type { Address, Client, Hex, PublicClient, TransactionRequest } from 'core-kit/types/web3.types';
1
+ import type { Address, Hex, PublicClient, TransactionRequest } from 'core-kit/types/web3.types';
2
2
  export interface OracleAdapter {
3
3
  getOracleId: () => string;
4
- fetchOffchainData: (client: Client, oracleContract: Address, oracleQuery: Hex) => Promise<Hex>;
4
+ fetchOffchainData: (client: PublicClient | undefined, oracleContract: Address, oracleQuery: Array<{
5
+ query: Hex;
6
+ fee: bigint;
7
+ }> | undefined) => Promise<Array<{
8
+ arg: Hex;
9
+ fee?: bigint;
10
+ }>>;
5
11
  }
6
12
  export interface Batcher {
7
13
  batchable: (client: PublicClient, transactions: TransactionRequest[]) => Promise<boolean>;
@@ -1,6 +1,6 @@
1
1
  import type { Address, Chain, TransactionRequest as ViemTransactionRequest } from 'viem';
2
2
  export type { UseWriteContractParameters, UseReadContractsParameters, } from 'wagmi';
3
- export type { Hex, PublicClient, WalletClient, Client, WaitForTransactionReceiptReturnType, CallExecutionError, MulticallReturnType, ContractFunctionReturnType, } from 'viem';
3
+ export type { Hex, PublicClient, WalletClient, Client, WaitForTransactionReceiptReturnType, CallExecutionError, MulticallReturnType, Hash, ContractFunctionReturnType, } from 'viem';
4
4
  export type { Address, Chain };
5
5
  export type ChainId = Chain['id'];
6
6
  export type TransactionRequest = Pick<ViemTransactionRequest, 'to' | 'data' | 'value' | 'from'>;
@@ -1,7 +1,7 @@
1
1
  import type { ApyCurrency } from 'core-kit/types';
2
2
  export declare const formatPercentage: (value: number, maximumFractionDigits?: number) => string;
3
3
  export declare const formatToUsd: ({ value, minimumFractionDigits, maximumFractionDigits, compact, normalize, }: {
4
- value: number;
4
+ value: number | string;
5
5
  minimumFractionDigits?: number | undefined;
6
6
  maximumFractionDigits?: number | undefined;
7
7
  compact?: boolean | undefined;
@@ -1,10 +1,21 @@
1
- import type { Batcher, OracleAdapter, PublicClient, TransactionRequest } from 'core-kit/types';
2
- export declare class Eip7412 {
3
- oracleAdapters: Map<string, OracleAdapter>;
4
- batcher: Batcher;
5
- constructor(oracleAdapters: OracleAdapter[], batcher: Batcher);
6
- buildTransactions(client: PublicClient, transactions: TransactionRequest | TransactionRequest[]): Promise<TransactionRequest[]>;
7
- buildTransaction(client: PublicClient, transactions: TransactionRequest | TransactionRequest[]): Promise<TransactionRequest>;
8
- batch(_client: PublicClient, transactions: TransactionRequest[]): Promise<TransactionRequest>;
9
- enableERC7412(client: PublicClient, tx: TransactionRequest | TransactionRequest[], returnList?: boolean): Promise<TransactionRequest | TransactionRequest[]>;
10
- }
1
+ import type { Hex } from 'viem';
2
+ import type { usePublicClient } from 'wagmi';
3
+ import type { Address, OracleAdapter, TransactionRequest } from 'core-kit/types';
4
+ export declare const LEGACY_ODR_ERROR: {
5
+ type: string;
6
+ name: string;
7
+ inputs: {
8
+ type: string;
9
+ }[];
10
+ }[];
11
+ export declare const makeTrustedForwarderMulticall: (transactions: TransactionRequest[]) => {
12
+ from: `0x${string}`;
13
+ to: `0x${string}`;
14
+ value: bigint;
15
+ data: `0x${string}`;
16
+ };
17
+ export declare function resolveAdapterCalls(origError: unknown, publicClient: NonNullable<ReturnType<typeof usePublicClient>> | undefined): Record<Address, Array<{
18
+ query: Hex;
19
+ fee: bigint;
20
+ }>>;
21
+ export declare function resolvePrependTransaction(origError: unknown, publicClient: NonNullable<ReturnType<typeof usePublicClient>> | undefined, adapters: OracleAdapter[], chainId: number): Promise<TransactionRequest[]>;
@@ -1,3 +1,3 @@
1
- import type { Hex } from 'core-kit/types';
1
+ import type { Hex } from 'viem';
2
2
  export declare function parseError(error: any): Hex;
3
3
  export declare const getErrorMessage: (error: unknown) => string;
@@ -1,12 +1,13 @@
1
- import type { Address, Client, Hex } from 'viem';
2
- interface Adapter {
3
- getOracleId(): string;
4
- fetchOffchainData(client: Client, oracleContract: Address, oracleQuery: Hex): Promise<Hex>;
5
- }
6
- export declare class PythAdapter implements Adapter {
7
- private connection;
1
+ import type { Address, Hex, OracleAdapter, PublicClient } from 'core-kit/types';
2
+ export declare class PythAdapter implements OracleAdapter {
3
+ private readonly connection;
8
4
  constructor(endpoint: string);
9
5
  getOracleId(): string;
10
- fetchOffchainData(_client: Client, _requester: Address, data: Hex): Promise<Hex>;
6
+ fetchOffchainData(_client: PublicClient | undefined, _oracleContract: Address, oracleQuery: Array<{
7
+ query: Hex;
8
+ fee?: bigint;
9
+ }> | undefined): Promise<Array<{
10
+ arg: Hex;
11
+ fee: bigint;
12
+ }>>;
11
13
  }
12
- export {};