@gmx-io/sdk 1.2.0 → 1.2.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 (88) hide show
  1. package/build/cjs/src/abis/ClaimHandler.json +439 -0
  2. package/build/cjs/src/abis/index.js +4 -0
  3. package/build/cjs/src/configs/__tests__/markets.spec.js +1 -1
  4. package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
  5. package/build/cjs/src/configs/batch.js +12 -0
  6. package/build/cjs/src/configs/contracts.js +2 -0
  7. package/build/cjs/src/configs/dataStore.js +13 -3
  8. package/build/cjs/src/configs/express.js +2 -1
  9. package/build/cjs/src/configs/markets.js +35 -0
  10. package/build/cjs/src/configs/oracleKeeper.js +19 -35
  11. package/build/cjs/src/configs/tokens.js +55 -0
  12. package/build/cjs/src/index.js +3 -3
  13. package/build/cjs/src/modules/orders/helpers.js +9 -0
  14. package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
  15. package/build/cjs/src/modules/orders/orders.js +3 -3
  16. package/build/cjs/src/modules/utils/utils.js +3 -3
  17. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +40 -0
  18. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +255 -0
  19. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +75 -0
  20. package/build/cjs/src/types/subsquid.js +91 -1
  21. package/build/cjs/src/types/swapStrategy.js +2 -0
  22. package/build/cjs/src/types/trade.js +1 -0
  23. package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -0
  24. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  25. package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +10 -0
  26. package/build/cjs/src/utils/errors/transactionsErrors.js +7 -1
  27. package/build/cjs/src/utils/orderTransactions.js +0 -1
  28. package/build/cjs/src/utils/swap/botanixStaking.js +90 -0
  29. package/build/cjs/src/utils/swap/buildSwapStrategy.js +224 -0
  30. package/build/cjs/src/utils/swap/externalSwapPath.js +41 -0
  31. package/build/cjs/src/utils/swap/externalSwapQuoteByPath.js +27 -0
  32. package/build/cjs/src/utils/swap/swapValues.js +250 -11
  33. package/build/cjs/src/utils/trade/amounts.js +89 -41
  34. package/build/cjs/src/utils/trade/trade.js +2 -2
  35. package/build/cjs/src/utils/twap/uiFeeReceiver.js +9 -9
  36. package/build/esm/src/abis/ClaimHandler.json +439 -0
  37. package/build/esm/src/abis/index.js +4 -0
  38. package/build/esm/src/configs/__tests__/markets.spec.js +1 -1
  39. package/build/esm/src/configs/__tests__/tokens.spec.js +1 -1
  40. package/build/esm/src/configs/batch.js +13 -1
  41. package/build/esm/src/configs/contracts.js +2 -0
  42. package/build/esm/src/configs/dataStore.js +8 -0
  43. package/build/esm/src/configs/express.js +1 -0
  44. package/build/esm/src/configs/markets.js +35 -0
  45. package/build/esm/src/configs/oracleKeeper.js +17 -29
  46. package/build/esm/src/configs/tokens.js +55 -0
  47. package/build/esm/src/index.js +3 -3
  48. package/build/esm/src/modules/orders/helpers.js +9 -0
  49. package/build/esm/src/modules/orders/helpers.spec.js +1 -1
  50. package/build/esm/src/modules/orders/orders.js +3 -3
  51. package/build/esm/src/modules/utils/utils.js +3 -3
  52. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +40 -0
  53. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +255 -0
  54. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +75 -0
  55. package/build/esm/src/types/subsquid.js +90 -0
  56. package/build/esm/src/types/swapStrategy.js +1 -0
  57. package/build/esm/src/types/trade.js +1 -0
  58. package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -0
  59. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  60. package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +11 -1
  61. package/build/esm/src/utils/errors/transactionsErrors.js +7 -1
  62. package/build/esm/src/utils/orderTransactions.js +0 -1
  63. package/build/esm/src/utils/swap/botanixStaking.js +83 -0
  64. package/build/esm/src/utils/swap/buildSwapStrategy.js +219 -0
  65. package/build/esm/src/utils/swap/externalSwapPath.js +37 -0
  66. package/build/esm/src/utils/swap/externalSwapQuoteByPath.js +23 -0
  67. package/build/esm/src/utils/swap/swapValues.js +248 -9
  68. package/build/esm/src/utils/trade/amounts.js +89 -41
  69. package/build/esm/src/utils/trade/trade.js +2 -2
  70. package/build/esm/src/utils/twap/uiFeeReceiver.js +9 -9
  71. package/build/types/src/abis/index.d.ts +1 -1
  72. package/build/types/src/configs/batch.d.ts +2 -1
  73. package/build/types/src/configs/contracts.d.ts +2 -0
  74. package/build/types/src/configs/dataStore.d.ts +4 -0
  75. package/build/types/src/configs/express.d.ts +1 -0
  76. package/build/types/src/configs/oracleKeeper.d.ts +2 -3
  77. package/build/types/src/types/subsquid.d.ts +303 -0
  78. package/build/types/src/types/swapStrategy.d.ts +33 -0
  79. package/build/types/src/types/tokens.d.ts +5 -0
  80. package/build/types/src/types/trade.d.ts +18 -4
  81. package/build/types/src/utils/swap/botanixStaking.d.ts +11 -0
  82. package/build/types/src/utils/swap/buildSwapStrategy.d.ts +22 -0
  83. package/build/types/src/utils/swap/externalSwapPath.d.ts +13 -0
  84. package/build/types/src/utils/swap/externalSwapQuoteByPath.d.ts +6 -0
  85. package/build/types/src/utils/swap/swapValues.d.ts +10 -3
  86. package/build/types/src/utils/trade/amounts.d.ts +5 -2
  87. package/build/types/src/utils/twap/uiFeeReceiver.d.ts +7 -7
  88. package/package.json +1 -1
