@dhedge/trading-widget 3.2.3 → 3.3.0-alpha.1

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 (41) hide show
  1. package/README.md +1 -0
  2. package/core-kit/abi/aave/aave-asset-guard.d.ts +50 -0
  3. package/core-kit/abi/easy-swapper-v2.d.ts +92 -0
  4. package/core-kit/abi/index.d.ts +3 -2
  5. package/core-kit/abi/pool-logic.d.ts +67 -0
  6. package/core-kit/abi/pool-manager-logic.d.ts +19 -0
  7. package/core-kit/const/contracts/polygon.d.ts +2 -0
  8. package/core-kit/hooks/pool/index.d.ts +1 -0
  9. package/core-kit/hooks/pool/multicall/use-pool-manager.dynamic.d.ts +75 -190
  10. package/core-kit/hooks/pool/multicall/use-pool-manager.static.d.ts +57 -0
  11. package/core-kit/hooks/pool/multicall/use-pool.static.d.ts +274 -0
  12. package/core-kit/hooks/pool/multicall/use-pools.dynamic.d.ts +353 -0
  13. package/core-kit/hooks/pool/use-has-dhedge-vault-in-composition.d.ts +64 -0
  14. package/core-kit/hooks/pool/use-pool-dynamic-contract-data.d.ts +1 -0
  15. package/core-kit/hooks/trading/deposit-v2/use-deposit-quote-contract-read.d.ts +92 -0
  16. package/core-kit/hooks/trading/use-swaps-data-query.d.ts +6 -0
  17. package/core-kit/hooks/trading/withdraw-v2/init-step/index.d.ts +1 -1
  18. package/core-kit/hooks/trading/withdraw-v2/init-step/use-fetch-aave-swap-params.d.ts +6 -0
  19. package/core-kit/hooks/trading/withdraw-v2/init-step/use-fetch-init-withdraw-aave-swap-data.d.ts +5 -0
  20. package/core-kit/hooks/trading/withdraw-v2/init-step/use-fetch-init-withdraw-complex-asset-data.d.ts +5 -0
  21. package/core-kit/hooks/trading/withdraw-v2/init-step/use-get-init-withdraw-transaction-arguments.d.ts +10 -0
  22. package/core-kit/hooks/trading/withdraw-v2/use-withdrawal-vault-address.d.ts +92 -0
  23. package/core-kit/hooks/user/multicall/use-user-multicall.d.ts +92 -0
  24. package/core-kit/hooks/web3/use-static-call-query.d.ts +7 -6
  25. package/core-kit/types/contract.types.d.ts +28 -0
  26. package/core-kit/types/index.d.ts +1 -0
  27. package/core-kit/types/web3.types.d.ts +0 -12
  28. package/core-kit/utils/transaction.d.ts +14 -3
  29. package/core-kit/utils/web3.d.ts +0 -2
  30. package/{index-83b0df05.js → index-5ba43d21.js} +9864 -9704
  31. package/index-addee486.cjs +217 -0
  32. package/index.cjs +1 -1
  33. package/index.d.ts +2 -2
  34. package/index.js +45 -45
  35. package/package.json +1 -1
  36. package/{pyth-adapter-99bcb2fd.cjs → pyth-adapter-557e7325.cjs} +1 -1
  37. package/{pyth-adapter-ae1c3eb3.js → pyth-adapter-ae35e010.js} +1 -1
  38. package/trading-widget/providers/config-provider/config-provider.types.d.ts +1 -0
  39. package/core-kit/hooks/trading/withdraw-v2/init-step/use-init-withdraw-transaction-arguments.d.ts +0 -5
  40. package/index-76ee9693.cjs +0 -217
  41. /package/core-kit/abi/{aave-lending-pool.d.ts → aave/aave-lending-pool.d.ts} +0 -0
@@ -438,6 +438,54 @@ export declare const useWithdrawalVaultAddress: () => import("wagmi").UseReadCon
438
438
  }];
439
439
  readonly stateMutability: "view";
440
440
  readonly type: "function";
