@reflectmoney/stable.ts 2.8.3 → 2.9.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/helpers/drift/accounts/index.d.ts +10 -0
- package/dist/helpers/drift/accounts/index.js +26 -0
- package/dist/helpers/drift/accounts/spotMarket.d.ts +541 -0
- package/dist/helpers/drift/accounts/spotMarket.js +213 -0
- package/dist/helpers/drift/accounts/user.d.ts +193 -0
- package/dist/helpers/drift/accounts/user.js +147 -0
- package/dist/helpers/drift/accounts/userStats.d.ts +165 -0
- package/dist/helpers/drift/accounts/userStats.js +137 -0
- package/dist/helpers/drift/index.d.ts +10 -0
- package/dist/helpers/drift/index.js +26 -0
- package/dist/helpers/drift/mappers.d.ts +14 -0
- package/dist/helpers/drift/mappers.js +137 -0
- package/dist/helpers/drift/types/aMM.d.ts +656 -0
- package/dist/helpers/drift/types/aMM.js +199 -0
- package/dist/helpers/drift/types/addAmmConstituentMappingDatum.d.ts +21 -0
- package/dist/helpers/drift/types/addAmmConstituentMappingDatum.js +30 -0
- package/dist/helpers/drift/types/ammCacheFixed.d.ts +17 -0
- package/dist/helpers/drift/types/ammCacheFixed.js +30 -0
- package/dist/helpers/drift/types/ammConstituentDatum.d.ts +27 -0
- package/dist/helpers/drift/types/ammConstituentDatum.js +34 -0
- package/dist/helpers/drift/types/ammConstituentMappingFixed.d.ts +18 -0
- package/dist/helpers/drift/types/ammConstituentMappingFixed.js +32 -0
- package/dist/helpers/drift/types/assetTier.d.ts +19 -0
- package/dist/helpers/drift/types/assetTier.js +31 -0
- package/dist/helpers/drift/types/assetType.d.ts +16 -0
- package/dist/helpers/drift/types/assetType.js +28 -0
- package/dist/helpers/drift/types/builderInfo.d.ts +17 -0
- package/dist/helpers/drift/types/builderInfo.js +30 -0
- package/dist/helpers/drift/types/cacheInfo.d.ts +59 -0
- package/dist/helpers/drift/types/cacheInfo.js +66 -0
- package/dist/helpers/drift/types/constituentCorrelationsFixed.d.ts +19 -0
- package/dist/helpers/drift/types/constituentCorrelationsFixed.js +32 -0
- package/dist/helpers/drift/types/constituentLpOperation.d.ts +17 -0
- package/dist/helpers/drift/types/constituentLpOperation.js +29 -0
- package/dist/helpers/drift/types/constituentSpotBalance.d.ts +48 -0
- package/dist/helpers/drift/types/constituentSpotBalance.js +35 -0
- package/dist/helpers/drift/types/constituentStatus.d.ts +16 -0
- package/dist/helpers/drift/types/constituentStatus.js +28 -0
- package/dist/helpers/drift/types/constituentTargetBaseFixed.d.ts +19 -0
- package/dist/helpers/drift/types/constituentTargetBaseFixed.js +32 -0
- package/dist/helpers/drift/types/contractTier.d.ts +20 -0
- package/dist/helpers/drift/types/contractTier.js +32 -0
- package/dist/helpers/drift/types/contractType.d.ts +17 -0
- package/dist/helpers/drift/types/contractType.js +29 -0
- package/dist/helpers/drift/types/depositDirection.d.ts +16 -0
- package/dist/helpers/drift/types/depositDirection.js +28 -0
- package/dist/helpers/drift/types/depositExplanation.d.ts +19 -0
- package/dist/helpers/drift/types/depositExplanation.js +31 -0
- package/dist/helpers/drift/types/driftAction.d.ts +29 -0
- package/dist/helpers/drift/types/driftAction.js +41 -0
- package/dist/helpers/drift/types/exchangeStatus.d.ts +22 -0
- package/dist/helpers/drift/types/exchangeStatus.js +34 -0
- package/dist/helpers/drift/types/featureBitFlags.d.ts +18 -0
- package/dist/helpers/drift/types/featureBitFlags.js +30 -0
- package/dist/helpers/drift/types/feeStructure.d.ts +24 -0
- package/dist/helpers/drift/types/feeStructure.js +33 -0
- package/dist/helpers/drift/types/feeTier.d.ts +22 -0
- package/dist/helpers/drift/types/feeTier.js +40 -0
- package/dist/helpers/drift/types/fillMode.d.ts +29 -0
- package/dist/helpers/drift/types/fillMode.js +52 -0
- package/dist/helpers/drift/types/fuelOverflowStatus.d.ts +15 -0
- package/dist/helpers/drift/types/fuelOverflowStatus.js +27 -0
- package/dist/helpers/drift/types/historicalIndexData.d.ts +35 -0
- package/dist/helpers/drift/types/historicalIndexData.js +34 -0
- package/dist/helpers/drift/types/historicalOracleData.d.ts +39 -0
- package/dist/helpers/drift/types/historicalOracleData.js +36 -0
- package/dist/helpers/drift/types/ifRebalanceConfigParams.d.ts +31 -0
- package/dist/helpers/drift/types/ifRebalanceConfigParams.js +40 -0
- package/dist/helpers/drift/types/index.d.ts +114 -0
- package/dist/helpers/drift/types/index.js +130 -0
- package/dist/helpers/drift/types/insuranceClaim.d.ts +63 -0
- package/dist/helpers/drift/types/insuranceClaim.js +34 -0
- package/dist/helpers/drift/types/insuranceFund.d.ts +33 -0
- package/dist/helpers/drift/types/insuranceFund.js +42 -0
- package/dist/helpers/drift/types/insuranceFundOperation.d.ts +18 -0
- package/dist/helpers/drift/types/insuranceFundOperation.js +30 -0
- package/dist/helpers/drift/types/lPAction.d.ts +18 -0
- package/dist/helpers/drift/types/lPAction.js +30 -0
- package/dist/helpers/drift/types/liquidateBorrowForPerpPnlRecord.d.ts +27 -0
- package/dist/helpers/drift/types/liquidateBorrowForPerpPnlRecord.js +36 -0
- package/dist/helpers/drift/types/liquidatePerpPnlForDepositRecord.d.ts +27 -0
- package/dist/helpers/drift/types/liquidatePerpPnlForDepositRecord.js +36 -0
- package/dist/helpers/drift/types/liquidatePerpRecord.d.ts +41 -0
- package/dist/helpers/drift/types/liquidatePerpRecord.js +44 -0
- package/dist/helpers/drift/types/liquidateSpotRecord.d.ts +33 -0
- package/dist/helpers/drift/types/liquidateSpotRecord.js +38 -0
- package/dist/helpers/drift/types/liquidationBitFlag.d.ts +15 -0
- package/dist/helpers/drift/types/liquidationBitFlag.js +27 -0
- package/dist/helpers/drift/types/liquidationMultiplierType.d.ts +16 -0
- package/dist/helpers/drift/types/liquidationMultiplierType.js +28 -0
- package/dist/helpers/drift/types/liquidationType.d.ts +20 -0
- package/dist/helpers/drift/types/liquidationType.js +32 -0
- package/dist/helpers/drift/types/logMode.d.ts +19 -0
- package/dist/helpers/drift/types/logMode.js +31 -0
- package/dist/helpers/drift/types/lpPoolFeatureBitFlags.d.ts +17 -0
- package/dist/helpers/drift/types/lpPoolFeatureBitFlags.js +29 -0
- package/dist/helpers/drift/types/lpStatus.d.ts +17 -0
- package/dist/helpers/drift/types/lpStatus.js +29 -0
- package/dist/helpers/drift/types/marginCalculationMode.d.ts +29 -0
- package/dist/helpers/drift/types/marginCalculationMode.js +55 -0
- package/dist/helpers/drift/types/marginMode.d.ts +17 -0
- package/dist/helpers/drift/types/marginMode.js +29 -0
- package/dist/helpers/drift/types/marginRequirementType.d.ts +17 -0
- package/dist/helpers/drift/types/marginRequirementType.js +29 -0
- package/dist/helpers/drift/types/marketIdentifier.d.ts +20 -0
- package/dist/helpers/drift/types/marketIdentifier.js +29 -0
- package/dist/helpers/drift/types/marketStatus.d.ts +23 -0
- package/dist/helpers/drift/types/marketStatus.js +35 -0
- package/dist/helpers/drift/types/marketType.d.ts +16 -0
- package/dist/helpers/drift/types/marketType.js +28 -0
- package/dist/helpers/drift/types/modifyOrderId.d.ts +24 -0
- package/dist/helpers/drift/types/modifyOrderId.js +50 -0
- package/dist/helpers/drift/types/modifyOrderParams.d.ts +44 -0
- package/dist/helpers/drift/types/modifyOrderParams.js +53 -0
- package/dist/helpers/drift/types/modifyOrderPolicy.d.ts +16 -0
- package/dist/helpers/drift/types/modifyOrderPolicy.js +28 -0
- package/dist/helpers/drift/types/oracleGuardRails.d.ts +20 -0
- package/dist/helpers/drift/types/oracleGuardRails.js +29 -0
- package/dist/helpers/drift/types/oracleSource.d.ts +30 -0
- package/dist/helpers/drift/types/oracleSource.js +42 -0
- package/dist/helpers/drift/types/oracleValidity.d.ts +39 -0
- package/dist/helpers/drift/types/oracleValidity.js +60 -0
- package/dist/helpers/drift/types/order.d.ts +178 -0
- package/dist/helpers/drift/types/order.js +77 -0
- package/dist/helpers/drift/types/orderAction.d.ts +19 -0
- package/dist/helpers/drift/types/orderAction.js +31 -0
- package/dist/helpers/drift/types/orderActionExplanation.d.ts +35 -0
- package/dist/helpers/drift/types/orderActionExplanation.js +47 -0
- package/dist/helpers/drift/types/orderBitFlag.d.ts +20 -0
- package/dist/helpers/drift/types/orderBitFlag.js +32 -0
- package/dist/helpers/drift/types/orderFillerRewardStructure.d.ts +21 -0
- package/dist/helpers/drift/types/orderFillerRewardStructure.js +30 -0
- package/dist/helpers/drift/types/orderParams.d.ts +50 -0
- package/dist/helpers/drift/types/orderParams.js +59 -0
- package/dist/helpers/drift/types/orderParamsBitFlag.d.ts +16 -0
- package/dist/helpers/drift/types/orderParamsBitFlag.js +28 -0
- package/dist/helpers/drift/types/orderStatus.d.ts +18 -0
- package/dist/helpers/drift/types/orderStatus.js +30 -0
- package/dist/helpers/drift/types/orderTriggerCondition.d.ts +18 -0
- package/dist/helpers/drift/types/orderTriggerCondition.js +30 -0
- package/dist/helpers/drift/types/orderType.d.ts +19 -0
- package/dist/helpers/drift/types/orderType.js +31 -0
- package/dist/helpers/drift/types/perpBankruptcyRecord.d.ts +27 -0
- package/dist/helpers/drift/types/perpBankruptcyRecord.js +36 -0
- package/dist/helpers/drift/types/perpFulfillmentMethod.d.ts +30 -0
- package/dist/helpers/drift/types/perpFulfillmentMethod.js +72 -0
- package/dist/helpers/drift/types/perpLpOperation.d.ts +16 -0
- package/dist/helpers/drift/types/perpLpOperation.js +28 -0
- package/dist/helpers/drift/types/perpOperation.d.ts +22 -0
- package/dist/helpers/drift/types/perpOperation.js +34 -0
- package/dist/helpers/drift/types/perpPosition.d.ts +149 -0
- package/dist/helpers/drift/types/perpPosition.js +56 -0
- package/dist/helpers/drift/types/placeAndTakeOrderSuccessCondition.d.ts +16 -0
- package/dist/helpers/drift/types/placeAndTakeOrderSuccessCondition.js +28 -0
- package/dist/helpers/drift/types/poolBalance.d.ts +33 -0
- package/dist/helpers/drift/types/poolBalance.js +30 -0
- package/dist/helpers/drift/types/positionDirection.d.ts +16 -0
- package/dist/helpers/drift/types/positionDirection.js +28 -0
- package/dist/helpers/drift/types/positionFlag.d.ts +17 -0
- package/dist/helpers/drift/types/positionFlag.js +29 -0
- package/dist/helpers/drift/types/positionUpdateType.d.ts +19 -0
- package/dist/helpers/drift/types/positionUpdateType.js +31 -0
- package/dist/helpers/drift/types/postOnlyParam.d.ts +18 -0
- package/dist/helpers/drift/types/postOnlyParam.js +30 -0
- package/dist/helpers/drift/types/prelaunchOracleParams.d.ts +21 -0
- package/dist/helpers/drift/types/prelaunchOracleParams.js +30 -0
- package/dist/helpers/drift/types/priceDivergenceGuardRails.d.ts +19 -0
- package/dist/helpers/drift/types/priceDivergenceGuardRails.js +28 -0
- package/dist/helpers/drift/types/referrerStatus.d.ts +17 -0
- package/dist/helpers/drift/types/referrerStatus.js +29 -0
- package/dist/helpers/drift/types/revenueShareEscrowFixed.d.ts +21 -0
- package/dist/helpers/drift/types/revenueShareEscrowFixed.js +38 -0
- package/dist/helpers/drift/types/revenueShareOrder.d.ts +80 -0
- package/dist/helpers/drift/types/revenueShareOrder.js +45 -0
- package/dist/helpers/drift/types/revenueShareOrderBitFlag.d.ts +18 -0
- package/dist/helpers/drift/types/revenueShareOrderBitFlag.js +30 -0
- package/dist/helpers/drift/types/settlePnlExplanation.d.ts +16 -0
- package/dist/helpers/drift/types/settlePnlExplanation.js +28 -0
- package/dist/helpers/drift/types/settlePnlMode.d.ts +16 -0
- package/dist/helpers/drift/types/settlePnlMode.js +28 -0
- package/dist/helpers/drift/types/settlementDirection.d.ts +17 -0
- package/dist/helpers/drift/types/settlementDirection.js +29 -0
- package/dist/helpers/drift/types/signatureVerificationError.d.ts +26 -0
- package/dist/helpers/drift/types/signatureVerificationError.js +38 -0
- package/dist/helpers/drift/types/signedMsgOrderId.d.ts +23 -0
- package/dist/helpers/drift/types/signedMsgOrderId.js +32 -0
- package/dist/helpers/drift/types/signedMsgOrderParamsDelegateMessage.d.ts +36 -0
- package/dist/helpers/drift/types/signedMsgOrderParamsDelegateMessage.js +57 -0
- package/dist/helpers/drift/types/signedMsgOrderParamsMessage.d.ts +36 -0
- package/dist/helpers/drift/types/signedMsgOrderParamsMessage.js +57 -0
- package/dist/helpers/drift/types/signedMsgTriggerOrderParams.d.ts +19 -0
- package/dist/helpers/drift/types/signedMsgTriggerOrderParams.js +28 -0
- package/dist/helpers/drift/types/signedMsgUserOrdersFixed.d.ts +17 -0
- package/dist/helpers/drift/types/signedMsgUserOrdersFixed.js +30 -0
- package/dist/helpers/drift/types/spotBalanceType.d.ts +16 -0
- package/dist/helpers/drift/types/spotBalanceType.js +28 -0
- package/dist/helpers/drift/types/spotBankruptcyRecord.d.ts +23 -0
- package/dist/helpers/drift/types/spotBankruptcyRecord.js +32 -0
- package/dist/helpers/drift/types/spotFulfillmentConfigStatus.d.ts +16 -0
- package/dist/helpers/drift/types/spotFulfillmentConfigStatus.js +28 -0
- package/dist/helpers/drift/types/spotFulfillmentMethod.d.ts +23 -0
- package/dist/helpers/drift/types/spotFulfillmentMethod.js +48 -0
- package/dist/helpers/drift/types/spotFulfillmentType.d.ts +18 -0
- package/dist/helpers/drift/types/spotFulfillmentType.js +30 -0
- package/dist/helpers/drift/types/spotOperation.d.ts +19 -0
- package/dist/helpers/drift/types/spotOperation.js +31 -0
- package/dist/helpers/drift/types/spotPosition.d.ts +72 -0
- package/dist/helpers/drift/types/spotPosition.js +41 -0
- package/dist/helpers/drift/types/stakeAction.d.ts +21 -0
- package/dist/helpers/drift/types/stakeAction.js +33 -0
- package/dist/helpers/drift/types/swapDirection.d.ts +16 -0
- package/dist/helpers/drift/types/swapDirection.js +28 -0
- package/dist/helpers/drift/types/swapReduceOnly.d.ts +16 -0
- package/dist/helpers/drift/types/swapReduceOnly.js +28 -0
- package/dist/helpers/drift/types/targetsDatum.d.ts +25 -0
- package/dist/helpers/drift/types/targetsDatum.js +34 -0
- package/dist/helpers/drift/types/tokenProgramFlag.d.ts +16 -0
- package/dist/helpers/drift/types/tokenProgramFlag.js +28 -0
- package/dist/helpers/drift/types/twapPeriod.d.ts +16 -0
- package/dist/helpers/drift/types/twapPeriod.js +28 -0
- package/dist/helpers/drift/types/userFees.d.ts +75 -0
- package/dist/helpers/drift/types/userFees.js +36 -0
- package/dist/helpers/drift/types/userStatsPausedOperations.d.ts +17 -0
- package/dist/helpers/drift/types/userStatsPausedOperations.js +29 -0
- package/dist/helpers/drift/types/userStatus.d.ts +19 -0
- package/dist/helpers/drift/types/userStatus.js +31 -0
- package/dist/helpers/drift/types/validityGuardRails.d.ts +23 -0
- package/dist/helpers/drift/types/validityGuardRails.js +32 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +17 -0
- package/dist/stablecoins/UsdcPlusStablecoin.d.ts +2 -3
- package/dist/stablecoins/UsdcPlusStablecoin.js +22 -47
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun Codama to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/codama-idl/codama
|
|
8
|
+
*/
|
|
9
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
10
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.SPOT_MARKET_DISCRIMINATOR = void 0;
|
|
20
|
+
exports.getSpotMarketDiscriminatorBytes = getSpotMarketDiscriminatorBytes;
|
|
21
|
+
exports.getSpotMarketEncoder = getSpotMarketEncoder;
|
|
22
|
+
exports.getSpotMarketDecoder = getSpotMarketDecoder;
|
|
23
|
+
exports.getSpotMarketCodec = getSpotMarketCodec;
|
|
24
|
+
exports.decodeSpotMarket = decodeSpotMarket;
|
|
25
|
+
exports.fetchSpotMarket = fetchSpotMarket;
|
|
26
|
+
exports.fetchMaybeSpotMarket = fetchMaybeSpotMarket;
|
|
27
|
+
exports.fetchAllSpotMarket = fetchAllSpotMarket;
|
|
28
|
+
exports.fetchAllMaybeSpotMarket = fetchAllMaybeSpotMarket;
|
|
29
|
+
exports.getSpotMarketSize = getSpotMarketSize;
|
|
30
|
+
const kit_1 = require("@solana/kit");
|
|
31
|
+
const types_1 = require("../types");
|
|
32
|
+
exports.SPOT_MARKET_DISCRIMINATOR = new Uint8Array([
|
|
33
|
+
100, 177, 8, 107, 168, 65, 65, 39,
|
|
34
|
+
]);
|
|
35
|
+
function getSpotMarketDiscriminatorBytes() {
|
|
36
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.SPOT_MARKET_DISCRIMINATOR);
|
|
37
|
+
}
|
|
38
|
+
/** Gets the encoder for {@link SpotMarketArgs} account data. */
|
|
39
|
+
function getSpotMarketEncoder() {
|
|
40
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
41
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
42
|
+
["pubkey", (0, kit_1.getAddressEncoder)()],
|
|
43
|
+
["oracle", (0, kit_1.getAddressEncoder)()],
|
|
44
|
+
["mint", (0, kit_1.getAddressEncoder)()],
|
|
45
|
+
["vault", (0, kit_1.getAddressEncoder)()],
|
|
46
|
+
["name", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
|
|
47
|
+
["historicalOracleData", (0, types_1.getHistoricalOracleDataEncoder)()],
|
|
48
|
+
["historicalIndexData", (0, types_1.getHistoricalIndexDataEncoder)()],
|
|
49
|
+
["revenuePool", (0, types_1.getPoolBalanceEncoder)()],
|
|
50
|
+
["spotFeePool", (0, types_1.getPoolBalanceEncoder)()],
|
|
51
|
+
["insuranceFund", (0, types_1.getInsuranceFundEncoder)()],
|
|
52
|
+
["totalSpotFee", (0, kit_1.getU128Encoder)()],
|
|
53
|
+
["depositBalance", (0, kit_1.getU128Encoder)()],
|
|
54
|
+
["borrowBalance", (0, kit_1.getU128Encoder)()],
|
|
55
|
+
["cumulativeDepositInterest", (0, kit_1.getU128Encoder)()],
|
|
56
|
+
["cumulativeBorrowInterest", (0, kit_1.getU128Encoder)()],
|
|
57
|
+
["totalSocialLoss", (0, kit_1.getU128Encoder)()],
|
|
58
|
+
["totalQuoteSocialLoss", (0, kit_1.getU128Encoder)()],
|
|
59
|
+
["withdrawGuardThreshold", (0, kit_1.getU64Encoder)()],
|
|
60
|
+
["maxTokenDeposits", (0, kit_1.getU64Encoder)()],
|
|
61
|
+
["depositTokenTwap", (0, kit_1.getU64Encoder)()],
|
|
62
|
+
["borrowTokenTwap", (0, kit_1.getU64Encoder)()],
|
|
63
|
+
["utilizationTwap", (0, kit_1.getU64Encoder)()],
|
|
64
|
+
["lastInterestTs", (0, kit_1.getU64Encoder)()],
|
|
65
|
+
["lastTwapTs", (0, kit_1.getU64Encoder)()],
|
|
66
|
+
["expiryTs", (0, kit_1.getI64Encoder)()],
|
|
67
|
+
["orderStepSize", (0, kit_1.getU64Encoder)()],
|
|
68
|
+
["orderTickSize", (0, kit_1.getU64Encoder)()],
|
|
69
|
+
["minOrderSize", (0, kit_1.getU64Encoder)()],
|
|
70
|
+
["maxPositionSize", (0, kit_1.getU64Encoder)()],
|
|
71
|
+
["nextFillRecordId", (0, kit_1.getU64Encoder)()],
|
|
72
|
+
["nextDepositRecordId", (0, kit_1.getU64Encoder)()],
|
|
73
|
+
["initialAssetWeight", (0, kit_1.getU32Encoder)()],
|
|
74
|
+
["maintenanceAssetWeight", (0, kit_1.getU32Encoder)()],
|
|
75
|
+
["initialLiabilityWeight", (0, kit_1.getU32Encoder)()],
|
|
76
|
+
["maintenanceLiabilityWeight", (0, kit_1.getU32Encoder)()],
|
|
77
|
+
["imfFactor", (0, kit_1.getU32Encoder)()],
|
|
78
|
+
["liquidatorFee", (0, kit_1.getU32Encoder)()],
|
|
79
|
+
["ifLiquidationFee", (0, kit_1.getU32Encoder)()],
|
|
80
|
+
["optimalUtilization", (0, kit_1.getU32Encoder)()],
|
|
81
|
+
["optimalBorrowRate", (0, kit_1.getU32Encoder)()],
|
|
82
|
+
["maxBorrowRate", (0, kit_1.getU32Encoder)()],
|
|
83
|
+
["decimals", (0, kit_1.getU32Encoder)()],
|
|
84
|
+
["marketIndex", (0, kit_1.getU16Encoder)()],
|
|
85
|
+
["ordersEnabled", (0, kit_1.getBooleanEncoder)()],
|
|
86
|
+
["oracleSource", (0, types_1.getOracleSourceEncoder)()],
|
|
87
|
+
["status", (0, types_1.getMarketStatusEncoder)()],
|
|
88
|
+
["assetTier", (0, types_1.getAssetTierEncoder)()],
|
|
89
|
+
["pausedOperations", (0, kit_1.getU8Encoder)()],
|
|
90
|
+
["ifPausedOperations", (0, kit_1.getU8Encoder)()],
|
|
91
|
+
["feeAdjustment", (0, kit_1.getI16Encoder)()],
|
|
92
|
+
["maxTokenBorrowsFraction", (0, kit_1.getU16Encoder)()],
|
|
93
|
+
["flashLoanAmount", (0, kit_1.getU64Encoder)()],
|
|
94
|
+
["flashLoanInitialTokenAmount", (0, kit_1.getU64Encoder)()],
|
|
95
|
+
["totalSwapFee", (0, kit_1.getU64Encoder)()],
|
|
96
|
+
["scaleInitialAssetWeightStart", (0, kit_1.getU64Encoder)()],
|
|
97
|
+
["minBorrowRate", (0, kit_1.getU8Encoder)()],
|
|
98
|
+
["fuelBoostDeposits", (0, kit_1.getU8Encoder)()],
|
|
99
|
+
["fuelBoostBorrows", (0, kit_1.getU8Encoder)()],
|
|
100
|
+
["fuelBoostTaker", (0, kit_1.getU8Encoder)()],
|
|
101
|
+
["fuelBoostMaker", (0, kit_1.getU8Encoder)()],
|
|
102
|
+
["fuelBoostInsurance", (0, kit_1.getU8Encoder)()],
|
|
103
|
+
["tokenProgramFlag", (0, kit_1.getU8Encoder)()],
|
|
104
|
+
["poolId", (0, kit_1.getU8Encoder)()],
|
|
105
|
+
["padding", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 40)],
|
|
106
|
+
]), (value) => (Object.assign(Object.assign({}, value), { discriminator: exports.SPOT_MARKET_DISCRIMINATOR })));
|
|
107
|
+
}
|
|
108
|
+
/** Gets the decoder for {@link SpotMarket} account data. */
|
|
109
|
+
function getSpotMarketDecoder() {
|
|
110
|
+
return (0, kit_1.getStructDecoder)([
|
|
111
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
112
|
+
["pubkey", (0, kit_1.getAddressDecoder)()],
|
|
113
|
+
["oracle", (0, kit_1.getAddressDecoder)()],
|
|
114
|
+
["mint", (0, kit_1.getAddressDecoder)()],
|
|
115
|
+
["vault", (0, kit_1.getAddressDecoder)()],
|
|
116
|
+
["name", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
|
|
117
|
+
["historicalOracleData", (0, types_1.getHistoricalOracleDataDecoder)()],
|
|
118
|
+
["historicalIndexData", (0, types_1.getHistoricalIndexDataDecoder)()],
|
|
119
|
+
["revenuePool", (0, types_1.getPoolBalanceDecoder)()],
|
|
120
|
+
["spotFeePool", (0, types_1.getPoolBalanceDecoder)()],
|
|
121
|
+
["insuranceFund", (0, types_1.getInsuranceFundDecoder)()],
|
|
122
|
+
["totalSpotFee", (0, kit_1.getU128Decoder)()],
|
|
123
|
+
["depositBalance", (0, kit_1.getU128Decoder)()],
|
|
124
|
+
["borrowBalance", (0, kit_1.getU128Decoder)()],
|
|
125
|
+
["cumulativeDepositInterest", (0, kit_1.getU128Decoder)()],
|
|
126
|
+
["cumulativeBorrowInterest", (0, kit_1.getU128Decoder)()],
|
|
127
|
+
["totalSocialLoss", (0, kit_1.getU128Decoder)()],
|
|
128
|
+
["totalQuoteSocialLoss", (0, kit_1.getU128Decoder)()],
|
|
129
|
+
["withdrawGuardThreshold", (0, kit_1.getU64Decoder)()],
|
|
130
|
+
["maxTokenDeposits", (0, kit_1.getU64Decoder)()],
|
|
131
|
+
["depositTokenTwap", (0, kit_1.getU64Decoder)()],
|
|
132
|
+
["borrowTokenTwap", (0, kit_1.getU64Decoder)()],
|
|
133
|
+
["utilizationTwap", (0, kit_1.getU64Decoder)()],
|
|
134
|
+
["lastInterestTs", (0, kit_1.getU64Decoder)()],
|
|
135
|
+
["lastTwapTs", (0, kit_1.getU64Decoder)()],
|
|
136
|
+
["expiryTs", (0, kit_1.getI64Decoder)()],
|
|
137
|
+
["orderStepSize", (0, kit_1.getU64Decoder)()],
|
|
138
|
+
["orderTickSize", (0, kit_1.getU64Decoder)()],
|
|
139
|
+
["minOrderSize", (0, kit_1.getU64Decoder)()],
|
|
140
|
+
["maxPositionSize", (0, kit_1.getU64Decoder)()],
|
|
141
|
+
["nextFillRecordId", (0, kit_1.getU64Decoder)()],
|
|
142
|
+
["nextDepositRecordId", (0, kit_1.getU64Decoder)()],
|
|
143
|
+
["initialAssetWeight", (0, kit_1.getU32Decoder)()],
|
|
144
|
+
["maintenanceAssetWeight", (0, kit_1.getU32Decoder)()],
|
|
145
|
+
["initialLiabilityWeight", (0, kit_1.getU32Decoder)()],
|
|
146
|
+
["maintenanceLiabilityWeight", (0, kit_1.getU32Decoder)()],
|
|
147
|
+
["imfFactor", (0, kit_1.getU32Decoder)()],
|
|
148
|
+
["liquidatorFee", (0, kit_1.getU32Decoder)()],
|
|
149
|
+
["ifLiquidationFee", (0, kit_1.getU32Decoder)()],
|
|
150
|
+
["optimalUtilization", (0, kit_1.getU32Decoder)()],
|
|
151
|
+
["optimalBorrowRate", (0, kit_1.getU32Decoder)()],
|
|
152
|
+
["maxBorrowRate", (0, kit_1.getU32Decoder)()],
|
|
153
|
+
["decimals", (0, kit_1.getU32Decoder)()],
|
|
154
|
+
["marketIndex", (0, kit_1.getU16Decoder)()],
|
|
155
|
+
["ordersEnabled", (0, kit_1.getBooleanDecoder)()],
|
|
156
|
+
["oracleSource", (0, types_1.getOracleSourceDecoder)()],
|
|
157
|
+
["status", (0, types_1.getMarketStatusDecoder)()],
|
|
158
|
+
["assetTier", (0, types_1.getAssetTierDecoder)()],
|
|
159
|
+
["pausedOperations", (0, kit_1.getU8Decoder)()],
|
|
160
|
+
["ifPausedOperations", (0, kit_1.getU8Decoder)()],
|
|
161
|
+
["feeAdjustment", (0, kit_1.getI16Decoder)()],
|
|
162
|
+
["maxTokenBorrowsFraction", (0, kit_1.getU16Decoder)()],
|
|
163
|
+
["flashLoanAmount", (0, kit_1.getU64Decoder)()],
|
|
164
|
+
["flashLoanInitialTokenAmount", (0, kit_1.getU64Decoder)()],
|
|
165
|
+
["totalSwapFee", (0, kit_1.getU64Decoder)()],
|
|
166
|
+
["scaleInitialAssetWeightStart", (0, kit_1.getU64Decoder)()],
|
|
167
|
+
["minBorrowRate", (0, kit_1.getU8Decoder)()],
|
|
168
|
+
["fuelBoostDeposits", (0, kit_1.getU8Decoder)()],
|
|
169
|
+
["fuelBoostBorrows", (0, kit_1.getU8Decoder)()],
|
|
170
|
+
["fuelBoostTaker", (0, kit_1.getU8Decoder)()],
|
|
171
|
+
["fuelBoostMaker", (0, kit_1.getU8Decoder)()],
|
|
172
|
+
["fuelBoostInsurance", (0, kit_1.getU8Decoder)()],
|
|
173
|
+
["tokenProgramFlag", (0, kit_1.getU8Decoder)()],
|
|
174
|
+
["poolId", (0, kit_1.getU8Decoder)()],
|
|
175
|
+
["padding", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 40)],
|
|
176
|
+
]);
|
|
177
|
+
}
|
|
178
|
+
/** Gets the codec for {@link SpotMarket} account data. */
|
|
179
|
+
function getSpotMarketCodec() {
|
|
180
|
+
return (0, kit_1.combineCodec)(getSpotMarketEncoder(), getSpotMarketDecoder());
|
|
181
|
+
}
|
|
182
|
+
function decodeSpotMarket(encodedAccount) {
|
|
183
|
+
return (0, kit_1.decodeAccount)(encodedAccount, getSpotMarketDecoder());
|
|
184
|
+
}
|
|
185
|
+
function fetchSpotMarket(rpc, address, config) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const maybeAccount = yield fetchMaybeSpotMarket(rpc, address, config);
|
|
188
|
+
(0, kit_1.assertAccountExists)(maybeAccount);
|
|
189
|
+
return maybeAccount;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function fetchMaybeSpotMarket(rpc, address, config) {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
const maybeAccount = yield (0, kit_1.fetchEncodedAccount)(rpc, address, config);
|
|
195
|
+
return decodeSpotMarket(maybeAccount);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function fetchAllSpotMarket(rpc, addresses, config) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const maybeAccounts = yield fetchAllMaybeSpotMarket(rpc, addresses, config);
|
|
201
|
+
(0, kit_1.assertAccountsExist)(maybeAccounts);
|
|
202
|
+
return maybeAccounts;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function fetchAllMaybeSpotMarket(rpc, addresses, config) {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
const maybeAccounts = yield (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
|
|
208
|
+
return maybeAccounts.map((maybeAccount) => decodeSpotMarket(maybeAccount));
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function getSpotMarketSize() {
|
|
212
|
+
return 776;
|
|
213
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
+
import { type MarginMode, type MarginModeArgs, type Order, type OrderArgs, type PerpPosition, type PerpPositionArgs, type SpotPosition, type SpotPositionArgs } from "../types";
|
|
10
|
+
export declare const USER_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getUserDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type User = {
|
|
13
|
+
discriminator: ReadonlyUint8Array;
|
|
14
|
+
/** The owner/authority of the account */
|
|
15
|
+
authority: Address;
|
|
16
|
+
/** An addresses that can control the account on the authority's behalf. Has limited power, cant withdraw */
|
|
17
|
+
delegate: Address;
|
|
18
|
+
/** Encoded display name e.g. "toly" */
|
|
19
|
+
name: ReadonlyUint8Array;
|
|
20
|
+
/** The user's spot positions */
|
|
21
|
+
spotPositions: Array<SpotPosition>;
|
|
22
|
+
/** The user's perp positions */
|
|
23
|
+
perpPositions: Array<PerpPosition>;
|
|
24
|
+
/** The user's orders */
|
|
25
|
+
orders: Array<Order>;
|
|
26
|
+
/** The last time the user added perp lp positions */
|
|
27
|
+
lastAddPerpLpSharesTs: bigint;
|
|
28
|
+
/**
|
|
29
|
+
* The total values of deposits the user has made
|
|
30
|
+
* precision: QUOTE_PRECISION
|
|
31
|
+
*/
|
|
32
|
+
totalDeposits: bigint;
|
|
33
|
+
/**
|
|
34
|
+
* The total values of withdrawals the user has made
|
|
35
|
+
* precision: QUOTE_PRECISION
|
|
36
|
+
*/
|
|
37
|
+
totalWithdraws: bigint;
|
|
38
|
+
/**
|
|
39
|
+
* The total socialized loss the users has incurred upon the protocol
|
|
40
|
+
* precision: QUOTE_PRECISION
|
|
41
|
+
*/
|
|
42
|
+
totalSocialLoss: bigint;
|
|
43
|
+
/**
|
|
44
|
+
* Fees (taker fees, maker rebate, referrer reward, filler reward) and pnl for perps
|
|
45
|
+
* precision: QUOTE_PRECISION
|
|
46
|
+
*/
|
|
47
|
+
settledPerpPnl: bigint;
|
|
48
|
+
/**
|
|
49
|
+
* Fees (taker fees, maker rebate, filler reward) for spot
|
|
50
|
+
* precision: QUOTE_PRECISION
|
|
51
|
+
*/
|
|
52
|
+
cumulativeSpotFees: bigint;
|
|
53
|
+
/**
|
|
54
|
+
* Cumulative funding paid/received for perps
|
|
55
|
+
* precision: QUOTE_PRECISION
|
|
56
|
+
*/
|
|
57
|
+
cumulativePerpFunding: bigint;
|
|
58
|
+
/**
|
|
59
|
+
* The amount of margin freed during liquidation. Used to force the liquidation to occur over a period of time
|
|
60
|
+
* Defaults to zero when not being liquidated
|
|
61
|
+
* precision: QUOTE_PRECISION
|
|
62
|
+
*/
|
|
63
|
+
liquidationMarginFreed: bigint;
|
|
64
|
+
/** The last slot a user was active. Used to determine if a user is idle */
|
|
65
|
+
lastActiveSlot: bigint;
|
|
66
|
+
/** Every user order has an order id. This is the next order id to be used */
|
|
67
|
+
nextOrderId: number;
|
|
68
|
+
/** Custom max initial margin ratio for the user */
|
|
69
|
+
maxMarginRatio: number;
|
|
70
|
+
/** The next liquidation id to be used for user */
|
|
71
|
+
nextLiquidationId: number;
|
|
72
|
+
/** The sub account id for this user */
|
|
73
|
+
subAccountId: number;
|
|
74
|
+
/** Whether the user is active, being liquidated or bankrupt */
|
|
75
|
+
status: number;
|
|
76
|
+
/** Whether the user has enabled margin trading */
|
|
77
|
+
isMarginTradingEnabled: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* User is idle if they haven't interacted with the protocol in 1 week and they have no orders, perp positions or borrows
|
|
80
|
+
* Off-chain keeper bots can ignore users that are idle
|
|
81
|
+
*/
|
|
82
|
+
idle: boolean;
|
|
83
|
+
/** number of open orders */
|
|
84
|
+
openOrders: number;
|
|
85
|
+
/** Whether or not user has open order */
|
|
86
|
+
hasOpenOrder: boolean;
|
|
87
|
+
/** number of open orders with auction */
|
|
88
|
+
openAuctions: number;
|
|
89
|
+
/** Whether or not user has open order with auction */
|
|
90
|
+
hasOpenAuction: boolean;
|
|
91
|
+
marginMode: MarginMode;
|
|
92
|
+
poolId: number;
|
|
93
|
+
padding1: ReadonlyUint8Array;
|
|
94
|
+
lastFuelBonusUpdateTs: number;
|
|
95
|
+
padding: ReadonlyUint8Array;
|
|
96
|
+
};
|
|
97
|
+
export type UserArgs = {
|
|
98
|
+
/** The owner/authority of the account */
|
|
99
|
+
authority: Address;
|
|
100
|
+
/** An addresses that can control the account on the authority's behalf. Has limited power, cant withdraw */
|
|
101
|
+
delegate: Address;
|
|
102
|
+
/** Encoded display name e.g. "toly" */
|
|
103
|
+
name: ReadonlyUint8Array;
|
|
104
|
+
/** The user's spot positions */
|
|
105
|
+
spotPositions: Array<SpotPositionArgs>;
|
|
106
|
+
/** The user's perp positions */
|
|
107
|
+
perpPositions: Array<PerpPositionArgs>;
|
|
108
|
+
/** The user's orders */
|
|
109
|
+
orders: Array<OrderArgs>;
|
|
110
|
+
/** The last time the user added perp lp positions */
|
|
111
|
+
lastAddPerpLpSharesTs: number | bigint;
|
|
112
|
+
/**
|
|
113
|
+
* The total values of deposits the user has made
|
|
114
|
+
* precision: QUOTE_PRECISION
|
|
115
|
+
*/
|
|
116
|
+
totalDeposits: number | bigint;
|
|
117
|
+
/**
|
|
118
|
+
* The total values of withdrawals the user has made
|
|
119
|
+
* precision: QUOTE_PRECISION
|
|
120
|
+
*/
|
|
121
|
+
totalWithdraws: number | bigint;
|
|
122
|
+
/**
|
|
123
|
+
* The total socialized loss the users has incurred upon the protocol
|
|
124
|
+
* precision: QUOTE_PRECISION
|
|
125
|
+
*/
|
|
126
|
+
totalSocialLoss: number | bigint;
|
|
127
|
+
/**
|
|
128
|
+
* Fees (taker fees, maker rebate, referrer reward, filler reward) and pnl for perps
|
|
129
|
+
* precision: QUOTE_PRECISION
|
|
130
|
+
*/
|
|
131
|
+
settledPerpPnl: number | bigint;
|
|
132
|
+
/**
|
|
133
|
+
* Fees (taker fees, maker rebate, filler reward) for spot
|
|
134
|
+
* precision: QUOTE_PRECISION
|
|
135
|
+
*/
|
|
136
|
+
cumulativeSpotFees: number | bigint;
|
|
137
|
+
/**
|
|
138
|
+
* Cumulative funding paid/received for perps
|
|
139
|
+
* precision: QUOTE_PRECISION
|
|
140
|
+
*/
|
|
141
|
+
cumulativePerpFunding: number | bigint;
|
|
142
|
+
/**
|
|
143
|
+
* The amount of margin freed during liquidation. Used to force the liquidation to occur over a period of time
|
|
144
|
+
* Defaults to zero when not being liquidated
|
|
145
|
+
* precision: QUOTE_PRECISION
|
|
146
|
+
*/
|
|
147
|
+
liquidationMarginFreed: number | bigint;
|
|
148
|
+
/** The last slot a user was active. Used to determine if a user is idle */
|
|
149
|
+
lastActiveSlot: number | bigint;
|
|
150
|
+
/** Every user order has an order id. This is the next order id to be used */
|
|
151
|
+
nextOrderId: number;
|
|
152
|
+
/** Custom max initial margin ratio for the user */
|
|
153
|
+
maxMarginRatio: number;
|
|
154
|
+
/** The next liquidation id to be used for user */
|
|
155
|
+
nextLiquidationId: number;
|
|
156
|
+
/** The sub account id for this user */
|
|
157
|
+
subAccountId: number;
|
|
158
|
+
/** Whether the user is active, being liquidated or bankrupt */
|
|
159
|
+
status: number;
|
|
160
|
+
/** Whether the user has enabled margin trading */
|
|
161
|
+
isMarginTradingEnabled: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* User is idle if they haven't interacted with the protocol in 1 week and they have no orders, perp positions or borrows
|
|
164
|
+
* Off-chain keeper bots can ignore users that are idle
|
|
165
|
+
*/
|
|
166
|
+
idle: boolean;
|
|
167
|
+
/** number of open orders */
|
|
168
|
+
openOrders: number;
|
|
169
|
+
/** Whether or not user has open order */
|
|
170
|
+
hasOpenOrder: boolean;
|
|
171
|
+
/** number of open orders with auction */
|
|
172
|
+
openAuctions: number;
|
|
173
|
+
/** Whether or not user has open order with auction */
|
|
174
|
+
hasOpenAuction: boolean;
|
|
175
|
+
marginMode: MarginModeArgs;
|
|
176
|
+
poolId: number;
|
|
177
|
+
padding1: ReadonlyUint8Array;
|
|
178
|
+
lastFuelBonusUpdateTs: number;
|
|
179
|
+
padding: ReadonlyUint8Array;
|
|
180
|
+
};
|
|
181
|
+
/** Gets the encoder for {@link UserArgs} account data. */
|
|
182
|
+
export declare function getUserEncoder(): FixedSizeEncoder<UserArgs>;
|
|
183
|
+
/** Gets the decoder for {@link User} account data. */
|
|
184
|
+
export declare function getUserDecoder(): FixedSizeDecoder<User>;
|
|
185
|
+
/** Gets the codec for {@link User} account data. */
|
|
186
|
+
export declare function getUserCodec(): FixedSizeCodec<UserArgs, User>;
|
|
187
|
+
export declare function decodeUser<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<User, TAddress>;
|
|
188
|
+
export declare function decodeUser<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<User, TAddress>;
|
|
189
|
+
export declare function fetchUser<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<User, TAddress>>;
|
|
190
|
+
export declare function fetchMaybeUser<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<User, TAddress>>;
|
|
191
|
+
export declare function fetchAllUser(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<User>[]>;
|
|
192
|
+
export declare function fetchAllMaybeUser(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<User>[]>;
|
|
193
|
+
export declare function getUserSize(): number;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun Codama to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/codama-idl/codama
|
|
8
|
+
*/
|
|
9
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
10
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.USER_DISCRIMINATOR = void 0;
|
|
20
|
+
exports.getUserDiscriminatorBytes = getUserDiscriminatorBytes;
|
|
21
|
+
exports.getUserEncoder = getUserEncoder;
|
|
22
|
+
exports.getUserDecoder = getUserDecoder;
|
|
23
|
+
exports.getUserCodec = getUserCodec;
|
|
24
|
+
exports.decodeUser = decodeUser;
|
|
25
|
+
exports.fetchUser = fetchUser;
|
|
26
|
+
exports.fetchMaybeUser = fetchMaybeUser;
|
|
27
|
+
exports.fetchAllUser = fetchAllUser;
|
|
28
|
+
exports.fetchAllMaybeUser = fetchAllMaybeUser;
|
|
29
|
+
exports.getUserSize = getUserSize;
|
|
30
|
+
const kit_1 = require("@solana/kit");
|
|
31
|
+
const types_1 = require("../types");
|
|
32
|
+
exports.USER_DISCRIMINATOR = new Uint8Array([
|
|
33
|
+
159, 117, 95, 227, 239, 151, 58, 236,
|
|
34
|
+
]);
|
|
35
|
+
function getUserDiscriminatorBytes() {
|
|
36
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.USER_DISCRIMINATOR);
|
|
37
|
+
}
|
|
38
|
+
/** Gets the encoder for {@link UserArgs} account data. */
|
|
39
|
+
function getUserEncoder() {
|
|
40
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
41
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
42
|
+
["authority", (0, kit_1.getAddressEncoder)()],
|
|
43
|
+
["delegate", (0, kit_1.getAddressEncoder)()],
|
|
44
|
+
["name", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
|
|
45
|
+
["spotPositions", (0, kit_1.getArrayEncoder)((0, types_1.getSpotPositionEncoder)(), { size: 8 })],
|
|
46
|
+
["perpPositions", (0, kit_1.getArrayEncoder)((0, types_1.getPerpPositionEncoder)(), { size: 8 })],
|
|
47
|
+
["orders", (0, kit_1.getArrayEncoder)((0, types_1.getOrderEncoder)(), { size: 32 })],
|
|
48
|
+
["lastAddPerpLpSharesTs", (0, kit_1.getI64Encoder)()],
|
|
49
|
+
["totalDeposits", (0, kit_1.getU64Encoder)()],
|
|
50
|
+
["totalWithdraws", (0, kit_1.getU64Encoder)()],
|
|
51
|
+
["totalSocialLoss", (0, kit_1.getU64Encoder)()],
|
|
52
|
+
["settledPerpPnl", (0, kit_1.getI64Encoder)()],
|
|
53
|
+
["cumulativeSpotFees", (0, kit_1.getI64Encoder)()],
|
|
54
|
+
["cumulativePerpFunding", (0, kit_1.getI64Encoder)()],
|
|
55
|
+
["liquidationMarginFreed", (0, kit_1.getU64Encoder)()],
|
|
56
|
+
["lastActiveSlot", (0, kit_1.getU64Encoder)()],
|
|
57
|
+
["nextOrderId", (0, kit_1.getU32Encoder)()],
|
|
58
|
+
["maxMarginRatio", (0, kit_1.getU32Encoder)()],
|
|
59
|
+
["nextLiquidationId", (0, kit_1.getU16Encoder)()],
|
|
60
|
+
["subAccountId", (0, kit_1.getU16Encoder)()],
|
|
61
|
+
["status", (0, kit_1.getU8Encoder)()],
|
|
62
|
+
["isMarginTradingEnabled", (0, kit_1.getBooleanEncoder)()],
|
|
63
|
+
["idle", (0, kit_1.getBooleanEncoder)()],
|
|
64
|
+
["openOrders", (0, kit_1.getU8Encoder)()],
|
|
65
|
+
["hasOpenOrder", (0, kit_1.getBooleanEncoder)()],
|
|
66
|
+
["openAuctions", (0, kit_1.getU8Encoder)()],
|
|
67
|
+
["hasOpenAuction", (0, kit_1.getBooleanEncoder)()],
|
|
68
|
+
["marginMode", (0, types_1.getMarginModeEncoder)()],
|
|
69
|
+
["poolId", (0, kit_1.getU8Encoder)()],
|
|
70
|
+
["padding1", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 3)],
|
|
71
|
+
["lastFuelBonusUpdateTs", (0, kit_1.getU32Encoder)()],
|
|
72
|
+
["padding", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 12)],
|
|
73
|
+
]), (value) => (Object.assign(Object.assign({}, value), { discriminator: exports.USER_DISCRIMINATOR })));
|
|
74
|
+
}
|
|
75
|
+
/** Gets the decoder for {@link User} account data. */
|
|
76
|
+
function getUserDecoder() {
|
|
77
|
+
return (0, kit_1.getStructDecoder)([
|
|
78
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
79
|
+
["authority", (0, kit_1.getAddressDecoder)()],
|
|
80
|
+
["delegate", (0, kit_1.getAddressDecoder)()],
|
|
81
|
+
["name", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
|
|
82
|
+
["spotPositions", (0, kit_1.getArrayDecoder)((0, types_1.getSpotPositionDecoder)(), { size: 8 })],
|
|
83
|
+
["perpPositions", (0, kit_1.getArrayDecoder)((0, types_1.getPerpPositionDecoder)(), { size: 8 })],
|
|
84
|
+
["orders", (0, kit_1.getArrayDecoder)((0, types_1.getOrderDecoder)(), { size: 32 })],
|
|
85
|
+
["lastAddPerpLpSharesTs", (0, kit_1.getI64Decoder)()],
|
|
86
|
+
["totalDeposits", (0, kit_1.getU64Decoder)()],
|
|
87
|
+
["totalWithdraws", (0, kit_1.getU64Decoder)()],
|
|
88
|
+
["totalSocialLoss", (0, kit_1.getU64Decoder)()],
|
|
89
|
+
["settledPerpPnl", (0, kit_1.getI64Decoder)()],
|
|
90
|
+
["cumulativeSpotFees", (0, kit_1.getI64Decoder)()],
|
|
91
|
+
["cumulativePerpFunding", (0, kit_1.getI64Decoder)()],
|
|
92
|
+
["liquidationMarginFreed", (0, kit_1.getU64Decoder)()],
|
|
93
|
+
["lastActiveSlot", (0, kit_1.getU64Decoder)()],
|
|
94
|
+
["nextOrderId", (0, kit_1.getU32Decoder)()],
|
|
95
|
+
["maxMarginRatio", (0, kit_1.getU32Decoder)()],
|
|
96
|
+
["nextLiquidationId", (0, kit_1.getU16Decoder)()],
|
|
97
|
+
["subAccountId", (0, kit_1.getU16Decoder)()],
|
|
98
|
+
["status", (0, kit_1.getU8Decoder)()],
|
|
99
|
+
["isMarginTradingEnabled", (0, kit_1.getBooleanDecoder)()],
|
|
100
|
+
["idle", (0, kit_1.getBooleanDecoder)()],
|
|
101
|
+
["openOrders", (0, kit_1.getU8Decoder)()],
|
|
102
|
+
["hasOpenOrder", (0, kit_1.getBooleanDecoder)()],
|
|
103
|
+
["openAuctions", (0, kit_1.getU8Decoder)()],
|
|
104
|
+
["hasOpenAuction", (0, kit_1.getBooleanDecoder)()],
|
|
105
|
+
["marginMode", (0, types_1.getMarginModeDecoder)()],
|
|
106
|
+
["poolId", (0, kit_1.getU8Decoder)()],
|
|
107
|
+
["padding1", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 3)],
|
|
108
|
+
["lastFuelBonusUpdateTs", (0, kit_1.getU32Decoder)()],
|
|
109
|
+
["padding", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 12)],
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
/** Gets the codec for {@link User} account data. */
|
|
113
|
+
function getUserCodec() {
|
|
114
|
+
return (0, kit_1.combineCodec)(getUserEncoder(), getUserDecoder());
|
|
115
|
+
}
|
|
116
|
+
function decodeUser(encodedAccount) {
|
|
117
|
+
return (0, kit_1.decodeAccount)(encodedAccount, getUserDecoder());
|
|
118
|
+
}
|
|
119
|
+
function fetchUser(rpc, address, config) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const maybeAccount = yield fetchMaybeUser(rpc, address, config);
|
|
122
|
+
(0, kit_1.assertAccountExists)(maybeAccount);
|
|
123
|
+
return maybeAccount;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function fetchMaybeUser(rpc, address, config) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const maybeAccount = yield (0, kit_1.fetchEncodedAccount)(rpc, address, config);
|
|
129
|
+
return decodeUser(maybeAccount);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function fetchAllUser(rpc, addresses, config) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const maybeAccounts = yield fetchAllMaybeUser(rpc, addresses, config);
|
|
135
|
+
(0, kit_1.assertAccountsExist)(maybeAccounts);
|
|
136
|
+
return maybeAccounts;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function fetchAllMaybeUser(rpc, addresses, config) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
const maybeAccounts = yield (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
|
|
142
|
+
return maybeAccounts.map((maybeAccount) => decodeUser(maybeAccount));
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function getUserSize() {
|
|
146
|
+
return 4376;
|
|
147
|
+
}
|