@@ -348,6 +348,14 @@ export interface AccountStatsConnection {
348
348
  pageInfo: PageInfo;
349
349
  totalCount: Scalars['Int']['output'];
350
350
  }
351
+ export interface AnnualizedPerformanceObject {
352
+ __typename?: 'AnnualizedPerformanceObject';
353
+ address: Scalars['String']['output'];
354
+ entity: Scalars['String']['output'];
355
+ longTokenPerformance: Scalars['BigInt']['output'];
356
+ shortTokenPerformance: Scalars['BigInt']['output'];
357
+ uniswapV2Performance: Scalars['BigInt']['output'];
358
+ }
351
359
  export interface AprSnapshot {
352
360
  __typename?: 'AprSnapshot';
353
361
  address: Scalars['String']['output'];
@@ -1516,6 +1524,150 @@ export interface CumulativePoolValuesConnection {
1516
1524
  pageInfo: PageInfo;
1517
1525
  totalCount: Scalars['Int']['output'];
1518
1526
  }
1527
+ export interface Distribution {
1528
+ __typename?: 'Distribution';
1529
+ amounts: Array<Scalars['String']['output']>;
1530
+ amountsInUsd: Array<Scalars['String']['output']>;
1531
+ id: Scalars['String']['output'];
1532
+ receiver: Scalars['String']['output'];
1533
+ tokens: Array<Scalars['String']['output']>;
1534
+ transaction: Transaction;
1535
+ typeId: Scalars['BigInt']['output'];
1536
+ }
1537
+ export interface DistributionEdge {
1538
+ __typename?: 'DistributionEdge';
1539
+ cursor: Scalars['String']['output'];
1540
+ node: Distribution;
1541
+ }
1542
+ export declare enum DistributionOrderByInput {
1543
+ id_ASC = "id_ASC",
1544
+ id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST",
1545
+ id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST",
1546
+ id_DESC = "id_DESC",
1547
+ id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST",
1548
+ id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST",
1549
+ receiver_ASC = "receiver_ASC",
1550
+ receiver_ASC_NULLS_FIRST = "receiver_ASC_NULLS_FIRST",
1551
+ receiver_ASC_NULLS_LAST = "receiver_ASC_NULLS_LAST",
1552
+ receiver_DESC = "receiver_DESC",
1553
+ receiver_DESC_NULLS_FIRST = "receiver_DESC_NULLS_FIRST",
1554
+ receiver_DESC_NULLS_LAST = "receiver_DESC_NULLS_LAST",
1555
+ transaction_blockNumber_ASC = "transaction_blockNumber_ASC",
1556
+ transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST",
1557
+ transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST",
1558
+ transaction_blockNumber_DESC = "transaction_blockNumber_DESC",
1559
+ transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST",
1560
+ transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST",
1561
+ transaction_from_ASC = "transaction_from_ASC",
1562
+ transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST",
1563
+ transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST",
1564
+ transaction_from_DESC = "transaction_from_DESC",
1565
+ transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST",
1566
+ transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST",
1567
+ transaction_hash_ASC = "transaction_hash_ASC",
1568
+ transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST",
1569
+ transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST",
1570
+ transaction_hash_DESC = "transaction_hash_DESC",
1571
+ transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST",
1572
+ transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST",
1573
+ transaction_id_ASC = "transaction_id_ASC",
1574
+ transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST",
1575
+ transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST",
1576
+ transaction_id_DESC = "transaction_id_DESC",
1577
+ transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST",
1578
+ transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST",
1579
+ transaction_timestamp_ASC = "transaction_timestamp_ASC",
1580
+ transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST",
1581
+ transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST",
1582
+ transaction_timestamp_DESC = "transaction_timestamp_DESC",
1583
+ transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST",
1584
+ transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST",
1585
+ transaction_to_ASC = "transaction_to_ASC",
1586
+ transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST",
1587
+ transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST",
1588
+ transaction_to_DESC = "transaction_to_DESC",
1589
+ transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST",
1590
+ transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST",
1591
+ transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC",
1592
+ transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST",
1593
+ transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST",
1594
+ transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC",
1595
+ transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST",
1596
+ transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST",
1597
+ typeId_ASC = "typeId_ASC",
1598
+ typeId_ASC_NULLS_FIRST = "typeId_ASC_NULLS_FIRST",
1599
+ typeId_ASC_NULLS_LAST = "typeId_ASC_NULLS_LAST",
1600
+ typeId_DESC = "typeId_DESC",
1601
+ typeId_DESC_NULLS_FIRST = "typeId_DESC_NULLS_FIRST",
1602
+ typeId_DESC_NULLS_LAST = "typeId_DESC_NULLS_LAST"
1603
+ }
1604
+ export interface DistributionWhereInput {
1605
+ AND?: InputMaybe<Array<DistributionWhereInput>>;
1606
+ OR?: InputMaybe<Array<DistributionWhereInput>>;
1607
+ amountsInUsd_containsAll?: InputMaybe<Array<Scalars['String']['input']>>;
1608
+ amountsInUsd_containsAny?: InputMaybe<Array<Scalars['String']['input']>>;
1609
+ amountsInUsd_containsNone?: InputMaybe<Array<Scalars['String']['input']>>;
1610
+ amountsInUsd_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1611
+ amounts_containsAll?: InputMaybe<Array<Scalars['String']['input']>>;
1612
+ amounts_containsAny?: InputMaybe<Array<Scalars['String']['input']>>;
1613
+ amounts_containsNone?: InputMaybe<Array<Scalars['String']['input']>>;
1614
+ amounts_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1615
+ id_contains?: InputMaybe<Scalars['String']['input']>;
1616
+ id_containsInsensitive?: InputMaybe<Scalars['String']['input']>;
1617
+ id_endsWith?: InputMaybe<Scalars['String']['input']>;
1618
+ id_eq?: InputMaybe<Scalars['String']['input']>;
1619
+ id_gt?: InputMaybe<Scalars['String']['input']>;
1620
+ id_gte?: InputMaybe<Scalars['String']['input']>;
1621
+ id_in?: InputMaybe<Array<Scalars['String']['input']>>;
1622
+ id_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1623
+ id_lt?: InputMaybe<Scalars['String']['input']>;
1624
+ id_lte?: InputMaybe<Scalars['String']['input']>;
1625
+ id_not_contains?: InputMaybe<Scalars['String']['input']>;
1626
+ id_not_containsInsensitive?: InputMaybe<Scalars['String']['input']>;
1627
+ id_not_endsWith?: InputMaybe<Scalars['String']['input']>;
1628
+ id_not_eq?: InputMaybe<Scalars['String']['input']>;
1629
+ id_not_in?: InputMaybe<Array<Scalars['String']['input']>>;
1630
+ id_not_startsWith?: InputMaybe<Scalars['String']['input']>;
1631
+ id_startsWith?: InputMaybe<Scalars['String']['input']>;
1632
+ receiver_contains?: InputMaybe<Scalars['String']['input']>;
1633
+ receiver_containsInsensitive?: InputMaybe<Scalars['String']['input']>;
1634
+ receiver_endsWith?: InputMaybe<Scalars['String']['input']>;
1635
+ receiver_eq?: InputMaybe<Scalars['String']['input']>;
1636
+ receiver_gt?: InputMaybe<Scalars['String']['input']>;
1637
+ receiver_gte?: InputMaybe<Scalars['String']['input']>;
1638
+ receiver_in?: InputMaybe<Array<Scalars['String']['input']>>;
1639
+ receiver_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1640
+ receiver_lt?: InputMaybe<Scalars['String']['input']>;
1641
+ receiver_lte?: InputMaybe<Scalars['String']['input']>;
1642
+ receiver_not_contains?: InputMaybe<Scalars['String']['input']>;
1643
+ receiver_not_containsInsensitive?: InputMaybe<Scalars['String']['input']>;
1644
+ receiver_not_endsWith?: InputMaybe<Scalars['String']['input']>;
1645
+ receiver_not_eq?: InputMaybe<Scalars['String']['input']>;
1646
+ receiver_not_in?: InputMaybe<Array<Scalars['String']['input']>>;
1647
+ receiver_not_startsWith?: InputMaybe<Scalars['String']['input']>;
1648
+ receiver_startsWith?: InputMaybe<Scalars['String']['input']>;
1649
+ tokens_containsAll?: InputMaybe<Array<Scalars['String']['input']>>;
1650
+ tokens_containsAny?: InputMaybe<Array<Scalars['String']['input']>>;
1651
+ tokens_containsNone?: InputMaybe<Array<Scalars['String']['input']>>;
1652
+ tokens_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1653
+ transaction?: InputMaybe<TransactionWhereInput>;
1654
+ transaction_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1655
+ typeId_eq?: InputMaybe<Scalars['BigInt']['input']>;
1656
+ typeId_gt?: InputMaybe<Scalars['BigInt']['input']>;
1657
+ typeId_gte?: InputMaybe<Scalars['BigInt']['input']>;
1658
+ typeId_in?: InputMaybe<Array<Scalars['BigInt']['input']>>;
1659
+ typeId_isNull?: InputMaybe<Scalars['Boolean']['input']>;
1660
+ typeId_lt?: InputMaybe<Scalars['BigInt']['input']>;
1661
+ typeId_lte?: InputMaybe<Scalars['BigInt']['input']>;
1662
+ typeId_not_eq?: InputMaybe<Scalars['BigInt']['input']>;
1663
+ typeId_not_in?: InputMaybe<Array<Scalars['BigInt']['input']>>;
1664
+ }
1665
+ export interface DistributionsConnection {
1666
+ __typename?: 'DistributionsConnection';
1667
+ edges: Array<DistributionEdge>;
1668
+ pageInfo: PageInfo;
1669
+ totalCount: Scalars['Int']['output'];
1670
+ }
1519
1671
  export declare enum EntityType {
1520
1672
  Glv = "Glv",
1521
1673
  Market = "Market"
@@ -4097,6 +4249,21 @@ export interface PageInfo {
4097
4249
  hasPreviousPage: Scalars['Boolean']['output'];
4098
4250
  startCursor: Scalars['String']['output'];
4099
4251
  }
4252
+ export interface PerformanceSnapshotObject {
4253
+ __typename?: 'PerformanceSnapshotObject';
4254
+ snapshotTimestamp: Scalars['String']['output'];
4255
+ uniswapV2Performance: Scalars['String']['output'];
4256
+ }
4257
+ export interface PerformanceSnapshots {
4258
+ __typename?: 'PerformanceSnapshots';
4259
+ address: Scalars['String']['output'];
4260
+ entity: Scalars['String']['output'];
4261
+ snapshots: Array<PerformanceSnapshotObject>;
4262
+ }
4263
+ export interface PerformanceWhereInput {
4264
+ addresses?: InputMaybe<Array<Scalars['String']['input']>>;
4265
+ period: Scalars['String']['input'];
4266
+ }
4100
4267
  export interface PeriodAccountStatObject {
4101
4268
  __typename?: 'PeriodAccountStatObject';
4102
4269
  closedCount: Scalars['Float']['output'];
@@ -5658,6 +5825,98 @@ export interface PricesConnection {
5658
5825
  pageInfo: PageInfo;
5659
5826
  totalCount: Scalars['Int']['output'];
5660
5827
  }
5828
+ export interface ProcessorStatus {
5829
+ __typename?: 'ProcessorStatus';
5830
+ id: Scalars['String']['output'];
5831
+ lastParsedBlockNumber: Scalars['Int']['output'];
5832
+ lastParsedBlockTimestamp: Scalars['Int']['output'];
5833
+ lastProcessorCallTimestamp: Scalars['Int']['output'];
5834
+ }
5835
+ export interface ProcessorStatusEdge {
5836
+ __typename?: 'ProcessorStatusEdge';
5837
+ cursor: Scalars['String']['output'];
5838
+ node: ProcessorStatus;
5839
+ }
5840
+ export declare enum ProcessorStatusOrderByInput {
5841
+ id_ASC = "id_ASC",
5842
+ id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST",
5843
+ id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST",
5844
+ id_DESC = "id_DESC",
5845
+ id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST",
5846
+ id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST",
5847
+ lastParsedBlockNumber_ASC = "lastParsedBlockNumber_ASC",
5848
+ lastParsedBlockNumber_ASC_NULLS_FIRST = "lastParsedBlockNumber_ASC_NULLS_FIRST",
5849
+ lastParsedBlockNumber_ASC_NULLS_LAST = "lastParsedBlockNumber_ASC_NULLS_LAST",
5850
+ lastParsedBlockNumber_DESC = "lastParsedBlockNumber_DESC",
5851
+ lastParsedBlockNumber_DESC_NULLS_FIRST = "lastParsedBlockNumber_DESC_NULLS_FIRST",
5852
+ lastParsedBlockNumber_DESC_NULLS_LAST = "lastParsedBlockNumber_DESC_NULLS_LAST",
5853
+ lastParsedBlockTimestamp_ASC = "lastParsedBlockTimestamp_ASC",
5854
+ lastParsedBlockTimestamp_ASC_NULLS_FIRST = "lastParsedBlockTimestamp_ASC_NULLS_FIRST",
5855
+ lastParsedBlockTimestamp_ASC_NULLS_LAST = "lastParsedBlockTimestamp_ASC_NULLS_LAST",
5856
+ lastParsedBlockTimestamp_DESC = "lastParsedBlockTimestamp_DESC",
5857
+ lastParsedBlockTimestamp_DESC_NULLS_FIRST = "lastParsedBlockTimestamp_DESC_NULLS_FIRST",
5858
+ lastParsedBlockTimestamp_DESC_NULLS_LAST = "lastParsedBlockTimestamp_DESC_NULLS_LAST",
5859
+ lastProcessorCallTimestamp_ASC = "lastProcessorCallTimestamp_ASC",
5860
+ lastProcessorCallTimestamp_ASC_NULLS_FIRST = "lastProcessorCallTimestamp_ASC_NULLS_FIRST",
5861
+ lastProcessorCallTimestamp_ASC_NULLS_LAST = "lastProcessorCallTimestamp_ASC_NULLS_LAST",
5862
+ lastProcessorCallTimestamp_DESC = "lastProcessorCallTimestamp_DESC",
5863
+ lastProcessorCallTimestamp_DESC_NULLS_FIRST = "lastProcessorCallTimestamp_DESC_NULLS_FIRST",
5864
+ lastProcessorCallTimestamp_DESC_NULLS_LAST = "lastProcessorCallTimestamp_DESC_NULLS_LAST"
5865
+ }
5866
+ export interface ProcessorStatusWhereInput {
5867
+ AND?: InputMaybe<Array<ProcessorStatusWhereInput>>;
5868
+ OR?: InputMaybe<Array<ProcessorStatusWhereInput>>;
5869
+ id_contains?: InputMaybe<Scalars['String']['input']>;
5870
+ id_containsInsensitive?: InputMaybe<Scalars['String']['input']>;
5871
+ id_endsWith?: InputMaybe<Scalars['String']['input']>;
5872
+ id_eq?: InputMaybe<Scalars['String']['input']>;
5873
+ id_gt?: InputMaybe<Scalars['String']['input']>;
5874
+ id_gte?: InputMaybe<Scalars['String']['input']>;
5875
+ id_in?: InputMaybe<Array<Scalars['String']['input']>>;
5876
+ id_isNull?: InputMaybe<Scalars['Boolean']['input']>;
5877
+ id_lt?: InputMaybe<Scalars['String']['input']>;
5878
+ id_lte?: InputMaybe<Scalars['String']['input']>;
5879
+ id_not_contains?: InputMaybe<Scalars['String']['input']>;
5880
+ id_not_containsInsensitive?: InputMaybe<Scalars['String']['input']>;
5881
+ id_not_endsWith?: InputMaybe<Scalars['String']['input']>;
5882
+ id_not_eq?: InputMaybe<Scalars['String']['input']>;
5883
+ id_not_in?: InputMaybe<Array<Scalars['String']['input']>>;
5884
+ id_not_startsWith?: InputMaybe<Scalars['String']['input']>;
5885
+ id_startsWith?: InputMaybe<Scalars['String']['input']>;
5886
+ lastParsedBlockNumber_eq?: InputMaybe<Scalars['Int']['input']>;
5887
+ lastParsedBlockNumber_gt?: InputMaybe<Scalars['Int']['input']>;
5888
+ lastParsedBlockNumber_gte?: InputMaybe<Scalars['Int']['input']>;
5889
+ lastParsedBlockNumber_in?: InputMaybe<Array<Scalars['Int']['input']>>;
5890
+ lastParsedBlockNumber_isNull?: InputMaybe<Scalars['Boolean']['input']>;
5891
+ lastParsedBlockNumber_lt?: InputMaybe<Scalars['Int']['input']>;
5892
+ lastParsedBlockNumber_lte?: InputMaybe<Scalars['Int']['input']>;
5893
+ lastParsedBlockNumber_not_eq?: InputMaybe<Scalars['Int']['input']>;
5894
+ lastParsedBlockNumber_not_in?: InputMaybe<Array<Scalars['Int']['input']>>;
5895
+ lastParsedBlockTimestamp_eq?: InputMaybe<Scalars['Int']['input']>;
5896
+ lastParsedBlockTimestamp_gt?: InputMaybe<Scalars['Int']['input']>;
5897
+ lastParsedBlockTimestamp_gte?: InputMaybe<Scalars['Int']['input']>;
5898
+ lastParsedBlockTimestamp_in?: InputMaybe<Array<Scalars['Int']['input']>>;
5899
+ lastParsedBlockTimestamp_isNull?: InputMaybe<Scalars['Boolean']['input']>;
5900
+ lastParsedBlockTimestamp_lt?: InputMaybe<Scalars['Int']['input']>;
5901
+ lastParsedBlockTimestamp_lte?: InputMaybe<Scalars['Int']['input']>;
5902
+ lastParsedBlockTimestamp_not_eq?: InputMaybe<Scalars['Int']['input']>;
5903
+ lastParsedBlockTimestamp_not_in?: InputMaybe<Array<Scalars['Int']['input']>>;
5904
+ lastProcessorCallTimestamp_eq?: InputMaybe<Scalars['Int']['input']>;
5905
+ lastProcessorCallTimestamp_gt?: InputMaybe<Scalars['Int']['input']>;
5906
+ lastProcessorCallTimestamp_gte?: InputMaybe<Scalars['Int']['input']>;
5907
+ lastProcessorCallTimestamp_in?: InputMaybe<Array<Scalars['Int']['input']>>;
5908
+ lastProcessorCallTimestamp_isNull?: InputMaybe<Scalars['Boolean']['input']>;
5909
+ lastProcessorCallTimestamp_lt?: InputMaybe<Scalars['Int']['input']>;
5910
+ lastProcessorCallTimestamp_lte?: InputMaybe<Scalars['Int']['input']>;
5911
+ lastProcessorCallTimestamp_not_eq?: InputMaybe<Scalars['Int']['input']>;
5912
+ lastProcessorCallTimestamp_not_in?: InputMaybe<Array<Scalars['Int']['input']>>;
5913
+ }
5914
+ export interface ProcessorStatusesConnection {
5915
+ __typename?: 'ProcessorStatusesConnection';
5916
+ edges: Array<ProcessorStatusEdge>;
5917
+ pageInfo: PageInfo;
5918
+ totalCount: Scalars['Int']['output'];
5919
+ }
5661
5920
  export interface Query {
5662
5921
  __typename?: 'Query';
5663
5922
  accountPnlHistoryStats: Array<AccountPnlHistoryPointObject>;
@@ -5665,6 +5924,7 @@ export interface Query {
5665
5924
  accountStatById?: Maybe<AccountStat>;
5666
5925
  accountStats: Array<AccountStat>;
5667
5926
  accountStatsConnection: AccountStatsConnection;
5927
+ annualizedPerformance: Array<AnnualizedPerformanceObject>;
5668
5928
  aprSnapshotById?: Maybe<AprSnapshot>;
5669
5929
  aprSnapshots: Array<AprSnapshot>;
5670
5930
  aprSnapshotsConnection: AprSnapshotsConnection;
@@ -5689,6 +5949,9 @@ export interface Query {
5689
5949
  cumulativePoolValueById?: Maybe<CumulativePoolValue>;
5690
5950
  cumulativePoolValues: Array<CumulativePoolValue>;
5691
5951
  cumulativePoolValuesConnection: CumulativePoolValuesConnection;
5952
+ distributionById?: Maybe<Distribution>;
5953
+ distributions: Array<Distribution>;
5954
+ distributionsConnection: DistributionsConnection;
5692
5955
  glvById?: Maybe<Glv>;
5693
5956
  glvs: Array<Glv>;
5694
5957
  glvsAprByPeriod: Array<GlvApr>;
@@ -5708,6 +5971,7 @@ export interface Query {
5708
5971
  orderById?: Maybe<Order>;
5709
5972
  orders: Array<Order>;
5710
5973
  ordersConnection: OrdersConnection;
5974
+ performanceSnapshots: Array<PerformanceSnapshots>;
5711
5975
  periodAccountStats: Array<PeriodAccountStatObject>;
5712
5976
  pnlAprSnapshotById?: Maybe<PnlAprSnapshot>;
5713
5977
  pnlAprSnapshots: Array<PnlAprSnapshot>;
@@ -5727,6 +5991,9 @@ export interface Query {
5727
5991
  priceById?: Maybe<Price>;
5728
5992
  prices: Array<Price>;
5729
5993
  pricesConnection: PricesConnection;
5994
+ processorStatusById?: Maybe<ProcessorStatus>;
5995
+ processorStatuses: Array<ProcessorStatus>;
5996
+ processorStatusesConnection: ProcessorStatusesConnection;
5730
5997
  squidStatus?: Maybe<SquidStatus>;
5731
5998
  swapInfoById?: Maybe<SwapInfo>;
5732
5999
  swapInfos: Array<SwapInfo>;
@@ -5761,6 +6028,9 @@ export interface QueryaccountStatsConnectionArgs {
5761
6028
  orderBy: Array<AccountStatOrderByInput>;
5762
6029
  where?: InputMaybe<AccountStatWhereInput>;
5763
6030
  }
6031
+ export interface QueryannualizedPerformanceArgs {
6032
+ where?: InputMaybe<PerformanceWhereInput>;
6033
+ }
5764
6034
  export interface QueryaprSnapshotByIdArgs {
5765
6035
  id: Scalars['String']['input'];
5766
6036
  }
@@ -5881,6 +6151,21 @@ export interface QuerycumulativePoolValuesConnectionArgs {
5881
6151
  orderBy: Array<CumulativePoolValueOrderByInput>;
5882
6152
  where?: InputMaybe<CumulativePoolValueWhereInput>;
5883
6153
  }
6154
+ export interface QuerydistributionByIdArgs {
6155
+ id: Scalars['String']['input'];
6156
+ }
6157
+ export interface QuerydistributionsArgs {
6158
+ limit?: InputMaybe<Scalars['Int']['input']>;
6159
+ offset?: InputMaybe<Scalars['Int']['input']>;
6160
+ orderBy?: InputMaybe<Array<DistributionOrderByInput>>;
6161
+ where?: InputMaybe<DistributionWhereInput>;
6162
+ }
6163
+ export interface QuerydistributionsConnectionArgs {
6164
+ after?: InputMaybe<Scalars['String']['input']>;
6165
+ first?: InputMaybe<Scalars['Int']['input']>;
6166
+ orderBy: Array<DistributionOrderByInput>;
6167
+ where?: InputMaybe<DistributionWhereInput>;
6168
+ }
5884
6169
  export interface QueryglvByIdArgs {
5885
6170
  id: Scalars['String']['input'];
5886
6171
  }
@@ -5968,6 +6253,9 @@ export interface QueryordersConnectionArgs {
5968
6253
  orderBy: Array<OrderOrderByInput>;
5969
6254
  where?: InputMaybe<OrderWhereInput>;
5970
6255
  }
6256
+ export interface QueryperformanceSnapshotsArgs {
6257
+ where?: InputMaybe<PerformanceWhereInput>;
6258
+ }
5971
6259
  export interface QueryperiodAccountStatsArgs {
5972
6260
  limit?: InputMaybe<Scalars['Float']['input']>;
5973
6261
  offset?: InputMaybe<Scalars['Float']['input']>;
@@ -6057,6 +6345,21 @@ export interface QuerypricesConnectionArgs {
6057
6345
  orderBy: Array<PriceOrderByInput>;
6058
6346
  where?: InputMaybe<PriceWhereInput>;
6059
6347
  }
6348
+ export interface QueryprocessorStatusByIdArgs {
6349
+ id: Scalars['String']['input'];
6350
+ }
6351
+ export interface QueryprocessorStatusesArgs {
6352
+ limit?: InputMaybe<Scalars['Int']['input']>;
6353
+ offset?: InputMaybe<Scalars['Int']['input']>;
6354
+ orderBy?: InputMaybe<Array<ProcessorStatusOrderByInput>>;
6355
+ where?: InputMaybe<ProcessorStatusWhereInput>;
6356
+ }
6357
+ export interface QueryprocessorStatusesConnectionArgs {
6358
+ after?: InputMaybe<Scalars['String']['input']>;
6359
+ first?: InputMaybe<Scalars['Int']['input']>;
6360
+ orderBy: Array<ProcessorStatusOrderByInput>;
6361
+ where?: InputMaybe<ProcessorStatusWhereInput>;
6362
+ }
6060
6363
  export interface QueryswapInfoByIdArgs {
6061
6364
  id: Scalars['String']['input'];
6062
6365
  }
@@ -0,0 +1,33 @@
1
+ import { ExternalSwapQuote, SwapPathStats } from "./trade";
2
+ type BaseSwapStrategy = {
3
+ amountIn: bigint;
4
+ amountOut: bigint;
5
+ usdIn: bigint;
6
+ usdOut: bigint;
7
+ priceIn: bigint;
8
+ priceOut: bigint;
9
+ feesUsd: bigint;
10
+ };
11
+ export type NoSwapStrategy = BaseSwapStrategy & {
12
+ type: "noSwap";
13
+ externalSwapQuote: undefined;
14
+ swapPathStats: undefined;
15
+ };
16
+ export type ExternalSwapStrategy = BaseSwapStrategy & {
17
+ type: "externalSwap";
18
+ externalSwapQuote: ExternalSwapQuote;
19
+ swapPathStats: undefined;
20
+ };
21
+ export type InternalSwapStrategy = BaseSwapStrategy & {
22
+ type: "internalSwap";
23
+ swapPathStats: SwapPathStats;
24
+ externalSwapQuote: undefined;
25
+ };
26
+ export type CombinedSwapStrategy = BaseSwapStrategy & {
27
+ type: "combinedSwap";
28
+ externalSwapQuote: ExternalSwapQuote;
29
+ swapPathStats: SwapPathStats;
30
+ };
31
+ export type SwapStrategyForIncreaseOrders = NoSwapStrategy | ExternalSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
32
+ export type SwapStrategyForSwapOrders = NoSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
33
+ export {};
@@ -89,6 +89,11 @@ export type SignedTokenPermit = {
89
89
  r: string;
90
90
  s: string;
91
91
  token: string;
92
+ onchainParams: {
93
+ name: string;
94
+ version: string;
95
+ nonce: bigint;
96
+ };
92
97
  };
93
98
  export type InfoTokens = {
94
99
  [key: string]: TokenInfo;
@@ -1,5 +1,7 @@
1
1
  import { ExternalSwapFeeItem, FeeItem, SwapFeeItem } from "./fees";
2
2
  import { DecreasePositionSwapType, OrderType } from "./orders";
3
+ import { SwapStrategyForIncreaseOrders } from "./swapStrategy";
4
+ import { TokensData } from "./tokens";
3
5
  export declare enum TradeType {
4
6
  Long = "Long",
5
7
  Short = "Short",
@@ -39,7 +41,7 @@ export type SwapAmounts = {
39
41
  usdOut: bigint;
40
42
  priceIn: bigint;
41
43
  priceOut: bigint;
42
- swapPathStats: SwapPathStats | undefined;
44
+ swapStrategy: SwapStrategyForIncreaseOrders;
43
45
  minOutputAmount: bigint;
44
46
  uiFeeUsd?: bigint;
45
47
  };
@@ -48,8 +50,7 @@ export type IncreasePositionAmounts = {
48
50
  initialCollateralUsd: bigint;
49
51
  collateralDeltaAmount: bigint;
50
52
  collateralDeltaUsd: bigint;
51
- swapPathStats: SwapPathStats | undefined;
52
- externalSwapQuote: ExternalSwapQuote | undefined;
53
+ swapStrategy: SwapStrategyForIncreaseOrders;
53
54
  indexTokenAmount: bigint;
54
55
  sizeDeltaUsd: bigint;
55
56
  sizeDeltaInTokens: bigint;
@@ -212,7 +213,8 @@ export type FindSwapPath = (usdIn: bigint, opts?: {
212
213
  }) => SwapPathStats | undefined;
213
214
  export type TradeFeesType = "swap" | "increase" | "decrease" | "edit";
214
215
  export declare enum ExternalSwapAggregator {
215
- OpenOcean = "openOcean"
216
+ OpenOcean = "openOcean",
217
+ BotanixStaking = "botanixStaking"
216
218
  }
217
219
  export type ExternalSwapQuote = {
218
220
  aggregator: ExternalSwapAggregator;
@@ -235,6 +237,18 @@ export type ExternalSwapQuote = {
235
237
  estimatedExecutionFee: bigint;
236
238
  };
237
239
  };
240
+ export type ExternalSwapPath = {
241
+ aggregator: ExternalSwapAggregator;
242
+ inTokenAddress: string;
243
+ outTokenAddress: string;
244
+ };
245
+ export type ExternalSwapQuoteParams = {
246
+ chainId: number;
247
+ receiverAddress: string;
248
+ gasPrice: bigint | undefined;
249
+ tokensData: TokensData | undefined;
250
+ botanixStakingAssetsPerShare: bigint | undefined;
251
+ };
238
252
  export type ExternalSwapCalculationStrategy = "byFromValue" | "leverageBySize";
239
253
  export type ExternalSwapInputs = {
240
254
  amountIn: bigint;
@@ -0,0 +1,11 @@
1
+ import { TokensData } from "../../types/tokens";
2
+ import { ExternalSwapQuote } from "../../types/trade";
3
+ export declare const getBotanixStakingExternalSwapQuote: ({ tokenInAddress, tokenOutAddress, amountIn, gasPrice, receiverAddress, tokensData, assetsPerShare, }: {
4
+ tokenInAddress: string;
5
+ tokenOutAddress: string;
6
+ amountIn: bigint;
7
+ gasPrice: bigint;
8
+ receiverAddress: string;
9
+ tokensData: TokensData;
10
+ assetsPerShare: bigint;
11
+ }) => ExternalSwapQuote | undefined;
@@ -0,0 +1,22 @@
1
+ import { MarketsInfoData } from "../../types/markets";
2
+ import { SwapStrategyForSwapOrders } from "../../types/swapStrategy";
3
+ import { TokenData } from "../../types/tokens";
4
+ import { ExternalSwapQuoteParams, SwapOptimizationOrderArray } from "../../types/trade";
5
+ export declare function buildSwapStrategy({ amountIn, tokenIn, tokenOut, marketsInfoData, chainId, swapOptimizationOrder, externalSwapQuoteParams, }: {
6
+ chainId: number;
7
+ amountIn: bigint;
8
+ tokenIn: TokenData;
9
+ tokenOut: TokenData;
10
+ marketsInfoData: MarketsInfoData | undefined;
11
+ swapOptimizationOrder: SwapOptimizationOrderArray | undefined;
12
+ externalSwapQuoteParams: ExternalSwapQuoteParams;
13
+ }): SwapStrategyForSwapOrders;
14
+ export declare function buildReverseSwapStrategy({ amountOut, tokenIn, tokenOut, marketsInfoData, chainId, externalSwapQuoteParams, swapOptimizationOrder, }: {
15
+ chainId: number;
16
+ amountOut: bigint;
17
+ tokenIn: TokenData;
18
+ tokenOut: TokenData;
19
+ marketsInfoData: MarketsInfoData | undefined;
20
+ externalSwapQuoteParams: ExternalSwapQuoteParams;
21
+ swapOptimizationOrder: SwapOptimizationOrderArray | undefined;
22
+ }): SwapStrategyForSwapOrders;
@@ -0,0 +1,13 @@
1
+ import { ExternalSwapPath } from "../../types/trade";
2
+ export declare const AVAILABLE_BOTANIX_DEPOSIT_PAIRS: {
3
+ from: string;
4
+ to: string;
5
+ }[];
6
+ export declare const AVAILABLE_BOTANIX_WITHDRAW_PAIRS: {
7
+ from: string;
8
+ to: string;
9
+ }[];
10
+ export declare const getAvailableExternalSwapPaths: ({ chainId, fromTokenAddress, }: {
11
+ chainId: number;
12
+ fromTokenAddress: string;
13
+ }) => ExternalSwapPath[];
@@ -0,0 +1,6 @@
1
+ import { ExternalSwapPath, ExternalSwapQuote, ExternalSwapQuoteParams } from "../../types/trade";
2
+ export declare const getExternalSwapQuoteByPath: ({ amountIn, externalSwapPath, externalSwapQuoteParams, }: {
3
+ amountIn: bigint;
4
+ externalSwapPath: ExternalSwapPath;
5
+ externalSwapQuoteParams: ExternalSwapQuoteParams;
6
+ }) => ExternalSwapQuote | undefined;
@@ -1,6 +1,7 @@
1
+ import { MarketsInfoData } from "../../types/markets";
1
2
  import type { TokenData, TokensRatio } from "../../types/tokens";
2
- import { SwapRoute } from "../../types/trade";
3
3
  import type { FindSwapPath, SwapAmounts, SwapOptimizationOrderArray } from "../../types/trade";
4
+ import { ExternalSwapQuoteParams, SwapRoute } from "../../types/trade";
4
5
  export declare function getSwapAmountsByFromValue(p: {
5
6
  tokenIn: TokenData;
6
7
  tokenOut: TokenData;
@@ -9,8 +10,11 @@ export declare function getSwapAmountsByFromValue(p: {
9
10
  isLimit: boolean;
10
11
  swapOptimizationOrder?: SwapOptimizationOrderArray;
11
12
  allowedSwapSlippageBps?: bigint;
12
- findSwapPath: FindSwapPath;
13
13
  uiFeeFactor: bigint;
14
+ marketsInfoData: MarketsInfoData | undefined;
15
+ chainId: number;
16
+ externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
17
+ findSwapPath: FindSwapPath;
14
18
  }): SwapAmounts;
15
19
  export declare function getSwapAmountsByToValue(p: {
16
20
  tokenIn: TokenData;
@@ -18,9 +22,12 @@ export declare function getSwapAmountsByToValue(p: {
18
22
  amountOut: bigint;
19
23
  triggerRatio?: TokensRatio;
20
24
  isLimit: boolean;
21
- findSwapPath: FindSwapPath;
22
25
  swapOptimizationOrder?: SwapOptimizationOrderArray;
23
26
  allowedSwapSlippageBps?: bigint;
24
27
  uiFeeFactor: bigint;
28
+ marketsInfoData: MarketsInfoData | undefined;
29
+ chainId: number;
30
+ externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
31
+ findSwapPath: FindSwapPath;
25
32
  }): SwapAmounts;
26
33
  export declare function getSwapPathComparator(order?: SwapOptimizationOrderArray | undefined): (a: SwapRoute, b: SwapRoute) => 1 | 0 | -1;
@@ -1,8 +1,8 @@
1
- import { MarketInfo } from "../../types/markets";
1
+ import { MarketInfo, MarketsInfoData } from "../../types/markets";
2
2
  import { PositionInfo } from "../../types/positions";
3
3
  import { UserReferralInfo } from "../../types/referrals";
4
4
  import { TokenData, TokensRatio } from "../../types/tokens";
5
- import { ExternalSwapQuote, FindSwapPath, IncreasePositionAmounts, TriggerThresholdType } from "../../types/trade";
5
+ import { ExternalSwapQuote, ExternalSwapQuoteParams, FindSwapPath, IncreasePositionAmounts, TriggerThresholdType } from "../../types/trade";
6
6
  type IncreasePositionParams = {
7
7
  marketInfo: MarketInfo;
8
8
  indexToken: TokenData;
@@ -22,6 +22,9 @@ type IncreasePositionParams = {
22
22
  strategy: "leverageBySize" | "leverageByCollateral" | "independent";
23
23
  findSwapPath: FindSwapPath;
24
24
  uiFeeFactor: bigint;
25
+ marketsInfoData: MarketsInfoData | undefined;
26
+ chainId: number;
27
+ externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
25
28
  };
26
29
  export declare function getIncreasePositionAmounts(p: IncreasePositionParams): IncreasePositionAmounts;
27
30
  export declare function getTokensRatio({ fromToken, toToken, triggerRatioValue, markPrice, }: {
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Ui fee receiver structure:
3
- * 0..3 bytes (0..7 chars) - PREFIX
4
- * 4..16 bytes (8..27 chars) - 12 bytes buffer
5
- * 17 byte (27..29 chars) - isExpress flag
6
- * 18 byte (30..32 chars) - numberOfParts (hex encoded)
7
- * 19..20 bytes (34..38 chars) - twapId
8
- * 20 byte (38..40 chars) - VERSION
3
+ * 0-3 (4) bytes (0-7 chars) - PREFIX
4
+ * 4-15 (12) bytes (8-32 chars) - 12 bytes buffer
5
+ * 16 (1) byte (33-34 chars) - isExpress flag
6
+ * 17 (1) byte (35-36 chars) - numberOfParts (hex encoded)
7
+ * 18-19 (2) bytes (37-40 chars) - twapId
8
+ * 20 (1) byte (41-42 chars) - VERSION
9
9
  *
10
- * Total: 20 bytes (40 hex characters)
10
+ * Total: 0x + 20 bytes (41 hex characters)
11
11
  */
12
12
  export declare function generateTwapId(): string;
13
13
  export declare function createTwapUiFeeReceiver({ numberOfParts }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmx-io/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "main": "./build/cjs/src/index.js",
6
6
  "module": "./build/esm/src/index.js",