441
+ }, {
442
+ readonly inputs: readonly [{
443
+ readonly internalType: "address";
444
+ readonly name: "_dHedgeVault";
445
+ readonly type: "address";
446
+ }, {
447
+ readonly internalType: "uint256";
448
+ readonly name: "_amountIn";
449
+ readonly type: "uint256";
450
+ }, {
451
+ readonly components: readonly [{
452
+ readonly internalType: "address";
453
+ readonly name: "supportedAsset";
454
+ readonly type: "address";
455
+ }, {
456
+ readonly internalType: "bytes";
457
+ readonly name: "withdrawData";
458
+ readonly type: "bytes";
459
+ }, {
460
+ readonly internalType: "uint256";
461
+ readonly name: "slippageTolerance";
462
+ readonly type: "uint256";
463
+ }];
464
+ readonly internalType: "struct IPoolLogic.ComplexAsset[]";
465
+ readonly name: "_complexAssetsData";
466
+ readonly type: "tuple[]";
467
+ }];
468
+ readonly name: "initWithdrawal";
469
+ readonly outputs: readonly [{
470
+ readonly components: readonly [{
471
+ readonly internalType: "address";
472
+ readonly name: "token";
473
+ readonly type: "address";
474
+ }, {
475
+ readonly internalType: "uint256";
476
+ readonly name: "balance";
477
+ readonly type: "uint256";
478
+ }];
479
+ readonly internalType: "struct IWithdrawalVault.TrackedAsset[]";
480
+ readonly name: "trackedAssets";
481
+ readonly type: "tuple[]";
482
+ }, {
483
+ readonly internalType: "address";
484
+ readonly name: "vault";
485
+ readonly type: "address";
486
+ }];
487
+ readonly stateMutability: "nonpayable";
488
+ readonly type: "function";
441
489
  }, {
442
490
  readonly inputs: readonly [{
443
491
  readonly internalType: "address";
@@ -681,6 +729,50 @@ export declare const useWithdrawalVaultAddress: () => import("wagmi").UseReadCon
681
729
  }];
682
730
  readonly stateMutability: "nonpayable";
683
731
  readonly type: "function";
732
+ }, {
733
+ readonly inputs: readonly [{
734
+ readonly internalType: "address";
735
+ readonly name: "_dHedgeVault";
736
+ readonly type: "address";
737
+ }, {
738
+ readonly internalType: "uint256";
739
+ readonly name: "_amountIn";
740
+ readonly type: "uint256";
741
+ }, {
742
+ readonly components: readonly [{
743
+ readonly internalType: "address";
744
+ readonly name: "supportedAsset";
745
+ readonly type: "address";
746
+ }, {
747
+ readonly internalType: "bytes";
748
+ readonly name: "withdrawData";
749
+ readonly type: "bytes";
750
+ }, {
751
+ readonly internalType: "uint256";
752
+ readonly name: "slippageTolerance";
753
+ readonly type: "uint256";
754
+ }];
755
+ readonly internalType: "struct IPoolLogic.ComplexAsset[]";
756
+ readonly name: "_complexAssetsData";
757
+ readonly type: "tuple[]";
758
+ }];
759
+ readonly name: "unrollAndClaim";
760
+ readonly outputs: readonly [{
761
+ readonly components: readonly [{
762
+ readonly internalType: "address";
763
+ readonly name: "token";
764
+ readonly type: "address";
765
+ }, {
766
+ readonly internalType: "uint256";
767
+ readonly name: "balance";
768
+ readonly type: "uint256";
769
+ }];
770
+ readonly internalType: "struct IWithdrawalVault.TrackedAsset[]";
771
+ readonly name: "";
772
+ readonly type: "tuple[]";
773
+ }];
774
+ readonly stateMutability: "nonpayable";
775
+ readonly type: "function";
684
776
  }, {
685
777
  readonly inputs: readonly [];
686
778
  readonly name: "weth";
@@ -503,6 +503,54 @@ export declare const useUserMulticall: ({ address, chainId, }: PoolContractCallP
503
503
  }];
504
504
  readonly stateMutability: "view";
505
505
  readonly type: "function";
