@0dotxyz/p0-ts-sdk 1.0.1 → 1.1.0-alpha.2

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.
@@ -1161,4 +1161,445 @@ interface RewardPerTimeUnitPointJSON {
1161
1161
  rewardPerTimeUnit: string;
1162
1162
  }
1163
1163
 
1164
- export { type RewardPerTimeUnitPointJSON as $, type PriceHeuristicJSON as A, type BorrowRateCurveFields as B, type CurvePointFields as C, type ScopeConfigurationJSON as D, type SwitchboardConfigurationJSON as E, type FeedResponse as F, type PythConfigurationJSON as G, type WithdrawalCapsJSON as H, type ObligationLiquidityJSON as I, type ObligationCollateralJSON as J, type ObligationOrderJSON as K, type ObligationCollateralFields as L, type ObligationLiquidityFields as M, type ObligationOrderFields as N, type ObligationRaw as O, type PullFeedAccountData as P, type LastUpdateFields as Q, type ReserveRaw as R, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as S, type TokenInfoFields$1 as T, type BigFractionBytesFields as U, type LastUpdateJSON as V, type WithdrawalCapsFields as W, type BigFractionBytesJSON as X, type RewardPerTimeUnitPointFields as Y, type RewardScheduleCurveFields as Z, type RewardScheduleCurveJSON as _, type FarmStateRaw as a, type ReserveJSON as b, type ObligationJSON as c, type FarmStateJSON as d, type RewardInfoFields as e, type CurrentResult as f, type OracleSubmission as g, type CrossbarSimulatePayload as h, getSwitchboardProgram as i, decodeSwitchboardPullFeedData as j, type ReserveLiquidityFields as k, type ReserveCollateralFields as l, type ReserveConfigFields as m, type ReserveFeesFields as n, type PriceHeuristicFields as o, type ScopeConfigurationFields as p, type SwitchboardConfigurationFields as q, type PythConfigurationFields as r, switchboardAccountCoder as s, type ReserveLiquidityJSON as t, type ReserveCollateralJSON as u, type ReserveConfigJSON as v, type ReserveFeesJSON as w, type BorrowRateCurveJSON as x, type CurvePointJSON as y, type TokenInfoJSON$1 as z };
1164
+ interface DriftUserStatsJSON {
1165
+ /** The authority for all of a users sub accounts */
1166
+ authority: string;
1167
+ /** The address that referred this user */
1168
+ referrer: string;
1169
+ /** Stats on the fees paid by the user */
1170
+ fees: UserFeesJSON;
1171
+ /**
1172
+ * The timestamp of the next epoch
1173
+ * Epoch is used to limit referrer rewards earned in single epoch
1174
+ */
1175
+ nextEpochTs: string;
1176
+ /**
1177
+ * Rolling 30day maker volume for user
1178
+ * precision: QUOTE_PRECISION
1179
+ */
1180
+ makerVolume30d: string;
1181
+ /**
1182
+ * Rolling 30day taker volume for user
1183
+ * precision: QUOTE_PRECISION
1184
+ */
1185
+ takerVolume30d: string;
1186
+ /**
1187
+ * Rolling 30day filler volume for user
1188
+ * precision: QUOTE_PRECISION
1189
+ */
1190
+ fillerVolume30d: string;
1191
+ /** last time the maker volume was updated */
1192
+ lastMakerVolume30dTs: string;
1193
+ /** last time the taker volume was updated */
1194
+ lastTakerVolume30dTs: string;
1195
+ /** last time the filler volume was updated */
1196
+ lastFillerVolume30dTs: string;
1197
+ /** The amount of tokens staked in the quote spot markets if */
1198
+ ifStakedQuoteAssetAmount: string;
1199
+ /** The current number of sub accounts */
1200
+ numberOfSubAccounts: number;
1201
+ /**
1202
+ * The number of sub accounts created. Can be greater than the number of sub accounts if user
1203
+ * has deleted sub accounts
1204
+ */
1205
+ numberOfSubAccountsCreated: number;
1206
+ /**
1207
+ * Flags for referrer status:
1208
+ * First bit (LSB): 1 if user is a referrer, 0 otherwise
1209
+ * Second bit: 1 if user was referred, 0 otherwise
1210
+ */
1211
+ referrerStatus: number;
1212
+ disableUpdatePerpBidAskTwap: boolean;
1213
+ padding1: Array<number>;
1214
+ /** whether the user has a FuelOverflow account */
1215
+ fuelOverflowStatus: number;
1216
+ /** accumulated fuel for token amounts of insurance */
1217
+ fuelInsurance: number;
1218
+ /** accumulated fuel for notional of deposits */
1219
+ fuelDeposits: number;
1220
+ /** accumulate fuel bonus for notional of borrows */
1221
+ fuelBorrows: number;
1222
+ /** accumulated fuel for perp open interest */
1223
+ fuelPositions: number;
1224
+ /** accumulate fuel bonus for taker volume */
1225
+ fuelTaker: number;
1226
+ /** accumulate fuel bonus for maker volume */
1227
+ fuelMaker: number;
1228
+ /** The amount of tokens staked in the governance spot markets if */
1229
+ ifStakedGovTokenAmount: string;
1230
+ /**
1231
+ * last unix ts user stats data was used to update if fuel (u32 to save space)
1232
+ */
1233
+ lastFuelIfBonusUpdateTs: number;
1234
+ padding: Array<number>;
1235
+ }
1236
+ interface UserFeesJSON {
1237
+ /**
1238
+ * Total taker fee paid
1239
+ * precision: QUOTE_PRECISION
1240
+ */
1241
+ totalFeePaid: string;
1242
+ /**
1243
+ * Total maker fee rebate
1244
+ * precision: QUOTE_PRECISION
1245
+ */
1246
+ totalFeeRebate: string;
1247
+ /**
1248
+ * Total discount from holding token
1249
+ * precision: QUOTE_PRECISION
1250
+ */
1251
+ totalTokenDiscount: string;
1252
+ /**
1253
+ * Total discount from being referred
1254
+ * precision: QUOTE_PRECISION
1255
+ */
1256
+ totalRefereeDiscount: string;
1257
+ /**
1258
+ * Total reward to referrer
1259
+ * precision: QUOTE_PRECISION
1260
+ */
1261
+ totalReferrerReward: string;
1262
+ /**
1263
+ * Total reward to referrer this epoch
1264
+ * precision: QUOTE_PRECISION
1265
+ */
1266
+ currentEpochReferrerReward: string;
1267
+ }
1268
+
1269
+ interface DriftUserStats {
1270
+ authority: PublicKey;
1271
+ referrer: PublicKey;
1272
+ fees: UserFeesFields;
1273
+ nextEpochTs: BN;
1274
+ makerVolume30d: BN;
1275
+ takerVolume30d: BN;
1276
+ fillerVolume30d: BN;
1277
+ lastMakerVolume30dTs: BN;
1278
+ lastTakerVolume30dTs: BN;
1279
+ lastFillerVolume30dTs: BN;
1280
+ ifStakedQuoteAssetAmount: BN;
1281
+ numberOfSubAccounts: number;
1282
+ numberOfSubAccountsCreated: number;
1283
+ referrerStatus: number;
1284
+ disableUpdatePerpBidAskTwap: boolean;
1285
+ padding1: Array<number>;
1286
+ fuelOverflowStatus: number;
1287
+ fuelInsurance: number;
1288
+ fuelDeposits: number;
1289
+ fuelBorrows: number;
1290
+ fuelPositions: number;
1291
+ fuelTaker: number;
1292
+ fuelMaker: number;
1293
+ ifStakedGovTokenAmount: BN;
1294
+ lastFuelIfBonusUpdateTs: number;
1295
+ padding: Array<number>;
1296
+ }
1297
+ interface UserFeesFields {
1298
+ totalFeePaid: BN;
1299
+ totalFeeRebate: BN;
1300
+ totalTokenDiscount: BN;
1301
+ totalRefereeDiscount: BN;
1302
+ totalReferrerReward: BN;
1303
+ currentEpochReferrerReward: BN;
1304
+ }
1305
+
1306
+ interface DriftSpotMarketJSON {
1307
+ pubkey: string;
1308
+ oracle: string;
1309
+ mint: string;
1310
+ decimals: number;
1311
+ cumulativeDepositInterest: string;
1312
+ marketIndex: number;
1313
+ depositBalance: string;
1314
+ borrowBalance: string;
1315
+ cumulativeBorrowInterest: string;
1316
+ optimalUtilization: number;
1317
+ optimalBorrowRate: number;
1318
+ maxBorrowRate: number;
1319
+ minBorrowRate: number;
1320
+ insuranceFund: {
1321
+ totalFactor: number;
1322
+ };
1323
+ }
1324
+
1325
+ interface FeeStructure {
1326
+ feeTiers: Array<FeeTier>;
1327
+ fillerRewardStructure: OrderFillerRewardStructure;
1328
+ referrerRewardEpochUpperBound: BN;
1329
+ flatFillerFee: BN;
1330
+ }
1331
+ interface FeeStructureJSON {
1332
+ feeTiers: Array<FeeTierJSON>;
1333
+ fillerRewardStructure: OrderFillerRewardStructureJSON;
1334
+ referrerRewardEpochUpperBound: string;
1335
+ flatFillerFee: string;
1336
+ }
1337
+ interface FeeTier {
1338
+ feeNumerator: number;
1339
+ feeDenominator: number;
1340
+ makerRebateNumerator: number;
1341
+ makerRebateDenominator: number;
1342
+ referrerRewardNumerator: number;
1343
+ referrerRewardDenominator: number;
1344
+ refereeFeeNumerator: number;
1345
+ refereeFeeDenominator: number;
1346
+ }
1347
+ interface FeeTierJSON {
1348
+ feeNumerator: number;
1349
+ feeDenominator: number;
1350
+ makerRebateNumerator: number;
1351
+ makerRebateDenominator: number;
1352
+ referrerRewardNumerator: number;
1353
+ referrerRewardDenominator: number;
1354
+ refereeFeeNumerator: number;
1355
+ refereeFeeDenominator: number;
1356
+ }
1357
+ interface OrderFillerRewardStructure {
1358
+ rewardNumerator: number;
1359
+ rewardDenominator: number;
1360
+ timeBasedRewardLowerBound: BN;
1361
+ }
1362
+ interface OrderFillerRewardStructureJSON {
1363
+ rewardNumerator: number;
1364
+ rewardDenominator: number;
1365
+ timeBasedRewardLowerBound: string;
1366
+ }
1367
+ interface OracleGuardRails {
1368
+ priceDivergence: PriceDivergenceGuardRails;
1369
+ validity: ValidityGuardRails;
1370
+ }
1371
+ interface OracleGuardRailsJSON {
1372
+ priceDivergence: PriceDivergenceGuardRailsJSON;
1373
+ validity: ValidityGuardRailsJSON;
1374
+ }
1375
+ interface PriceDivergenceGuardRails {
1376
+ markOraclePercentDivergence: BN;
1377
+ oracleTwap5minPercentDivergence: BN;
1378
+ }
1379
+ interface PriceDivergenceGuardRailsJSON {
1380
+ markOraclePercentDivergence: string;
1381
+ oracleTwap5minPercentDivergence: string;
1382
+ }
1383
+ interface ValidityGuardRails {
1384
+ slotsBeforeStaleForAmm: BN;
1385
+ slotsBeforeStaleForMargin: BN;
1386
+ confidenceIntervalMaxSize: BN;
1387
+ tooVolatileRatio: BN;
1388
+ }
1389
+ interface ValidityGuardRailsJSON {
1390
+ slotsBeforeStaleForAmm: string;
1391
+ slotsBeforeStaleForMargin: string;
1392
+ confidenceIntervalMaxSize: string;
1393
+ tooVolatileRatio: string;
1394
+ }
1395
+ interface HistoricalOracleData {
1396
+ /** precision: PRICE_PRECISION */
1397
+ lastOraclePrice: BN;
1398
+ /** precision: PRICE_PRECISION */
1399
+ lastOracleConf: BN;
1400
+ /** number of slots since last update */
1401
+ lastOracleDelay: BN;
1402
+ /** precision: PRICE_PRECISION */
1403
+ lastOraclePriceTwap: BN;
1404
+ /** precision: PRICE_PRECISION */
1405
+ lastOraclePriceTwap5min: BN;
1406
+ /** unix_timestamp of last snapshot */
1407
+ lastOraclePriceTwapTs: BN;
1408
+ }
1409
+ interface HistoricalOracleDataJSON {
1410
+ /** precision: PRICE_PRECISION */
1411
+ lastOraclePrice: string;
1412
+ /** precision: PRICE_PRECISION */
1413
+ lastOracleConf: string;
1414
+ /** number of slots since last update */
1415
+ lastOracleDelay: string;
1416
+ /** precision: PRICE_PRECISION */
1417
+ lastOraclePriceTwap: string;
1418
+ /** precision: PRICE_PRECISION */
1419
+ lastOraclePriceTwap5min: string;
1420
+ /** unix_timestamp of last snapshot */
1421
+ lastOraclePriceTwapTs: string;
1422
+ }
1423
+ interface HistoricalIndexData {
1424
+ /** precision: PRICE_PRECISION */
1425
+ lastIndexBidPrice: BN;
1426
+ /** precision: PRICE_PRECISION */
1427
+ lastIndexAskPrice: BN;
1428
+ /** precision: PRICE_PRECISION */
1429
+ lastIndexPriceTwap: BN;
1430
+ /** precision: PRICE_PRECISION */
1431
+ lastIndexPriceTwap5min: BN;
1432
+ /** unix_timestamp of last snapshot */
1433
+ lastIndexPriceTwapTs: BN;
1434
+ }
1435
+ interface HistoricalIndexDataJSON {
1436
+ /** precision: PRICE_PRECISION */
1437
+ lastIndexBidPrice: string;
1438
+ /** precision: PRICE_PRECISION */
1439
+ lastIndexAskPrice: string;
1440
+ /** precision: PRICE_PRECISION */
1441
+ lastIndexPriceTwap: string;
1442
+ /** precision: PRICE_PRECISION */
1443
+ lastIndexPriceTwap5min: string;
1444
+ /** unix_timestamp of last snapshot */
1445
+ lastIndexPriceTwapTs: string;
1446
+ }
1447
+ interface PoolBalance {
1448
+ /**
1449
+ * To get the pool's token amount, you must multiply the scaled balance by the market's cumulative
1450
+ * deposit interest
1451
+ * precision: SPOT_BALANCE_PRECISION
1452
+ */
1453
+ scaledBalance: BN;
1454
+ /** The spot market the pool is for */
1455
+ marketIndex: number;
1456
+ padding: Array<number>;
1457
+ }
1458
+ interface PoolBalanceJSON {
1459
+ /**
1460
+ * To get the pool's token amount, you must multiply the scaled balance by the market's cumulative
1461
+ * deposit interest
1462
+ * precision: SPOT_BALANCE_PRECISION
1463
+ */
1464
+ scaledBalance: string;
1465
+ /** The spot market the pool is for */
1466
+ marketIndex: number;
1467
+ padding: Array<number>;
1468
+ }
1469
+ interface InsuranceFund {
1470
+ vault: PublicKey;
1471
+ totalShares: BN;
1472
+ userShares: BN;
1473
+ sharesBase: BN;
1474
+ unstakingPeriod: BN;
1475
+ lastRevenueSettleTs: BN;
1476
+ revenueSettlePeriod: BN;
1477
+ totalFactor: number;
1478
+ userFactor: number;
1479
+ }
1480
+ interface InsuranceFundJSON {
1481
+ vault: string;
1482
+ totalShares: string;
1483
+ userShares: string;
1484
+ sharesBase: string;
1485
+ unstakingPeriod: string;
1486
+ lastRevenueSettleTs: string;
1487
+ revenueSettlePeriod: string;
1488
+ totalFactor: number;
1489
+ userFactor: number;
1490
+ }
1491
+ declare enum SpotBalanceType {
1492
+ Deposit = "Deposit",
1493
+ Borrow = "Borrow"
1494
+ }
1495
+ interface SpotPosition {
1496
+ /**
1497
+ * The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow
1498
+ * interest of corresponding market.
1499
+ * precision: SPOT_BALANCE_PRECISION
1500
+ */
1501
+ scaledBalance: BN;
1502
+ /**
1503
+ * How many spot bids the user has open
1504
+ * precision: token mint precision
1505
+ */
1506
+ openBids: BN;
1507
+ /**
1508
+ * How many spot asks the user has open
1509
+ * precision: token mint precision
1510
+ */
1511
+ openAsks: BN;
1512
+ /**
1513
+ * The cumulative deposits/borrows a user has made into a market
1514
+ * precision: token mint precision
1515
+ */
1516
+ cumulativeDeposits: BN;
1517
+ /** The market index of the corresponding spot market */
1518
+ marketIndex: number;
1519
+ /** Whether the position is deposit or borrow */
1520
+ balanceType: SpotBalanceType;
1521
+ /** Number of open orders */
1522
+ openOrders: number;
1523
+ padding: Array<number>;
1524
+ }
1525
+ interface SpotPositionJSON {
1526
+ /**
1527
+ * The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow
1528
+ * interest of corresponding market.
1529
+ * precision: SPOT_BALANCE_PRECISION
1530
+ */
1531
+ scaledBalance: string;
1532
+ /**
1533
+ * How many spot bids the user has open
1534
+ * precision: token mint precision
1535
+ */
1536
+ openBids: string;
1537
+ /**
1538
+ * How many spot asks the user has open
1539
+ * precision: token mint precision
1540
+ */
1541
+ openAsks: string;
1542
+ /**
1543
+ * The cumulative deposits/borrows a user has made into a market
1544
+ * precision: token mint precision
1545
+ */
1546
+ cumulativeDeposits: string;
1547
+ /** The market index of the corresponding spot market */
1548
+ marketIndex: number;
1549
+ /** Whether the position is deposit or borrow */
1550
+ balanceType: SpotBalanceType;
1551
+ /** Number of open orders */
1552
+ openOrders: number;
1553
+ padding: Array<number>;
1554
+ }
1555
+
1556
+ interface DriftSpotMarket {
1557
+ pubkey: PublicKey;
1558
+ oracle: PublicKey;
1559
+ mint: PublicKey;
1560
+ decimals: number;
1561
+ cumulativeDepositInterest: BN;
1562
+ marketIndex: number;
1563
+ depositBalance: BN;
1564
+ borrowBalance: BN;
1565
+ cumulativeBorrowInterest: BN;
1566
+ optimalUtilization: number;
1567
+ optimalBorrowRate: number;
1568
+ maxBorrowRate: number;
1569
+ minBorrowRate: number;
1570
+ insuranceFund: {
1571
+ totalFactor: number;
1572
+ };
1573
+ }
1574
+ declare enum DriftSpotBalanceType {
1575
+ DEPOSIT = "deposit",
1576
+ BORROW = "borrow"
1577
+ }
1578
+ declare function isSpotBalanceTypeVariant(value: DriftSpotBalanceType, variant: "deposit" | "borrow"): boolean;
1579
+
1580
+ interface DriftUserJSON {
1581
+ authority: string;
1582
+ spotPositions: Array<SpotPositionJSON>;
1583
+ }
1584
+
1585
+ interface DriftUser {
1586
+ authority: PublicKey;
1587
+ spotPositions: Array<SpotPosition>;
1588
+ }
1589
+
1590
+ type DriftRewards = {
1591
+ oracle: PublicKey;
1592
+ marketIndex: number;
1593
+ spotMarket: PublicKey;
1594
+ mint: PublicKey;
1595
+ spotPosition: SpotPosition;
1596
+ };
1597
+ type DriftRewardsJSON = {
1598
+ oracle: string;
1599
+ marketIndex: number;
1600
+ spotMarket: string;
1601
+ mint: string;
1602
+ spotPosition: SpotPositionJSON;
1603
+ };
1604
+
1605
+ export { type PriceHeuristicJSON as $, type ReserveLiquidityFields as A, type ReserveCollateralFields as B, type CurvePointFields as C, type DriftSpotMarket as D, type ReserveConfigFields as E, type FeedResponse as F, type ReserveFeesFields as G, type HistoricalOracleData as H, type InsuranceFund as I, type BorrowRateCurveFields as J, type PriceHeuristicFields as K, type ScopeConfigurationFields as L, type SwitchboardConfigurationFields as M, type PythConfigurationFields as N, type ObligationRaw as O, type PoolBalance as P, type ReserveLiquidityJSON as Q, type ReserveRaw as R, type SpotPosition as S, type TokenInfoFields$1 as T, type ReserveCollateralJSON as U, type ReserveConfigJSON as V, type WithdrawalCapsFields as W, type ReserveFeesJSON as X, type BorrowRateCurveJSON as Y, type CurvePointJSON as Z, type TokenInfoJSON$1 as _, type DriftRewards as a, type ScopeConfigurationJSON as a0, type SwitchboardConfigurationJSON as a1, type PythConfigurationJSON as a2, type WithdrawalCapsJSON as a3, type ObligationLiquidityJSON as a4, type ObligationCollateralJSON as a5, type ObligationOrderJSON as a6, type ObligationCollateralFields as a7, type ObligationLiquidityFields as a8, type ObligationOrderFields as a9, type LastUpdateFields as aa, type BigFractionBytesFields as ab, type LastUpdateJSON as ac, type BigFractionBytesJSON as ad, type RewardPerTimeUnitPointFields as ae, type RewardScheduleCurveFields as af, type RewardScheduleCurveJSON as ag, type RewardPerTimeUnitPointJSON as ah, type UserFeesJSON as ai, type UserFeesFields as aj, isSpotBalanceTypeVariant as ak, type FeeTier as al, type FeeTierJSON as am, type OrderFillerRewardStructure as an, type OrderFillerRewardStructureJSON as ao, type PriceDivergenceGuardRails as ap, type PriceDivergenceGuardRailsJSON as aq, type ValidityGuardRails as ar, type ValidityGuardRailsJSON as as, type HistoricalOracleDataJSON as at, type HistoricalIndexDataJSON as au, type PoolBalanceJSON as av, type InsuranceFundJSON as aw, SpotBalanceType as ax, type SpotPositionJSON as ay, type FarmStateRaw as b, type DriftUser as c, type DriftUserStats as d, type ReserveJSON as e, type ObligationJSON as f, type FarmStateJSON as g, type DriftSpotMarketJSON as h, type DriftUserJSON as i, type DriftUserStatsJSON as j, type RewardInfoFields as k, type HistoricalIndexData as l, type FeeStructureJSON as m, type OracleGuardRailsJSON as n, type FeeStructure as o, type OracleGuardRails as p, type DriftRewardsJSON as q, DriftSpotBalanceType as r, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as s, type CurrentResult as t, type OracleSubmission as u, type PullFeedAccountData as v, type CrossbarSimulatePayload as w, switchboardAccountCoder as x, getSwitchboardProgram as y, decodeSwitchboardPullFeedData as z };