@strobelabs/perpcity-sdk 0.4.3 → 0.5.0

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.
package/dist/index.js CHANGED
@@ -668,26 +668,19 @@ var PERP_MANAGER_ABI = [
668
668
  anonymous: false,
669
669
  inputs: [
670
670
  {
671
- indexed: false,
672
- internalType: "contract IFees",
673
- name: "feesModule",
674
- type: "address"
675
- }
676
- ],
677
- name: "FeesModuleRegistered",
678
- type: "event"
679
- },
680
- {
681
- anonymous: false,
682
- inputs: [
671
+ indexed: true,
672
+ internalType: "uint8",
673
+ name: "moduleType",
674
+ type: "uint8"
675
+ },
683
676
  {
684
- indexed: false,
685
- internalType: "contract ILockupPeriod",
686
- name: "lockupPeriodModule",
677
+ indexed: true,
678
+ internalType: "address",
679
+ name: "module",
687
680
  type: "address"
688
681
  }
689
682
  ],
690
- name: "LockupPeriodModuleRegistered",
683
+ name: "ModuleRegistered",
691
684
  type: "event"
692
685
  },
693
686
  {
@@ -715,19 +708,6 @@ var PERP_MANAGER_ABI = [
715
708
  name: "MarginAdjusted",
716
709
  type: "event"
717
710
  },
718
- {
719
- anonymous: false,
720
- inputs: [
721
- {
722
- indexed: false,
723
- internalType: "contract IMarginRatios",
724
- name: "marginRatiosModule",
725
- type: "address"
726
- }
727
- ],
728
- name: "MarginRatiosModuleRegistered",
729
- type: "event"
730
- },
731
711
  {
732
712
  anonymous: false,
733
713
  inputs: [
@@ -901,13 +881,13 @@ var PERP_MANAGER_ABI = [
901
881
  {
902
882
  indexed: false,
903
883
  internalType: "int256",
904
- name: "perpDelta",
884
+ name: "exitPerpDelta",
905
885
  type: "int256"
906
886
  },
907
887
  {
908
888
  indexed: false,
909
889
  internalType: "int256",
910
- name: "usdDelta",
890
+ name: "exitUsdDelta",
911
891
  type: "int256"
912
892
  },
913
893
  {
@@ -921,6 +901,42 @@ var PERP_MANAGER_ABI = [
921
901
  internalType: "int24",
922
902
  name: "tickUpper",
923
903
  type: "int24"
904
+ },
905
+ {
906
+ indexed: false,
907
+ internalType: "int256",
908
+ name: "netUsdDelta",
909
+ type: "int256"
910
+ },
911
+ {
912
+ indexed: false,
913
+ internalType: "int256",
914
+ name: "funding",
915
+ type: "int256"
916
+ },
917
+ {
918
+ indexed: false,
919
+ internalType: "uint256",
920
+ name: "utilizationFee",
921
+ type: "uint256"
922
+ },
923
+ {
924
+ indexed: false,
925
+ internalType: "uint256",
926
+ name: "adl",
927
+ type: "uint256"
928
+ },
929
+ {
930
+ indexed: false,
931
+ internalType: "uint256",
932
+ name: "liquidationFee",
933
+ type: "uint256"
934
+ },
935
+ {
936
+ indexed: false,
937
+ internalType: "int256",
938
+ name: "netMargin",
939
+ type: "int256"
924
940
  }
925
941
  ],
926
942
  name: "PositionClosed",
@@ -993,19 +1009,6 @@ var PERP_MANAGER_ABI = [
993
1009
  name: "PositionOpened",
994
1010
  type: "event"
995
1011
  },
996
- {
997
- anonymous: false,
998
- inputs: [
999
- {
1000
- indexed: false,
1001
- internalType: "contract ISqrtPriceImpactLimit",
1002
- name: "sqrtPriceImpactLimitModule",
1003
- type: "address"
1004
- }
1005
- ],
1006
- name: "SqrtPriceImpactLimitModuleRegistered",
1007
- type: "event"
1008
- },
1009
1012
  {
1010
1013
  anonymous: false,
1011
1014
  inputs: [
@@ -1132,12 +1135,12 @@ var PERP_MANAGER_ABI = [
1132
1135
  },
1133
1136
  {
1134
1137
  internalType: "int256",
1135
- name: "perpDelta",
1138
+ name: "usdDelta",
1136
1139
  type: "int256"
1137
1140
  },
1138
1141
  {
1139
1142
  internalType: "uint128",
1140
- name: "usdLimit",
1143
+ name: "perpLimit",
1141
1144
  type: "uint128"
1142
1145
  }
1143
1146
  ],
@@ -1384,11 +1387,6 @@ var PERP_MANAGER_ABI = [
1384
1387
  internalType: "contract ISqrtPriceImpactLimit",
1385
1388
  name: "sqrtPriceImpactLimit",
1386
1389
  type: "address"
1387
- },
1388
- {
1389
- internalType: "uint160",
1390
- name: "startingSqrtPriceX96",
1391
- type: "uint160"
1392
1390
  }
1393
1391
  ],
1394
1392
  internalType: "struct IPerpManager.CreatePerpParams",
@@ -1509,69 +1507,17 @@ var PERP_MANAGER_ABI = [
1509
1507
  {
1510
1508
  inputs: [
1511
1509
  {
1512
- internalType: "contract IFees",
1513
- name: "",
1514
- type: "address"
1515
- }
1516
- ],
1517
- name: "isFeesRegistered",
1518
- outputs: [
1519
- {
1520
- internalType: "bool",
1521
- name: "",
1522
- type: "bool"
1523
- }
1524
- ],
1525
- stateMutability: "view",
1526
- type: "function"
1527
- },
1528
- {
1529
- inputs: [
1530
- {
1531
- internalType: "contract ILockupPeriod",
1532
- name: "",
1533
- type: "address"
1534
- }
1535
- ],
1536
- name: "isLockupPeriodRegistered",
1537
- outputs: [
1538
- {
1539
- internalType: "bool",
1540
- name: "",
1541
- type: "bool"
1542
- }
1543
- ],
1544
- stateMutability: "view",
1545
- type: "function"
1546
- },
1547
- {
1548
- inputs: [
1549
- {
1550
- internalType: "contract IMarginRatios",
1551
- name: "",
1552
- type: "address"
1553
- }
1554
- ],
1555
- name: "isMarginRatiosRegistered",
1556
- outputs: [
1557
- {
1558
- internalType: "bool",
1559
- name: "",
1560
- type: "bool"
1561
- }
1562
- ],
1563
- stateMutability: "view",
1564
- type: "function"
1565
- },
1566
- {
1567
- inputs: [
1510
+ internalType: "uint8",
1511
+ name: "moduleType",
1512
+ type: "uint8"
1513
+ },
1568
1514
  {
1569
- internalType: "contract ISqrtPriceImpactLimit",
1570
- name: "",
1515
+ internalType: "address",
1516
+ name: "module",
1571
1517
  type: "address"
1572
1518
  }
1573
1519
  ],
1574
- name: "isSqrtPriceImpactLimitRegistered",
1520
+ name: "isModuleRegistered",
1575
1521
  outputs: [
1576
1522
  {
1577
1523
  internalType: "bool",
@@ -1923,14 +1869,19 @@ var PERP_MANAGER_ABI = [
1923
1869
  type: "int256"
1924
1870
  },
1925
1871
  {
1926
- internalType: "uint256",
1872
+ internalType: "int256",
1927
1873
  name: "netMargin",
1928
- type: "uint256"
1874
+ type: "int256"
1929
1875
  },
1930
1876
  {
1931
1877
  internalType: "bool",
1932
1878
  name: "wasLiquidated",
1933
1879
  type: "bool"
1880
+ },
1881
+ {
1882
+ internalType: "uint256",
1883
+ name: "notional",
1884
+ type: "uint256"
1934
1885
  }
1935
1886
  ],
1936
1887
  stateMutability: "nonpayable",
@@ -2071,51 +2022,66 @@ var PERP_MANAGER_ABI = [
2071
2022
  {
2072
2023
  inputs: [
2073
2024
  {
2074
- internalType: "contract IFees",
2075
- name: "feesModule",
2076
- type: "address"
2077
- }
2078
- ],
2079
- name: "registerFeesModule",
2080
- outputs: [],
2081
- stateMutability: "nonpayable",
2082
- type: "function"
2083
- },
2084
- {
2085
- inputs: [
2025
+ internalType: "PoolId",
2026
+ name: "perpId",
2027
+ type: "bytes32"
2028
+ },
2086
2029
  {
2087
- internalType: "contract ILockupPeriod",
2088
- name: "lockupPeriodModule",
2089
- type: "address"
2030
+ internalType: "bool",
2031
+ name: "zeroForOne",
2032
+ type: "bool"
2033
+ },
2034
+ {
2035
+ internalType: "bool",
2036
+ name: "isExactIn",
2037
+ type: "bool"
2038
+ },
2039
+ {
2040
+ internalType: "uint256",
2041
+ name: "amount",
2042
+ type: "uint256"
2043
+ },
2044
+ {
2045
+ internalType: "uint160",
2046
+ name: "sqrtPriceLimitX96",
2047
+ type: "uint160"
2090
2048
  }
2091
2049
  ],
2092
- name: "registerLockupPeriodModule",
2093
- outputs: [],
2094
- stateMutability: "nonpayable",
2095
- type: "function"
2096
- },
2097
- {
2098
- inputs: [
2050
+ name: "quoteSwap",
2051
+ outputs: [
2099
2052
  {
2100
- internalType: "contract IMarginRatios",
2101
- name: "marginRatiosModule",
2102
- type: "address"
2053
+ internalType: "bytes",
2054
+ name: "unexpectedReason",
2055
+ type: "bytes"
2056
+ },
2057
+ {
2058
+ internalType: "int256",
2059
+ name: "perpDelta",
2060
+ type: "int256"
2061
+ },
2062
+ {
2063
+ internalType: "int256",
2064
+ name: "usdDelta",
2065
+ type: "int256"
2103
2066
  }
2104
2067
  ],
2105
- name: "registerMarginRatiosModule",
2106
- outputs: [],
2107
2068
  stateMutability: "nonpayable",
2108
2069
  type: "function"
2109
2070
  },
2110
2071
  {
2111
2072
  inputs: [
2112
2073
  {
2113
- internalType: "contract ISqrtPriceImpactLimit",
2114
- name: "sqrtPriceImpactLimitModule",
2074
+ internalType: "uint8",
2075
+ name: "moduleType",
2076
+ type: "uint8"
2077
+ },
2078
+ {
2079
+ internalType: "address",
2080
+ name: "module",
2115
2081
  type: "address"
2116
2082
  }
2117
2083
  ],
2118
- name: "registerSqrtPriceImpactLimitModule",
2084
+ name: "registerModule",
2119
2085
  outputs: [],
2120
2086
  stateMutability: "nonpayable",
2121
2087
  type: "function"
@@ -3566,7 +3532,6 @@ function getPerpTickSpacing(perpData) {
3566
3532
  var import_viem5 = require("viem");
3567
3533
  async function createPerp(context, params) {
3568
3534
  return withErrorHandling(async () => {
3569
- const sqrtPriceX96 = priceToSqrtPriceX96(params.startingPrice);
3570
3535
  const deployments = context.deployments();
3571
3536
  const fees = params.fees ?? deployments.feesModule;
3572
3537
  const marginRatios = params.marginRatios ?? deployments.marginRatiosModule;
@@ -3580,8 +3545,7 @@ async function createPerp(context, params) {
3580
3545
  fees,
3581
3546
  marginRatios,
3582
3547
  lockupPeriod,
3583
- sqrtPriceImpactLimit,
3584
- startingSqrtPriceX96: sqrtPriceX96
3548
+ sqrtPriceImpactLimit
3585
3549
  };
3586
3550
  const { request } = await context.publicClient.simulateContract({
3587
3551
  address: context.deployments().perpManager,