506
+ }, {
507
+ readonly inputs: readonly [{
508
+ readonly internalType: "address";
509
+ readonly name: "_dHedgeVault";
510
+ readonly type: "address";
511
+ }, {
512
+ readonly internalType: "uint256";
513
+ readonly name: "_amountIn";
514
+ readonly type: "uint256";
515
+ }, {
516
+ readonly components: readonly [{
517
+ readonly internalType: "address";
518
+ readonly name: "supportedAsset";
519
+ readonly type: "address";
520
+ }, {
521
+ readonly internalType: "bytes";
522
+ readonly name: "withdrawData";
523
+ readonly type: "bytes";
524
+ }, {
525
+ readonly internalType: "uint256";
526
+ readonly name: "slippageTolerance";
527
+ readonly type: "uint256";
528
+ }];
529
+ readonly internalType: "struct IPoolLogic.ComplexAsset[]";
530
+ readonly name: "_complexAssetsData";
531
+ readonly type: "tuple[]";
532
+ }];
533
+ readonly name: "initWithdrawal";
534
+ readonly outputs: readonly [{
535
+ readonly components: readonly [{
536
+ readonly internalType: "address";
537
+ readonly name: "token";
538
+ readonly type: "address";
539
+ }, {
540
+ readonly internalType: "uint256";
541
+ readonly name: "balance";
542
+ readonly type: "uint256";
543
+ }];
544
+ readonly internalType: "struct IWithdrawalVault.TrackedAsset[]";
545
+ readonly name: "trackedAssets";
546
+ readonly type: "tuple[]";
547
+ }, {
548
+ readonly internalType: "address";
549
+ readonly name: "vault";
550
+ readonly type: "address";
551
+ }];
552
+ readonly stateMutability: "nonpayable";
553
+ readonly type: "function";
506
554
  }, {
507
555
  readonly inputs: readonly [{
508
556
  readonly internalType: "address";
@@ -746,6 +794,50 @@ export declare const useUserMulticall: ({ address, chainId, }: PoolContractCallP
746
794
  }];
747
795
  readonly stateMutability: "nonpayable";
748
796
  readonly type: "function";
797
+ }, {
798
+ readonly inputs: readonly [{
799
+ readonly internalType: "address";
800
+ readonly name: "_dHedgeVault";
801
+ readonly type: "address";
802
+ }, {
803
+ readonly internalType: "uint256";
804
+ readonly name: "_amountIn";
805
+ readonly type: "uint256";
806
+ }, {
807
+ readonly components: readonly [{
808
+ readonly internalType: "address";
809
+ readonly name: "supportedAsset";
810
+ readonly type: "address";
811
+ }, {
812
+ readonly internalType: "bytes";
813
+ readonly name: "withdrawData";
814
+ readonly type: "bytes";
815
+ }, {
816
+ readonly internalType: "uint256";
817
+ readonly name: "slippageTolerance";
818
+ readonly type: "uint256";
819
+ }];
820
+ readonly internalType: "struct IPoolLogic.ComplexAsset[]";
821
+ readonly name: "_complexAssetsData";
822
+ readonly type: "tuple[]";
823
+ }];
824
+ readonly name: "unrollAndClaim";
825
+ readonly outputs: readonly [{
826
+ readonly components: readonly [{
827
+ readonly internalType: "address";
828
+ readonly name: "token";
829
+ readonly type: "address";
830
+ }, {
831
+ readonly internalType: "uint256";
832
+ readonly name: "balance";
833
+ readonly type: "uint256";
834
+ }];
835
+ readonly internalType: "struct IWithdrawalVault.TrackedAsset[]";
836
+ readonly name: "";
837
+ readonly type: "tuple[]";
838
+ }];
839
+ readonly stateMutability: "nonpayable";
840
+ readonly type: "function";
749
841
  }, {
750
842
  readonly inputs: readonly [];
751
843
  readonly name: "weth";
@@ -1,12 +1,13 @@
1
1
  import type { UseQueryResult } from '@tanstack/react-query';
2
+ import { usePublicClient } from 'wagmi';
2
3
  import type { UseReadContractParameters } from 'wagmi';
3
- import type { ContractId } from 'core-kit/const';
4
- import type { Address } from 'core-kit/types';
5
- type UseStaticCallVariables = Pick<Required<UseReadContractParameters>, 'chainId' | 'functionName'> & {
6
- contractId: ContractId;
4
+ type UseStaticCallVariables = Pick<Required<UseReadContractParameters>, 'functionName' | 'abi' | 'address' | 'chainId'> & {
7
5
  disabled?: boolean;
8
6
  args: unknown[];
9
- dynamicContractAddress?: Address;
7
+ refetchInterval?: number;
10
8
  };
11
- export declare const useStaticCallQuery: <T>({ disabled, functionName, dynamicContractAddress, contractId, args, chainId, }: UseStaticCallVariables) => UseQueryResult<T>;
9
+ export declare const makeStaticCall: <T>({ functionName, address, abi, args, publicClient, }: Omit<UseStaticCallVariables, "chainId" | "refetchInterval" | "disabled"> & {
10
+ publicClient: ReturnType<typeof usePublicClient>;
11
+ }) => Promise<T | undefined>;
12
+ export declare const useStaticCallQuery: <T>({ disabled, functionName, address, abi, args, chainId, refetchInterval, }: UseStaticCallVariables) => UseQueryResult<T>;
12
13
  export {};
@@ -0,0 +1,28 @@
1
+ import type { Address } from 'viem';
2
+ export interface DynamicPoolContractData {
3
+ userBalance: string | undefined;
4
+ tokenPrice: string | undefined;
5
+ getExitRemainingCooldown: string | undefined;
6
+ totalValue: string | undefined;
7
+ totalSupply: string | undefined;
8
+ isPrivateVault: boolean | undefined;
9
+ performanceFee: string | undefined;
10
+ streamingFee: string | undefined;
11
+ entryFee: string | undefined;
12
+ exitFee: string | undefined;
13
+ managerAddress: string | undefined;
14
+ }
15
+ type AssetStructure = {
16
+ asset: Address;
17
+ amount: bigint;
18
+ };
19
+ export interface CalculateSwapDataParamsResponse {
20
+ srcData: AssetStructure[];
21
+ dstData: AssetStructure;
22
+ }
23
+ export interface ComplexWithdrawAssetData {
24
+ supportedAsset: Address;
25
+ withdrawData: string;
26
+ slippageTolerance: bigint;
27
+ }
28
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from './config.types';
2
+ export * from './contract.types';
2
3
  export * from './pool.types';
3
4
  export * from './referral.types';
4
5
  export * from './state.types';
@@ -32,15 +32,3 @@ export interface PoolContractCallParams {
32
32
  export interface PoolContractAccountCallParams extends PoolContractCallParams {
33
33
  account: Address;
34
34
  }
35
- export interface DynamicPoolContractData {
36
- userBalance: string | undefined;
37
- tokenPrice: string | undefined;
38
- totalValue: string | undefined;
39
- totalSupply: string | undefined;
40
- isPrivateVault: boolean | undefined;
41
- performanceFee: string | undefined;
42
- streamingFee: string | undefined;
43
- entryFee: string | undefined;
44
- exitFee: string | undefined;
45
- managerAddress: string | undefined;
46
- }
@@ -1,6 +1,7 @@
1
1
  import type { Address } from 'viem';
2
- import type { useCompleteWithdrawSwapData } from 'core-kit/hooks/trading/withdraw-v2/complete-step/use-complete-withdraw-swap-data';
2
+ import type { useSwapsDataQuery } from 'core-kit/hooks/trading/use-swaps-data-query';
3
3
  import type { useCompleteWithdrawTrackedAssets } from 'core-kit/hooks/trading/withdraw-v2/complete-step/use-complete-withdraw-tracked-assets';
4
+ import type { CalculateSwapDataParamsResponse } from 'core-kit/types';
4
5
  /**
5
6
  * Calculates the slippage tolerance for withdrawSafe.
6
7
  * Returns an integer number from 0 to 10000,
@@ -8,7 +9,7 @@ import type { useCompleteWithdrawTrackedAssets } from 'core-kit/hooks/trading/wi
8
9
  * @param {string} slippage - The slippage value in % from 0 to 100.
9
10
  * @returns {string} - The slippage tolerance.
10
11
  */
11
- export declare const getSlippageToleranceForWithdrawSafe: (slippage: number) => string;
12
+ export declare const getSlippageToleranceForContractTransaction: (slippage: number) => bigint;
12
13
  export declare const buildZapDepositTransactionArguments: ({ vaultAddress, swapData, sendTokenAddress, sendTokenAmount, vaultDepositTokenAddress, minVaultTokensReceivedAmount, routerKey, swapDestinationAmount, swapSlippage, }: {
13
14
  vaultAddress: Address;
14
15
  swapData: string;
@@ -24,5 +25,15 @@ export declare const buildSwapWithdrawTransactionData: ({ receiveAssetAddress, s
24
25
  receiveAssetAddress: Address;
25
26
  slippage: number;
26
27
  assets: ReturnType<typeof useCompleteWithdrawTrackedAssets>['data'];
27
- swapData: ReturnType<typeof useCompleteWithdrawSwapData>['data'];
28
+ swapData: ReturnType<typeof useSwapsDataQuery>['data'];
28
29
  }) => unknown[][];
30
+ export declare const buildAaveWithdrawAssetTransactionData: ({ assetAddress, swapData, swapParams, slippageToleranceForContractTransaction, }: {
31
+ assetAddress: Address;
32
+ swapParams: CalculateSwapDataParamsResponse | undefined;
33
+ swapData: ReturnType<typeof useSwapsDataQuery>['data'];
34
+ slippageToleranceForContractTransaction: bigint;
35
+ }) => {
36
+ supportedAsset: `0x${string}`;
37
+ withdrawData: string;
38
+ slippageTolerance: bigint;
39
+ };
@@ -1,4 +1,3 @@
1
- import type { Chain } from 'wagmi/chains';
2
1
  import type { ContractId } from 'core-kit/const';
3
2
  import type { Address, ChainId } from 'core-kit/types/web3.types';
4
3
  export { formatUnits, formatEther, encodeFunctionData, decodeErrorResult, hexToString, trim, } from 'viem';
@@ -6,6 +5,5 @@ export declare const getContractAddressById: (contractId: ContractId, chainId: C
6
5
  export declare const getContractAbiById: (contractId: ContractId) => any;
7
6
  export declare const isZeroAddress: (address: string | undefined) => boolean;
8
7
  export declare const shortenAddress: (address: string) => string;
9
- export declare const getChainData: (chainId: number) => Chain | undefined;
10
8
  export declare const commify: (value: string) => string;
11
9
  export declare const isEqualAddress: (a: string | undefined, b: string | undefined) => boolean;