@drift-labs/common 1.0.12 → 1.0.13

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 (43) hide show
  1. package/lib/common-ui-utils/commonUiUtils.d.ts +1 -1
  2. package/lib/common-ui-utils/trading.d.ts +1 -1
  3. package/lib/common-ui-utils/trading.js +2 -1
  4. package/lib/common-ui-utils/trading.js.map +1 -1
  5. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.d.ts +20 -2
  6. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js +32 -0
  7. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js.map +1 -1
  8. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.d.ts +31 -1
  9. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.js.map +1 -1
  10. package/lib/drift/Drift/clients/AuthorityDrift/index.d.ts +10 -2
  11. package/lib/drift/Drift/clients/AuthorityDrift/index.js +12 -0
  12. package/lib/drift/Drift/clients/AuthorityDrift/index.js.map +1 -1
  13. package/lib/drift/base/actions/builder/createRevenueShareAccount.d.ts +62 -0
  14. package/lib/drift/base/actions/builder/createRevenueShareAccount.js +59 -0
  15. package/lib/drift/base/actions/builder/createRevenueShareAccount.js.map +1 -0
  16. package/lib/drift/base/actions/builder/createRevenueShareEscrow.d.ts +126 -0
  17. package/lib/drift/base/actions/builder/createRevenueShareEscrow.js +114 -0
  18. package/lib/drift/base/actions/builder/createRevenueShareEscrow.js.map +1 -0
  19. package/lib/drift/base/actions/builder/index.d.ts +3 -0
  20. package/lib/drift/base/actions/builder/index.js +20 -0
  21. package/lib/drift/base/actions/builder/index.js.map +1 -0
  22. package/lib/drift/base/actions/builder/manageBuilder.d.ts +157 -0
  23. package/lib/drift/base/actions/builder/manageBuilder.js +139 -0
  24. package/lib/drift/base/actions/builder/manageBuilder.js.map +1 -0
  25. package/lib/drift/base/actions/index.d.ts +1 -0
  26. package/lib/drift/base/actions/index.js +1 -0
  27. package/lib/drift/base/actions/index.js.map +1 -1
  28. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.d.ts +29 -1
  29. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js +2 -1
  30. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js.map +1 -1
  31. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.d.ts +8 -0
  32. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js +1 -0
  33. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js.map +1 -1
  34. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.d.ts +56 -2
  35. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js +7 -2
  36. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js.map +1 -1
  37. package/lib/drift/base/constants/index.d.ts +2 -0
  38. package/lib/drift/base/constants/index.js +19 -0
  39. package/lib/drift/base/constants/index.js.map +1 -0
  40. package/lib/drift/index.d.ts +1 -0
  41. package/lib/drift/index.js +1 -0
  42. package/lib/drift/index.js.map +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/drift/Drift/clients/AuthorityDrift/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAmByB;AACzB,6CAA8E;AAC9E,6EAA4E;AAC5E,+CAQyB;AACzB,6CAA6C;AAC7C,+DAAkE;AAClE,wDAIgC;AAChC,2EAAwE;AACxE,gEAA8E;AAC9E,oEAGuC;AACvC,uEAAoE;AAEpE,oEAIuC;AACvC,6CAA+C;AAC/C,yDAA2D;AAC3D,yCAIyB;AACzB,+DAA4D;AAC5D,uDAAoD;AAUpD,+CAAgD;AAEhD,mDAAuD;AACvD,yDAGmC;AAGnC;;;;;;;GAOG;AACH,SAAS,eAAe,CACvB,OAA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AAI,CAAC,eAAe,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAAC,MAAkB;QACnC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,YAAY,CACxB,MAIC;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAC5B,MAA8B;QAE9B,OAAO,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,UAAU,CAAC,YAAoB;QAC3C,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,YAAY,CACxB,MAA0B;QAE1B,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;CACD;AA5tBD,wCA4tBC;AA3Da;IADZ,eAAe;;;;mDAKf","sourcesContent":["import {\n\tCustomizedCadenceBulkAccountLoader,\n\tDelistedMarketSetting,\n\tDRIFT_PROGRAM_ID,\n\tDriftClient,\n\tDriftClientConfig,\n\tDriftEnv,\n\tgetMarketsAndOraclesForSubscription,\n\tIWallet,\n\tMarketType,\n\tPerpMarketConfig,\n\tPerpMarkets,\n\tQuoteResponse,\n\tSpotMarketConfig,\n\tSpotMarkets,\n\tSwapMode,\n\tUser,\n\tWhileValidTxSender,\n\tIWalletV2,\n} from '@drift-labs/sdk';\nimport { Connection, PublicKey, TransactionSignature } from '@solana/web3.js';\nimport { COMMON_UI_UTILS } from '../../../../common-ui-utils/commonUiUtils';\nimport {\n\tDEFAULT_ACCOUNT_LOADER_COMMITMENT,\n\tDEFAULT_ACCOUNT_LOADER_POLLING_FREQUENCY_MS,\n\tDEFAULT_TX_SENDER_CONFIRMATION_STRATEGY,\n\tDEFAULT_TX_SENDER_RETRY_INTERVAL,\n\tDELISTED_MARKET_STATUSES,\n\tHIGH_ACTIVITY_MARKET_ACCOUNTS,\n\tPollingCategory,\n} from '../../constants';\nimport { MarketId } from '../../../../types';\nimport { MARKET_UTILS } from '../../../../common-ui-utils/market';\nimport {\n\tPOLLING_DEPTHS,\n\tPOLLING_INTERVALS,\n\tPollingDlob,\n} from '../../data/PollingDlob';\nimport { EnvironmentConstants } from '../../../../EnvironmentConstants';\nimport { MarkPriceLookup, MarkPriceCache } from '../../stores/MarkPriceCache';\nimport {\n\tOraclePriceLookup,\n\tOraclePriceCache,\n} from '../../stores/OraclePriceCache';\nimport { DriftL2OrderbookManager } from './DriftL2OrderbookManager';\nimport { Subscription } from 'rxjs';\nimport {\n\tEnhancedAccountData,\n\tUserAccountCache,\n\tUserAccountLookup,\n} from '../../stores/UserAccountCache';\nimport { ENUM_UTILS } from '../../../../utils';\nimport { checkGeoBlock } from '../../../../utils/geoblock';\nimport {\n\tPriorityFeeSubscriber,\n\tPriorityFeeSubscriberConfig,\n\tPriorityFeeMethod,\n} from '@drift-labs/sdk';\nimport { SubscriptionManager } from './SubscriptionManager';\nimport { DriftOperations } from './DriftOperations';\nimport {\n\tCreateUserAndDepositParams,\n\tDepositParams,\n\tWithdrawParams,\n\tPerpOrderParams,\n\tSwapParams,\n\tSettleAccountPnlParams,\n\tCancelOrdersParams,\n} from './DriftOperations/types';\nimport { Initialize } from '../../../../Config';\nimport { L2WithOracleAndMarketData } from '../../../../utils/orderbook';\nimport { GeoBlockError } from '../../constants/errors';\nimport {\n\tDEFAULT_ORDERBOOK_GROUPING,\n\tDEFAULT_ORDERBOOK_SUBSCRIPTION_CONFIG,\n} from '../../constants/orderbook';\nimport { OrderbookGrouping } from '../../../../utils/dlob-server/DlobServerWebsocketUtils';\n\n/**\n * Decorator that prevents method execution if the user is geographically blocked.\n * Throws a GeoBlockError if the user is blocked.\n *\n * @param target - The class prototype\n * @param propertyName - The method name\n * @param descriptor - The method descriptor\n */\nfunction enforceGeoBlock(\n\t_target: any,\n\tpropertyName: string,\n\tdescriptor: PropertyDescriptor\n): PropertyDescriptor {\n\tconst originalMethod = descriptor.value;\n\n\tdescriptor.value = function (this: AuthorityDrift, ...args: any[]) {\n\t\tif (this._isGeoBlocked) {\n\t\t\tthrow new GeoBlockError(propertyName);\n\t\t}\n\t\treturn originalMethod.apply(this, args);\n\t};\n\n\treturn descriptor;\n}\n\nexport interface AuthorityDriftConfig {\n\tsolanaRpcEndpoint: string;\n\tdriftEnv: DriftEnv;\n\twallet?: IWalletV2;\n\tdriftDlobServerHttpUrl?: string;\n\ttradableMarkets?: MarketId[];\n\tselectedTradeMarket?: MarketId;\n\tadditionalDriftClientConfig?: Partial<Omit<DriftClientConfig, 'env'>>;\n\tpriorityFeeSubscriberConfig?: Partial<PriorityFeeSubscriberConfig>;\n\torderbookConfig?: {\n\t\tdlobWebSocketUrl?: string;\n\t\torderbookGrouping?: OrderbookGrouping;\n\t};\n}\n\n/**\n * A Drift client that is used to subscribe to all accounts for a given authority.\n *\n * This is useful for applications that want to subscribe to all user accounts for a given authority,\n * such as a UI to trade on Drift or a wallet application that allows trading on Drift.\n */\nexport class AuthorityDrift {\n\t/**\n\t * Handles all Drift program interactions e.g. trading, read account details, etc.\n\t */\n\tprivate _driftClient!: DriftClient;\n\n\t/**\n\t * Handles bulk account loading from the RPC.\n\t */\n\tprivate accountLoader!: CustomizedCadenceBulkAccountLoader;\n\n\t/**\n\t * Handles polling the DLOB server for mark price and oracle price data for markets.\n\t * It is also the fallback source for orderbook data, if the websocket DLOB subscriber is unavailable.\n\t */\n\tprivate _pollingDlob!: PollingDlob;\n\n\t/**\n\t * Subscription to the polling DLOB data.\n\t */\n\tprivate pollingDlobSubscription: Subscription | null = null;\n\n\t/**\n\t * Subscription to the orderbook data.\n\t */\n\tprivate orderbookSubscription: Subscription | null = null;\n\n\t/**\n\t * Handles all trading operations including deposits, withdrawals, and position management.\n\t */\n\tprivate driftOperations!: DriftOperations;\n\n\t/**\n\t * Manages all subscription operations including user accounts, market subscriptions, and polling optimization.\n\t */\n\tprivate subscriptionManager!: SubscriptionManager;\n\n\t/**\n\t * Stores the fetched mark prices for all tradable markets.\n\t * Mark price sources includes:\n\t * - Websocket DLOB subscriber (active market, derived when fetching orderbook data)\n\t * - Polling DLOB server (all non-active markets)\n\t */\n\tprivate _markPriceCache!: MarkPriceCache;\n\n\t/**\n\t * Stores the fetched oracle prices for all tradable markets.\n\t * Oracle price sources includes:\n\t * - DriftClient oracle account subscriptions\n\t * - Polling DLOB server (all non-active markets)\n\t */\n\tprivate _oraclePriceCache!: OraclePriceCache;\n\n\t/**\n\t * Stores the fetched user account data for all user accounts.\n\t */\n\tprivate _userAccountCache!: UserAccountCache;\n\n\t/**\n\t * Manages real-time orderbook subscriptions via websocket.\n\t */\n\tprivate _orderbookManager!: DriftL2OrderbookManager;\n\n\t/**\n\t * Handles priority fee tracking and calculation for optimized transaction costs.\n\t */\n\tprivate priorityFeeSubscriber!: PriorityFeeSubscriber;\n\n\t/**\n\t * Stores whether the user is geographically blocked from using the service.\n\t * This is checked during subscription and cached for decorator use.\n\t */\n\tprotected _isGeoBlocked: boolean = false;\n\n\t/**\n\t * The selected trade market to use for the drift client. This is used to subscribe to the market account,\n\t * oracle data and mark price more frequently compared to the other markets.\n\t *\n\t * Example usage:\n\t * - When the UI wants to display the orderbook of this market.\n\t * - When the user is interacting with the trade form to trade on this market.\n\t */\n\tprivate selectedTradeMarket: MarketId | null = null;\n\n\t/**\n\t * The markets that are tradable through this client. This affects oracle price, mark price and market account subscriptions.\n\t */\n\tprivate _tradableMarkets: MarketId[] = [];\n\n\tprivate _spotMarketConfigs: SpotMarketConfig[] = [];\n\tprivate _perpMarketConfigs: PerpMarketConfig[] = [];\n\n\t/**\n\t * The public endpoints that can be used to retrieve Drift data / interact with the Drift program.\n\t */\n\tprivate _driftEndpoints: {\n\t\tdlobServerHttpUrl: string;\n\t\tswiftServerUrl: string;\n\t\torderbookWebsocketUrl: string;\n\t};\n\n\t/**\n\t * @param solanaRpcEndpoint - The Solana RPC endpoint to use for reading RPC data.\n\t * @param driftEnv - The drift environment to use for the drift client.\n\t * @param authority - The authority (wallet) whose user accounts to subscribe to.\n\t * @param tradableMarkets - The markets that are tradable through this client.\n\t * @param selectedTradeMarket - The active trade market to use for the drift client. This is used to subscribe to the market account, oracle data and mark price more frequently compared to the other markets.\n\t * @param additionalDriftClientConfig - Additional DriftClient config to use for the DriftClient.\n\t */\n\tconstructor(config: AuthorityDriftConfig) {\n\t\t// set up tradable markets\n\t\tthis.selectedTradeMarket = config.selectedTradeMarket ?? null;\n\n\t\tconst perpTradableMarkets = PerpMarkets[config.driftEnv].map(\n\t\t\t(marketConfig) => MarketId.createPerpMarket(marketConfig.marketIndex)\n\t\t);\n\t\tconst spotTradableMarkets = SpotMarkets[config.driftEnv].map(\n\t\t\t(marketConfig) => MarketId.createSpotMarket(marketConfig.marketIndex)\n\t\t);\n\n\t\tthis._tradableMarkets = config.tradableMarkets ?? [\n\t\t\t...perpTradableMarkets,\n\t\t\t...spotTradableMarkets,\n\t\t];\n\t\tthis._spotMarketConfigs = spotTradableMarkets.map((market) =>\n\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\tconfig.driftEnv,\n\t\t\t\tMarketType.SPOT,\n\t\t\t\tmarket.marketIndex\n\t\t\t)\n\t\t);\n\t\tthis._perpMarketConfigs = perpTradableMarkets.map((market) =>\n\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\tconfig.driftEnv,\n\t\t\t\tMarketType.PERP,\n\t\t\t\tmarket.marketIndex\n\t\t\t)\n\t\t);\n\n\t\t// set up Drift endpoints\n\t\tconst driftDlobServerHttpUrlToUse =\n\t\t\tconfig.driftDlobServerHttpUrl ??\n\t\t\tEnvironmentConstants.dlobServerHttpUrl[\n\t\t\t\tconfig.driftEnv === 'devnet' ? 'dev' : 'mainnet'\n\t\t\t];\n\t\tconst swiftServerUrlToUse =\n\t\t\tEnvironmentConstants.swiftServerUrl[\n\t\t\t\tconfig.driftEnv === 'devnet' ? 'staging' : 'mainnet'\n\t\t\t];\n\t\tconst orderbookWebsocketUrlToUse =\n\t\t\tconfig.orderbookConfig?.dlobWebSocketUrl ??\n\t\t\tEnvironmentConstants.dlobServerWsUrl[\n\t\t\t\tconfig.driftEnv === 'devnet' ? 'dev' : 'mainnet'\n\t\t\t];\n\t\tthis._driftEndpoints = {\n\t\t\tdlobServerHttpUrl: driftDlobServerHttpUrlToUse,\n\t\t\tswiftServerUrl: swiftServerUrlToUse,\n\t\t\torderbookWebsocketUrl: orderbookWebsocketUrlToUse,\n\t\t};\n\n\t\t// we set this up because SerializableTypes\n\t\tInitialize(config.driftEnv);\n\n\t\t// set up clients and stores\n\t\tconst driftClient = this.setupDriftClient(config);\n\t\tthis.initializePollingDlob(driftDlobServerHttpUrlToUse);\n\t\tthis.initializeStores(driftClient);\n\t\tthis.initializeOrderbookManager(\n\t\t\torderbookWebsocketUrlToUse,\n\t\t\tconfig.orderbookConfig?.orderbookGrouping\n\t\t);\n\t\tthis.initializePriorityFeeSubscriber(config.priorityFeeSubscriberConfig);\n\t\tthis.initializeManagers(driftDlobServerHttpUrlToUse, swiftServerUrlToUse);\n\t}\n\n\tpublic get driftClient(): DriftClient {\n\t\treturn this._driftClient;\n\t}\n\n\tpublic get authority(): PublicKey {\n\t\treturn this._driftClient.wallet.publicKey;\n\t}\n\n\tpublic get pollingDlob(): PollingDlob {\n\t\treturn this._pollingDlob;\n\t}\n\n\tpublic get oraclePriceCache(): OraclePriceLookup {\n\t\treturn this._oraclePriceCache.store;\n\t}\n\n\tpublic get markPriceCache(): MarkPriceLookup {\n\t\treturn this._markPriceCache.store;\n\t}\n\n\tpublic get userAccountCache(): UserAccountLookup {\n\t\treturn this._userAccountCache.store;\n\t}\n\n\tpublic get orderbookCache(): L2WithOracleAndMarketData | null {\n\t\treturn this._orderbookManager.store;\n\t}\n\n\tpublic get orderbookManager(): DriftL2OrderbookManager {\n\t\treturn this._orderbookManager;\n\t}\n\n\tpublic get tradableMarkets(): MarketId[] {\n\t\treturn this._tradableMarkets;\n\t}\n\n\t/**\n\t * Gets the current geoblock status of the user.\n\t *\n\t * @returns True if the user is geographically blocked, false otherwise\n\t */\n\tpublic get isGeoBlocked(): boolean {\n\t\treturn this._isGeoBlocked;\n\t}\n\n\t/**\n\t * The public endpoints that can be used to retrieve Drift data / interact with the Drift program.\n\t */\n\tpublic get driftEndpoints(): {\n\t\tdlobServerHttpUrl: string;\n\t\tswiftServerUrl: string;\n\t} {\n\t\treturn this._driftEndpoints;\n\t}\n\n\tprivate set tradableMarkets(tradableMarkets: MarketId[]) {\n\t\tthis._tradableMarkets = tradableMarkets;\n\t\tthis._spotMarketConfigs = tradableMarkets\n\t\t\t.filter((market) => !market.isPerp)\n\t\t\t.map((market) =>\n\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\tthis._driftClient.env,\n\t\t\t\t\tMarketType.SPOT,\n\t\t\t\t\tmarket.marketIndex\n\t\t\t\t)\n\t\t\t);\n\t\tthis._perpMarketConfigs = tradableMarkets\n\t\t\t.filter((market) => market.isPerp)\n\t\t\t.map((market) =>\n\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\tthis._driftClient.env,\n\t\t\t\t\tMarketType.PERP,\n\t\t\t\t\tmarket.marketIndex\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tpublic get spotMarketConfigs(): SpotMarketConfig[] {\n\t\treturn this._spotMarketConfigs;\n\t}\n\n\tpublic get perpMarketConfigs(): PerpMarketConfig[] {\n\t\treturn this._perpMarketConfigs;\n\t}\n\n\tprivate initializeStores(driftClient: DriftClient) {\n\t\tthis._markPriceCache = new MarkPriceCache();\n\t\tthis._oraclePriceCache = new OraclePriceCache();\n\t\tthis._userAccountCache = new UserAccountCache(\n\t\t\tdriftClient,\n\t\t\tthis._oraclePriceCache,\n\t\t\tthis._markPriceCache\n\t\t);\n\t}\n\n\tprivate initializeOrderbookManager(\n\t\torderbookWebsocketUrl: string,\n\t\torderbookGrouping: OrderbookGrouping = DEFAULT_ORDERBOOK_GROUPING\n\t) {\n\t\tthis._orderbookManager = new DriftL2OrderbookManager({\n\t\t\twsUrl: orderbookWebsocketUrl,\n\t\t\tsubscriptionConfig: this.selectedTradeMarket\n\t\t\t\t? {\n\t\t\t\t\t\t...DEFAULT_ORDERBOOK_SUBSCRIPTION_CONFIG,\n\t\t\t\t\t\tgrouping: orderbookGrouping,\n\t\t\t\t\t\tmarketId: this.selectedTradeMarket,\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t});\n\t}\n\n\tprivate initializePollingDlob(driftDlobServerHttpUrl: string) {\n\t\tthis._pollingDlob = new PollingDlob({\n\t\t\tdriftDlobServerHttpUrl: driftDlobServerHttpUrl,\n\t\t});\n\t}\n\n\tprivate initializePriorityFeeSubscriber(\n\t\tconfig?: Partial<PriorityFeeSubscriberConfig>\n\t) {\n\t\t// Convert tradable markets to DriftMarketInfo format for priority fee subscriber\n\t\tconst driftMarkets = this._tradableMarkets.map((market) => ({\n\t\t\tmarketType: market.marketTypeStr,\n\t\t\tmarketIndex: market.marketIndex,\n\t\t}));\n\n\t\tconst priorityFeeConfig: PriorityFeeSubscriberConfig = {\n\t\t\tconnection: this.driftClient.connection,\n\t\t\tpriorityFeeMethod: PriorityFeeMethod.SOLANA,\n\t\t\tdriftMarkets,\n\t\t\taddresses: HIGH_ACTIVITY_MARKET_ACCOUNTS,\n\t\t\t...config,\n\t\t};\n\n\t\tthis.priorityFeeSubscriber = new PriorityFeeSubscriber(priorityFeeConfig);\n\t}\n\n\tprivate setupDriftClient(\n\t\tconfig: Omit<AuthorityDriftConfig, 'onUserAccountUpdate'>\n\t) {\n\t\tconst driftEnv = config.driftEnv;\n\n\t\tconst connection = new Connection(config.solanaRpcEndpoint);\n\t\tconst driftProgramID = new PublicKey(DRIFT_PROGRAM_ID);\n\t\tconst accountLoader = new CustomizedCadenceBulkAccountLoader(\n\t\t\tconnection,\n\t\t\tDEFAULT_ACCOUNT_LOADER_COMMITMENT,\n\t\t\tDEFAULT_ACCOUNT_LOADER_POLLING_FREQUENCY_MS\n\t\t);\n\t\tthis.accountLoader = accountLoader;\n\n\t\tconst wallet = config.wallet ?? COMMON_UI_UTILS.createPlaceholderIWallet();\n\t\tconst skipInitialUsersLoad = !config.wallet;\n\n\t\tconst perpMarkets =\n\t\t\tconfig.tradableMarkets\n\t\t\t\t?.filter((market) => market.isPerp)\n\t\t\t\t.map((market) =>\n\t\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\t\tdriftEnv,\n\t\t\t\t\t\tMarketType.PERP,\n\t\t\t\t\t\tmarket.marketIndex\n\t\t\t\t\t)\n\t\t\t\t) ?? PerpMarkets[driftEnv];\n\t\tconst spotMarkets =\n\t\t\tconfig.tradableMarkets\n\t\t\t\t?.filter((market) => !market.isPerp)\n\t\t\t\t.map((market) =>\n\t\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\t\tdriftEnv,\n\t\t\t\t\t\tMarketType.SPOT,\n\t\t\t\t\t\tmarket.marketIndex\n\t\t\t\t\t)\n\t\t\t\t) ?? SpotMarkets[driftEnv];\n\t\tconst { perpMarketIndexes, spotMarketIndexes, oracleInfos } =\n\t\t\tgetMarketsAndOraclesForSubscription(driftEnv, perpMarkets, spotMarkets);\n\n\t\tconst driftClientConfig: DriftClientConfig = {\n\t\t\tenv: driftEnv,\n\t\t\tconnection,\n\t\t\twallet,\n\t\t\tprogramID: driftProgramID,\n\t\t\tenableMetricsEvents: false,\n\t\t\taccountSubscription: {\n\t\t\t\ttype: 'polling',\n\t\t\t\taccountLoader,\n\t\t\t},\n\t\t\tuserStats: true,\n\t\t\tincludeDelegates: true,\n\t\t\tskipLoadUsers: skipInitialUsersLoad,\n\t\t\tdelistedMarketSetting: DelistedMarketSetting.Unsubscribe,\n\t\t\tperpMarketIndexes,\n\t\t\tspotMarketIndexes,\n\t\t\toracleInfos,\n\t\t\t...config.additionalDriftClientConfig,\n\t\t};\n\t\tthis._driftClient = new DriftClient(driftClientConfig);\n\n\t\tconst txSender = new WhileValidTxSender({\n\t\t\tconnection,\n\t\t\twallet,\n\t\t\tadditionalConnections: [],\n\t\t\tadditionalTxSenderCallbacks: [],\n\t\t\ttxHandler: this._driftClient.txHandler,\n\t\t\tconfirmationStrategy: DEFAULT_TX_SENDER_CONFIRMATION_STRATEGY,\n\t\t\tretrySleep: DEFAULT_TX_SENDER_RETRY_INTERVAL,\n\t\t});\n\n\t\tthis._driftClient.txSender = txSender;\n\n\t\treturn this._driftClient;\n\t}\n\n\tprivate setupOrderbookManager() {\n\t\tthis.orderbookSubscription = this._orderbookManager.onUpdate(\n\t\t\t(orderbookData) => {\n\t\t\t\tconst marketKey = new MarketId(\n\t\t\t\t\torderbookData.marketIndex,\n\t\t\t\t\tENUM_UTILS.toObj(orderbookData.marketType as string) as MarketType\n\t\t\t\t).key;\n\n\t\t\t\tconst markPrice = orderbookData.markPrice;\n\n\t\t\t\tthis._markPriceCache.updateMarkPrices({\n\t\t\t\t\tmarketKey,\n\t\t\t\t\tmarkPrice,\n\t\t\t\t\tbestAsk: orderbookData.bestAskPrice,\n\t\t\t\t\tbestBid: orderbookData.bestBidPrice,\n\t\t\t\t\tlastUpdateSlot: orderbookData.slot ?? 0,\n\t\t\t\t});\n\n\t\t\t\tthis._oraclePriceCache.updateOraclePrices({\n\t\t\t\t\t...orderbookData.oracleData,\n\t\t\t\t\tmarketKey,\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tprivate setupPollingDlob() {\n\t\t// DriftL2OrderbookManager will handle the fetching of data for the selected trade market through websocket\n\n\t\tthis._pollingDlob.addInterval(\n\t\t\tPollingCategory.USER_INVOLVED,\n\t\t\tPOLLING_INTERVALS.BACKGROUND_DEEP,\n\t\t\tPOLLING_DEPTHS.DEEP\n\t\t); // markets that the user is involved in\n\t\tthis._pollingDlob.addInterval(\n\t\t\tPollingCategory.USER_NOT_INVOLVED,\n\t\t\tPOLLING_INTERVALS.BACKGROUND_SHALLOW,\n\t\t\tPOLLING_DEPTHS.SHALLOW\n\t\t); // markets that the user is not involved in\n\n\t\t// add all markets to the user-not-involved interval first, until user-involved markets are known\n\t\tthis._pollingDlob.addMarketsToInterval(\n\t\t\tPollingCategory.USER_NOT_INVOLVED,\n\t\t\tthis._tradableMarkets.map((market) => market.key)\n\t\t);\n\n\t\tthis.pollingDlobSubscription = this._pollingDlob\n\t\t\t.onData()\n\t\t\t.subscribe((data) => {\n\t\t\t\tconst updatedMarkPrices = data.map((marketData) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarketKey: marketData.marketId.key,\n\t\t\t\t\t\tmarkPrice: marketData.data.markPrice,\n\t\t\t\t\t\tbestBid: marketData.data.bestBidPrice,\n\t\t\t\t\t\tbestAsk: marketData.data.bestAskPrice,\n\t\t\t\t\t\tlastUpdateSlot: marketData.data.slot ?? 0,\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tconst updatedOraclePrices = data.map((marketData) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarketKey: marketData.marketId.key,\n\t\t\t\t\t\t...marketData.data.oracleData,\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tthis._markPriceCache.updateMarkPrices(...updatedMarkPrices);\n\t\t\t\tthis._oraclePriceCache.updateOraclePrices(...updatedOraclePrices);\n\t\t\t});\n\t}\n\n\tprivate initializeManagers(\n\t\tdlobServerHttpUrl: string,\n\t\tswiftServerUrl: string\n\t) {\n\t\t// Initialize trading operations\n\t\tthis.driftOperations = new DriftOperations(\n\t\t\tthis._driftClient,\n\t\t\t() => this._userAccountCache,\n\t\t\tdlobServerHttpUrl,\n\t\t\tswiftServerUrl,\n\t\t\t() => this.priorityFeeSubscriber.getCustomStrategyResult()\n\t\t);\n\n\t\t// Initialize subscription manager with all subscription and market operations\n\t\tthis.subscriptionManager = new SubscriptionManager(\n\t\t\tthis._driftClient,\n\t\t\tthis.accountLoader,\n\t\t\tthis._pollingDlob,\n\t\t\tthis._orderbookManager,\n\t\t\tthis._userAccountCache,\n\t\t\tthis._tradableMarkets,\n\t\t\tthis.selectedTradeMarket\n\t\t);\n\t}\n\n\tprivate unsubscribeFromPollingDlob() {\n\t\tthis.pollingDlobSubscription?.unsubscribe();\n\t\tthis.pollingDlobSubscription = null;\n\n\t\tthis._pollingDlob.stop();\n\t}\n\n\tprivate unsubscribeFromOrderbook() {\n\t\tthis.orderbookSubscription?.unsubscribe();\n\t\tthis.orderbookSubscription = null;\n\n\t\tthis._orderbookManager.unsubscribe();\n\t}\n\n\tpublic async subscribe() {\n\t\tconst handleGeoBlock = async () => {\n\t\t\ttry {\n\t\t\t\tthis._isGeoBlocked = (await checkGeoBlock()) ?? false;\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to check geoblock status:', error);\n\t\t\t\tthis._isGeoBlocked = false; // Default to not blocked if check fails\n\t\t\t}\n\t\t};\n\n\t\t// async logic that doesn't require DriftClient to be subscribed\n\t\tconst handleGeoBlockPromise = handleGeoBlock();\n\t\tconst pollingDlobStartPromise = this._pollingDlob.start();\n\t\tconst priorityFeeSubscribePromise = this.priorityFeeSubscriber.subscribe();\n\t\tconst orderbookSubscribePromise = this._orderbookManager.subscribe();\n\n\t\tawait this._driftClient.subscribe();\n\n\t\t// filter out markets that are delisted\n\t\tconst actualTradableMarkets = this._tradableMarkets.filter((market) => {\n\t\t\tconst marketAccount = market.isPerp\n\t\t\t\t? this._driftClient.getPerpMarketAccount(market.marketIndex)\n\t\t\t\t: this._driftClient.getSpotMarketAccount(market.marketIndex);\n\n\t\t\tif (\n\t\t\t\t!marketAccount ||\n\t\t\t\tDELISTED_MARKET_STATUSES.some((marketStatus) =>\n\t\t\t\t\tENUM_UTILS.match(marketAccount.status, marketStatus)\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\n\t\tthis._tradableMarkets = actualTradableMarkets;\n\t\tthis.subscriptionManager.updateTradableMarkets(actualTradableMarkets);\n\t\tthis.setupPollingDlob();\n\t\tthis.setupOrderbookManager();\n\n\t\tconst subscribeToNonWhitelistedButUserInvolvedMarketsPromise =\n\t\t\tthis.subscriptionManager.subscribeToNonWhitelistedButUserInvolvedMarkets(\n\t\t\t\tthis._driftClient.getUsers()\n\t\t\t);\n\n\t\tawait Promise.all([\n\t\t\tpollingDlobStartPromise,\n\t\t\tsubscribeToNonWhitelistedButUserInvolvedMarketsPromise,\n\t\t\tpriorityFeeSubscribePromise,\n\t\t\thandleGeoBlockPromise,\n\t\t\torderbookSubscribePromise,\n\t\t]);\n\n\t\tthis.subscriptionManager.subscribeToAllUsersUpdates();\n\n\t\t// TODO: subscribe to oracle price updates from drift client?\n\t}\n\n\tpublic async unsubscribe() {\n\t\tthis.unsubscribeFromPollingDlob();\n\t\tthis.unsubscribeFromOrderbook();\n\t\tthis._userAccountCache.destroy();\n\t\tthis._markPriceCache.destroy();\n\t\tthis._orderbookManager.destroy();\n\n\t\tconst driftClientUnsubscribePromise = this._driftClient.unsubscribe();\n\t\tconst priorityFeeUnsubscribePromise =\n\t\t\tthis.priorityFeeSubscriber.unsubscribe();\n\n\t\tawait Promise.all(\n\t\t\t[driftClientUnsubscribePromise, priorityFeeUnsubscribePromise].filter(\n\t\t\t\tBoolean\n\t\t\t)\n\t\t);\n\n\t\tthis.pollingDlobSubscription = null;\n\t}\n\n\tpublic onOraclePricesUpdate(\n\t\tcallback: (oraclePrice: OraclePriceLookup) => void\n\t) {\n\t\treturn this._oraclePriceCache.onUpdate(callback);\n\t}\n\n\tpublic onMarkPricesUpdate(callback: (markPrice: MarkPriceLookup) => void) {\n\t\treturn this._markPriceCache.onUpdate(callback);\n\t}\n\n\tpublic onUserAccountUpdate(\n\t\tcallback: (userAccount: EnhancedAccountData) => void\n\t) {\n\t\treturn this._userAccountCache.onUpdate(callback);\n\t}\n\n\tpublic onOrderbookUpdate(\n\t\tcallback: (orderbook: L2WithOracleAndMarketData) => void\n\t) {\n\t\treturn this._orderbookManager.onUpdate(callback);\n\t}\n\n\t/**\n\t * Updates the authority (wallet) for the drift client and reestablishes subscriptions.\n\t *\n\t * @param wallet - The new wallet to use as authority\n\t * @param activeSubAccountId - Optional subaccount ID to switch to after wallet update\n\t */\n\tpublic async updateAuthority(wallet: IWallet, activeSubAccountId?: number) {\n\t\treturn this.subscriptionManager.updateAuthority(wallet, activeSubAccountId);\n\t}\n\n\t/**\n\t * Updates the selected trade market and optimizes subscription polling.\n\t *\n\t * @param newSelectedTradeMarket - The new market to prioritize for trading\n\t */\n\tpublic updateSelectedTradeMarket(newSelectedTradeMarket: MarketId | null) {\n\t\tconst isNewSelectedTradeMarket =\n\t\t\t!!newSelectedTradeMarket !== !!this.selectedTradeMarket || // only one of them is null\n\t\t\t(!!newSelectedTradeMarket && // or both are not null and are different\n\t\t\t\t!!this.selectedTradeMarket &&\n\t\t\t\t!this.selectedTradeMarket.equals(newSelectedTradeMarket));\n\n\t\tif (!isNewSelectedTradeMarket) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the local reference\n\t\tthis.selectedTradeMarket = newSelectedTradeMarket;\n\n\t\t// Delegate to subscription manager for all polling optimization\n\t\tthis.subscriptionManager.updateSelectedTradeMarket(newSelectedTradeMarket);\n\t}\n\n\t/**\n\t * Creates a new user account and deposits initial collateral.\n\t *\n\t * @param params - Parameters for creating user and depositing collateral\n\t * @returns Promise resolving to transaction signature and user account public key\n\t */\n\tpublic async createUserAndDeposit(\n\t\tparams: CreateUserAndDepositParams\n\t): Promise<{\n\t\ttxSig: TransactionSignature;\n\t\tuser: User;\n\t}> {\n\t\treturn this.driftOperations.createUserAndDeposit(params);\n\t}\n\n\t/**\n\t * Deposits collateral into a user's spot market position.\n\t *\n\t * @param params - Parameters for the deposit operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async deposit(params: DepositParams): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.deposit(params);\n\t}\n\n\t/**\n\t * Withdraws collateral from a user's spot market position.\n\t *\n\t * @param params - Parameters for the withdrawal operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async withdraw(params: WithdrawParams): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.withdraw(params);\n\t}\n\n\t/**\n\t * Opens a perpetual market order.\n\t *\n\t * @param params - Parameters for the perp order\n\t * @returns Promise resolving to the transaction signature\n\t */\n\t@enforceGeoBlock\n\tpublic async openPerpOrder(\n\t\tparams: PerpOrderParams\n\t): Promise<TransactionSignature | void> {\n\t\treturn this.driftOperations.openPerpOrder(params);\n\t}\n\n\t/**\n\t * Executes a swap between two spot markets.\n\t *\n\t * @param params - Parameters for the swap operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async swap(params: SwapParams): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.swap(params);\n\t}\n\n\tpublic async getSwapQuote(\n\t\tparams: Omit<SwapParams, 'jupiterQuote'> & {\n\t\t\tslippageBps?: number;\n\t\t\tswapMode?: SwapMode;\n\t\t\tonlyDirectRoutes?: boolean;\n\t\t}\n\t): Promise<QuoteResponse> {\n\t\treturn this.driftOperations.getSwapQuote(params);\n\t}\n\n\t/**\n\t * Settles profit and loss for a perpetual position.\n\t *\n\t * @param params - Parameters for the settle PnL operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async settleAccountPnl(\n\t\tparams: SettleAccountPnlParams\n\t): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.settleAccountPnl(params);\n\t}\n\n\t/**\n\t * Deletes a user account from the Drift protocol.\n\t *\n\t * @param subAccountId - The ID of the sub-account to delete\n\t * @returns Promise resolving to the transaction signature of the deletion\n\t */\n\tpublic async deleteUser(subAccountId: number): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.deleteUser(subAccountId);\n\t}\n\n\t/**\n\t * Cancels a list of open orders.\n\t *\n\t * @param params - See `CancelOrdersParams`\n\t * @returns Promise resolving to the transaction signature of the cancellation\n\t */\n\tpublic async cancelOrders(\n\t\tparams: CancelOrdersParams\n\t): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.cancelOrders(params);\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/drift/Drift/clients/AuthorityDrift/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAoByB;AACzB,6CAA8E;AAC9E,6EAA4E;AAC5E,+CAQyB;AACzB,6CAA6C;AAC7C,+DAAkE;AAClE,wDAIgC;AAChC,2EAAwE;AACxE,gEAA8E;AAC9E,oEAGuC;AACvC,uEAAoE;AAEpE,oEAIuC;AACvC,6CAA+C;AAC/C,yDAA2D;AAC3D,yCAIyB;AACzB,+DAA4D;AAC5D,uDAAoD;AAWpD,+CAAgD;AAEhD,mDAAuD;AACvD,yDAGmC;AAGnC;;;;;;;GAOG;AACH,SAAS,eAAe,CACvB,OAAY,EACZ,YAAoB,EACpB,UAA8B;IAE9B,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;IAExC,UAAU,CAAC,KAAK,GAAG,UAAgC,GAAG,IAAW;QAChE,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,IAAI,sBAAa,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC;AAiBD;;;;;GAKG;AACH,MAAa,cAAc;IAqG1B;;;;;;;OAOG;IACH,YAAY,MAA4B;;QA5FxC;;WAEG;QACK,4BAAuB,GAAwB,IAAI,CAAC;QAE5D;;WAEG;QACK,0BAAqB,GAAwB,IAAI,CAAC;QA2C1D;;;WAGG;QACO,kBAAa,GAAY,KAAK,CAAC;QAEzC;;;;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AAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,UAAU,CAAC,YAAoB;QAC3C,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,YAAY,CACxB,MAA0B;QAE1B,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAEM,WAAW,CAAC,SAA6B;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACD;AA5uBD,wCA4uBC;AA/Da;IADZ,eAAe;;;;mDAKf","sourcesContent":["import {\n\tCustomizedCadenceBulkAccountLoader,\n\tDelistedMarketSetting,\n\tDRIFT_PROGRAM_ID,\n\tDriftClient,\n\tDriftClientConfig,\n\tDriftEnv,\n\tgetMarketsAndOraclesForSubscription,\n\tIWallet,\n\tMarketType,\n\tPerpMarketConfig,\n\tPerpMarkets,\n\tQuoteResponse,\n\tSpotMarketConfig,\n\tSpotMarkets,\n\tSwapMode,\n\tUser,\n\tWhileValidTxSender,\n\tIWalletV2,\n\tTxParams,\n} from '@drift-labs/sdk';\nimport { Connection, PublicKey, TransactionSignature } from '@solana/web3.js';\nimport { COMMON_UI_UTILS } from '../../../../common-ui-utils/commonUiUtils';\nimport {\n\tDEFAULT_ACCOUNT_LOADER_COMMITMENT,\n\tDEFAULT_ACCOUNT_LOADER_POLLING_FREQUENCY_MS,\n\tDEFAULT_TX_SENDER_CONFIRMATION_STRATEGY,\n\tDEFAULT_TX_SENDER_RETRY_INTERVAL,\n\tDELISTED_MARKET_STATUSES,\n\tHIGH_ACTIVITY_MARKET_ACCOUNTS,\n\tPollingCategory,\n} from '../../constants';\nimport { MarketId } from '../../../../types';\nimport { MARKET_UTILS } from '../../../../common-ui-utils/market';\nimport {\n\tPOLLING_DEPTHS,\n\tPOLLING_INTERVALS,\n\tPollingDlob,\n} from '../../data/PollingDlob';\nimport { EnvironmentConstants } from '../../../../EnvironmentConstants';\nimport { MarkPriceLookup, MarkPriceCache } from '../../stores/MarkPriceCache';\nimport {\n\tOraclePriceLookup,\n\tOraclePriceCache,\n} from '../../stores/OraclePriceCache';\nimport { DriftL2OrderbookManager } from './DriftL2OrderbookManager';\nimport { Subscription } from 'rxjs';\nimport {\n\tEnhancedAccountData,\n\tUserAccountCache,\n\tUserAccountLookup,\n} from '../../stores/UserAccountCache';\nimport { ENUM_UTILS } from '../../../../utils';\nimport { checkGeoBlock } from '../../../../utils/geoblock';\nimport {\n\tPriorityFeeSubscriber,\n\tPriorityFeeSubscriberConfig,\n\tPriorityFeeMethod,\n} from '@drift-labs/sdk';\nimport { SubscriptionManager } from './SubscriptionManager';\nimport { DriftOperations } from './DriftOperations';\nimport {\n\tCreateUserAndDepositParams,\n\tDepositParams,\n\tWithdrawParams,\n\tPerpOrderParams,\n\tSwapParams,\n\tSettleAccountPnlParams,\n\tCancelOrdersParams,\n\tCreateRevenueShareEscrowParams,\n} from './DriftOperations/types';\nimport { Initialize } from '../../../../Config';\nimport { L2WithOracleAndMarketData } from '../../../../utils/orderbook';\nimport { GeoBlockError } from '../../constants/errors';\nimport {\n\tDEFAULT_ORDERBOOK_GROUPING,\n\tDEFAULT_ORDERBOOK_SUBSCRIPTION_CONFIG,\n} from '../../constants/orderbook';\nimport { OrderbookGrouping } from '../../../../utils/dlob-server/DlobServerWebsocketUtils';\n\n/**\n * Decorator that prevents method execution if the user is geographically blocked.\n * Throws a GeoBlockError if the user is blocked.\n *\n * @param target - The class prototype\n * @param propertyName - The method name\n * @param descriptor - The method descriptor\n */\nfunction enforceGeoBlock(\n\t_target: any,\n\tpropertyName: string,\n\tdescriptor: PropertyDescriptor\n): PropertyDescriptor {\n\tconst originalMethod = descriptor.value;\n\n\tdescriptor.value = function (this: AuthorityDrift, ...args: any[]) {\n\t\tif (this._isGeoBlocked) {\n\t\t\tthrow new GeoBlockError(propertyName);\n\t\t}\n\t\treturn originalMethod.apply(this, args);\n\t};\n\n\treturn descriptor;\n}\n\nexport interface AuthorityDriftConfig {\n\tsolanaRpcEndpoint: string;\n\tdriftEnv: DriftEnv;\n\twallet?: IWalletV2;\n\tdriftDlobServerHttpUrl?: string;\n\ttradableMarkets?: MarketId[];\n\tselectedTradeMarket?: MarketId;\n\tadditionalDriftClientConfig?: Partial<Omit<DriftClientConfig, 'env'>>;\n\tpriorityFeeSubscriberConfig?: Partial<PriorityFeeSubscriberConfig>;\n\torderbookConfig?: {\n\t\tdlobWebSocketUrl?: string;\n\t\torderbookGrouping?: OrderbookGrouping;\n\t};\n}\n\n/**\n * A Drift client that is used to subscribe to all accounts for a given authority.\n *\n * This is useful for applications that want to subscribe to all user accounts for a given authority,\n * such as a UI to trade on Drift or a wallet application that allows trading on Drift.\n */\nexport class AuthorityDrift {\n\t/**\n\t * Handles all Drift program interactions e.g. trading, read account details, etc.\n\t */\n\tprivate _driftClient!: DriftClient;\n\n\t/**\n\t * Handles bulk account loading from the RPC.\n\t */\n\tprivate accountLoader!: CustomizedCadenceBulkAccountLoader;\n\n\t/**\n\t * Handles polling the DLOB server for mark price and oracle price data for markets.\n\t * It is also the fallback source for orderbook data, if the websocket DLOB subscriber is unavailable.\n\t */\n\tprivate _pollingDlob!: PollingDlob;\n\n\t/**\n\t * Subscription to the polling DLOB data.\n\t */\n\tprivate pollingDlobSubscription: Subscription | null = null;\n\n\t/**\n\t * Subscription to the orderbook data.\n\t */\n\tprivate orderbookSubscription: Subscription | null = null;\n\n\t/**\n\t * Handles all trading operations including deposits, withdrawals, and position management.\n\t */\n\tprivate driftOperations!: DriftOperations;\n\n\t/**\n\t * Manages all subscription operations including user accounts, market subscriptions, and polling optimization.\n\t */\n\tprivate subscriptionManager!: SubscriptionManager;\n\n\t/**\n\t * Stores the fetched mark prices for all tradable markets.\n\t * Mark price sources includes:\n\t * - Websocket DLOB subscriber (active market, derived when fetching orderbook data)\n\t * - Polling DLOB server (all non-active markets)\n\t */\n\tprivate _markPriceCache!: MarkPriceCache;\n\n\t/**\n\t * Stores the fetched oracle prices for all tradable markets.\n\t * Oracle price sources includes:\n\t * - DriftClient oracle account subscriptions\n\t * - Polling DLOB server (all non-active markets)\n\t */\n\tprivate _oraclePriceCache!: OraclePriceCache;\n\n\t/**\n\t * Stores the fetched user account data for all user accounts.\n\t */\n\tprivate _userAccountCache!: UserAccountCache;\n\n\t/**\n\t * Manages real-time orderbook subscriptions via websocket.\n\t */\n\tprivate _orderbookManager!: DriftL2OrderbookManager;\n\n\t/**\n\t * Handles priority fee tracking and calculation for optimized transaction costs.\n\t */\n\tprivate priorityFeeSubscriber!: PriorityFeeSubscriber;\n\n\t/**\n\t * Stores whether the user is geographically blocked from using the service.\n\t * This is checked during subscription and cached for decorator use.\n\t */\n\tprotected _isGeoBlocked: boolean = false;\n\n\t/**\n\t * The selected trade market to use for the drift client. This is used to subscribe to the market account,\n\t * oracle data and mark price more frequently compared to the other markets.\n\t *\n\t * Example usage:\n\t * - When the UI wants to display the orderbook of this market.\n\t * - When the user is interacting with the trade form to trade on this market.\n\t */\n\tprivate selectedTradeMarket: MarketId | null = null;\n\n\t/**\n\t * The markets that are tradable through this client. This affects oracle price, mark price and market account subscriptions.\n\t */\n\tprivate _tradableMarkets: MarketId[] = [];\n\n\tprivate _spotMarketConfigs: SpotMarketConfig[] = [];\n\tprivate _perpMarketConfigs: PerpMarketConfig[] = [];\n\n\t/**\n\t * The public endpoints that can be used to retrieve Drift data / interact with the Drift program.\n\t */\n\tprivate _driftEndpoints: {\n\t\tdlobServerHttpUrl: string;\n\t\tswiftServerUrl: string;\n\t\torderbookWebsocketUrl: string;\n\t};\n\n\t/**\n\t * @param solanaRpcEndpoint - The Solana RPC endpoint to use for reading RPC data.\n\t * @param driftEnv - The drift environment to use for the drift client.\n\t * @param authority - The authority (wallet) whose user accounts to subscribe to.\n\t * @param tradableMarkets - The markets that are tradable through this client.\n\t * @param selectedTradeMarket - The active trade market to use for the drift client. This is used to subscribe to the market account, oracle data and mark price more frequently compared to the other markets.\n\t * @param additionalDriftClientConfig - Additional DriftClient config to use for the DriftClient.\n\t */\n\tconstructor(config: AuthorityDriftConfig) {\n\t\t// set up tradable markets\n\t\tthis.selectedTradeMarket = config.selectedTradeMarket ?? null;\n\n\t\tconst perpTradableMarkets = PerpMarkets[config.driftEnv].map(\n\t\t\t(marketConfig) => MarketId.createPerpMarket(marketConfig.marketIndex)\n\t\t);\n\t\tconst spotTradableMarkets = SpotMarkets[config.driftEnv].map(\n\t\t\t(marketConfig) => MarketId.createSpotMarket(marketConfig.marketIndex)\n\t\t);\n\n\t\tthis._tradableMarkets = config.tradableMarkets ?? [\n\t\t\t...perpTradableMarkets,\n\t\t\t...spotTradableMarkets,\n\t\t];\n\t\tthis._spotMarketConfigs = spotTradableMarkets.map((market) =>\n\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\tconfig.driftEnv,\n\t\t\t\tMarketType.SPOT,\n\t\t\t\tmarket.marketIndex\n\t\t\t)\n\t\t);\n\t\tthis._perpMarketConfigs = perpTradableMarkets.map((market) =>\n\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\tconfig.driftEnv,\n\t\t\t\tMarketType.PERP,\n\t\t\t\tmarket.marketIndex\n\t\t\t)\n\t\t);\n\n\t\t// set up Drift endpoints\n\t\tconst driftDlobServerHttpUrlToUse =\n\t\t\tconfig.driftDlobServerHttpUrl ??\n\t\t\tEnvironmentConstants.dlobServerHttpUrl[\n\t\t\t\tconfig.driftEnv === 'devnet' ? 'dev' : 'mainnet'\n\t\t\t];\n\t\tconst swiftServerUrlToUse =\n\t\t\tEnvironmentConstants.swiftServerUrl[\n\t\t\t\tconfig.driftEnv === 'devnet' ? 'staging' : 'mainnet'\n\t\t\t];\n\t\tconst orderbookWebsocketUrlToUse =\n\t\t\tconfig.orderbookConfig?.dlobWebSocketUrl ??\n\t\t\tEnvironmentConstants.dlobServerWsUrl[\n\t\t\t\tconfig.driftEnv === 'devnet' ? 'dev' : 'mainnet'\n\t\t\t];\n\t\tthis._driftEndpoints = {\n\t\t\tdlobServerHttpUrl: driftDlobServerHttpUrlToUse,\n\t\t\tswiftServerUrl: swiftServerUrlToUse,\n\t\t\torderbookWebsocketUrl: orderbookWebsocketUrlToUse,\n\t\t};\n\n\t\t// we set this up because SerializableTypes\n\t\tInitialize(config.driftEnv);\n\n\t\t// set up clients and stores\n\t\tconst driftClient = this.setupDriftClient(config);\n\t\tthis.initializePollingDlob(driftDlobServerHttpUrlToUse);\n\t\tthis.initializeStores(driftClient);\n\t\tthis.initializeOrderbookManager(\n\t\t\torderbookWebsocketUrlToUse,\n\t\t\tconfig.orderbookConfig?.orderbookGrouping\n\t\t);\n\t\tthis.initializePriorityFeeSubscriber(config.priorityFeeSubscriberConfig);\n\t\tthis.initializeManagers(driftDlobServerHttpUrlToUse, swiftServerUrlToUse);\n\t}\n\n\tpublic get driftClient(): DriftClient {\n\t\treturn this._driftClient;\n\t}\n\n\tpublic get authority(): PublicKey {\n\t\treturn this._driftClient.wallet.publicKey;\n\t}\n\n\tpublic get pollingDlob(): PollingDlob {\n\t\treturn this._pollingDlob;\n\t}\n\n\tpublic get oraclePriceCache(): OraclePriceLookup {\n\t\treturn this._oraclePriceCache.store;\n\t}\n\n\tpublic get markPriceCache(): MarkPriceLookup {\n\t\treturn this._markPriceCache.store;\n\t}\n\n\tpublic get userAccountCache(): UserAccountLookup {\n\t\treturn this._userAccountCache.store;\n\t}\n\n\tpublic get orderbookCache(): L2WithOracleAndMarketData | null {\n\t\treturn this._orderbookManager.store;\n\t}\n\n\tpublic get orderbookManager(): DriftL2OrderbookManager {\n\t\treturn this._orderbookManager;\n\t}\n\n\tpublic get tradableMarkets(): MarketId[] {\n\t\treturn this._tradableMarkets;\n\t}\n\n\t/**\n\t * Gets the current geoblock status of the user.\n\t *\n\t * @returns True if the user is geographically blocked, false otherwise\n\t */\n\tpublic get isGeoBlocked(): boolean {\n\t\treturn this._isGeoBlocked;\n\t}\n\n\t/**\n\t * The public endpoints that can be used to retrieve Drift data / interact with the Drift program.\n\t */\n\tpublic get driftEndpoints(): {\n\t\tdlobServerHttpUrl: string;\n\t\tswiftServerUrl: string;\n\t} {\n\t\treturn this._driftEndpoints;\n\t}\n\n\tprivate set tradableMarkets(tradableMarkets: MarketId[]) {\n\t\tthis._tradableMarkets = tradableMarkets;\n\t\tthis._spotMarketConfigs = tradableMarkets\n\t\t\t.filter((market) => !market.isPerp)\n\t\t\t.map((market) =>\n\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\tthis._driftClient.env,\n\t\t\t\t\tMarketType.SPOT,\n\t\t\t\t\tmarket.marketIndex\n\t\t\t\t)\n\t\t\t);\n\t\tthis._perpMarketConfigs = tradableMarkets\n\t\t\t.filter((market) => market.isPerp)\n\t\t\t.map((market) =>\n\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\tthis._driftClient.env,\n\t\t\t\t\tMarketType.PERP,\n\t\t\t\t\tmarket.marketIndex\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tpublic get spotMarketConfigs(): SpotMarketConfig[] {\n\t\treturn this._spotMarketConfigs;\n\t}\n\n\tpublic get perpMarketConfigs(): PerpMarketConfig[] {\n\t\treturn this._perpMarketConfigs;\n\t}\n\n\tprivate initializeStores(driftClient: DriftClient) {\n\t\tthis._markPriceCache = new MarkPriceCache();\n\t\tthis._oraclePriceCache = new OraclePriceCache();\n\t\tthis._userAccountCache = new UserAccountCache(\n\t\t\tdriftClient,\n\t\t\tthis._oraclePriceCache,\n\t\t\tthis._markPriceCache\n\t\t);\n\t}\n\n\tprivate initializeOrderbookManager(\n\t\torderbookWebsocketUrl: string,\n\t\torderbookGrouping: OrderbookGrouping = DEFAULT_ORDERBOOK_GROUPING\n\t) {\n\t\tthis._orderbookManager = new DriftL2OrderbookManager({\n\t\t\twsUrl: orderbookWebsocketUrl,\n\t\t\tsubscriptionConfig: this.selectedTradeMarket\n\t\t\t\t? {\n\t\t\t\t\t\t...DEFAULT_ORDERBOOK_SUBSCRIPTION_CONFIG,\n\t\t\t\t\t\tgrouping: orderbookGrouping,\n\t\t\t\t\t\tmarketId: this.selectedTradeMarket,\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t});\n\t}\n\n\tprivate initializePollingDlob(driftDlobServerHttpUrl: string) {\n\t\tthis._pollingDlob = new PollingDlob({\n\t\t\tdriftDlobServerHttpUrl: driftDlobServerHttpUrl,\n\t\t});\n\t}\n\n\tprivate initializePriorityFeeSubscriber(\n\t\tconfig?: Partial<PriorityFeeSubscriberConfig>\n\t) {\n\t\t// Convert tradable markets to DriftMarketInfo format for priority fee subscriber\n\t\tconst driftMarkets = this._tradableMarkets.map((market) => ({\n\t\t\tmarketType: market.marketTypeStr,\n\t\t\tmarketIndex: market.marketIndex,\n\t\t}));\n\n\t\tconst priorityFeeConfig: PriorityFeeSubscriberConfig = {\n\t\t\tconnection: this.driftClient.connection,\n\t\t\tpriorityFeeMethod: PriorityFeeMethod.SOLANA,\n\t\t\tdriftMarkets,\n\t\t\taddresses: HIGH_ACTIVITY_MARKET_ACCOUNTS,\n\t\t\t...config,\n\t\t};\n\n\t\tthis.priorityFeeSubscriber = new PriorityFeeSubscriber(priorityFeeConfig);\n\t}\n\n\tprivate setupDriftClient(\n\t\tconfig: Omit<AuthorityDriftConfig, 'onUserAccountUpdate'>\n\t) {\n\t\tconst driftEnv = config.driftEnv;\n\n\t\tconst connection = new Connection(config.solanaRpcEndpoint);\n\t\tconst driftProgramID = new PublicKey(DRIFT_PROGRAM_ID);\n\t\tconst accountLoader = new CustomizedCadenceBulkAccountLoader(\n\t\t\tconnection,\n\t\t\tDEFAULT_ACCOUNT_LOADER_COMMITMENT,\n\t\t\tDEFAULT_ACCOUNT_LOADER_POLLING_FREQUENCY_MS\n\t\t);\n\t\tthis.accountLoader = accountLoader;\n\n\t\tconst wallet = config.wallet ?? COMMON_UI_UTILS.createPlaceholderIWallet();\n\t\tconst skipInitialUsersLoad = !config.wallet;\n\n\t\tconst perpMarkets =\n\t\t\tconfig.tradableMarkets\n\t\t\t\t?.filter((market) => market.isPerp)\n\t\t\t\t.map((market) =>\n\t\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\t\tdriftEnv,\n\t\t\t\t\t\tMarketType.PERP,\n\t\t\t\t\t\tmarket.marketIndex\n\t\t\t\t\t)\n\t\t\t\t) ?? PerpMarkets[driftEnv];\n\t\tconst spotMarkets =\n\t\t\tconfig.tradableMarkets\n\t\t\t\t?.filter((market) => !market.isPerp)\n\t\t\t\t.map((market) =>\n\t\t\t\t\tMARKET_UTILS.getMarketConfig(\n\t\t\t\t\t\tdriftEnv,\n\t\t\t\t\t\tMarketType.SPOT,\n\t\t\t\t\t\tmarket.marketIndex\n\t\t\t\t\t)\n\t\t\t\t) ?? SpotMarkets[driftEnv];\n\t\tconst { perpMarketIndexes, spotMarketIndexes, oracleInfos } =\n\t\t\tgetMarketsAndOraclesForSubscription(driftEnv, perpMarkets, spotMarkets);\n\n\t\tconst driftClientConfig: DriftClientConfig = {\n\t\t\tenv: driftEnv,\n\t\t\tconnection,\n\t\t\twallet,\n\t\t\tprogramID: driftProgramID,\n\t\t\tenableMetricsEvents: false,\n\t\t\taccountSubscription: {\n\t\t\t\ttype: 'polling',\n\t\t\t\taccountLoader,\n\t\t\t},\n\t\t\tuserStats: true,\n\t\t\tincludeDelegates: true,\n\t\t\tskipLoadUsers: skipInitialUsersLoad,\n\t\t\tdelistedMarketSetting: DelistedMarketSetting.Unsubscribe,\n\t\t\tperpMarketIndexes,\n\t\t\tspotMarketIndexes,\n\t\t\toracleInfos,\n\t\t\t...config.additionalDriftClientConfig,\n\t\t};\n\t\tthis._driftClient = new DriftClient(driftClientConfig);\n\n\t\tconst txSender = new WhileValidTxSender({\n\t\t\tconnection,\n\t\t\twallet,\n\t\t\tadditionalConnections: [],\n\t\t\tadditionalTxSenderCallbacks: [],\n\t\t\ttxHandler: this._driftClient.txHandler,\n\t\t\tconfirmationStrategy: DEFAULT_TX_SENDER_CONFIRMATION_STRATEGY,\n\t\t\tretrySleep: DEFAULT_TX_SENDER_RETRY_INTERVAL,\n\t\t});\n\n\t\tthis._driftClient.txSender = txSender;\n\n\t\treturn this._driftClient;\n\t}\n\n\tprivate setupOrderbookManager() {\n\t\tthis.orderbookSubscription = this._orderbookManager.onUpdate(\n\t\t\t(orderbookData) => {\n\t\t\t\tconst marketKey = new MarketId(\n\t\t\t\t\torderbookData.marketIndex,\n\t\t\t\t\tENUM_UTILS.toObj(orderbookData.marketType as string) as MarketType\n\t\t\t\t).key;\n\n\t\t\t\tconst markPrice = orderbookData.markPrice;\n\n\t\t\t\tthis._markPriceCache.updateMarkPrices({\n\t\t\t\t\tmarketKey,\n\t\t\t\t\tmarkPrice,\n\t\t\t\t\tbestAsk: orderbookData.bestAskPrice,\n\t\t\t\t\tbestBid: orderbookData.bestBidPrice,\n\t\t\t\t\tlastUpdateSlot: orderbookData.slot ?? 0,\n\t\t\t\t});\n\n\t\t\t\tthis._oraclePriceCache.updateOraclePrices({\n\t\t\t\t\t...orderbookData.oracleData,\n\t\t\t\t\tmarketKey,\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tprivate setupPollingDlob() {\n\t\t// DriftL2OrderbookManager will handle the fetching of data for the selected trade market through websocket\n\n\t\tthis._pollingDlob.addInterval(\n\t\t\tPollingCategory.USER_INVOLVED,\n\t\t\tPOLLING_INTERVALS.BACKGROUND_DEEP,\n\t\t\tPOLLING_DEPTHS.DEEP\n\t\t); // markets that the user is involved in\n\t\tthis._pollingDlob.addInterval(\n\t\t\tPollingCategory.USER_NOT_INVOLVED,\n\t\t\tPOLLING_INTERVALS.BACKGROUND_SHALLOW,\n\t\t\tPOLLING_DEPTHS.SHALLOW\n\t\t); // markets that the user is not involved in\n\n\t\t// add all markets to the user-not-involved interval first, until user-involved markets are known\n\t\tthis._pollingDlob.addMarketsToInterval(\n\t\t\tPollingCategory.USER_NOT_INVOLVED,\n\t\t\tthis._tradableMarkets.map((market) => market.key)\n\t\t);\n\n\t\tthis.pollingDlobSubscription = this._pollingDlob\n\t\t\t.onData()\n\t\t\t.subscribe((data) => {\n\t\t\t\tconst updatedMarkPrices = data.map((marketData) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarketKey: marketData.marketId.key,\n\t\t\t\t\t\tmarkPrice: marketData.data.markPrice,\n\t\t\t\t\t\tbestBid: marketData.data.bestBidPrice,\n\t\t\t\t\t\tbestAsk: marketData.data.bestAskPrice,\n\t\t\t\t\t\tlastUpdateSlot: marketData.data.slot ?? 0,\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tconst updatedOraclePrices = data.map((marketData) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarketKey: marketData.marketId.key,\n\t\t\t\t\t\t...marketData.data.oracleData,\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tthis._markPriceCache.updateMarkPrices(...updatedMarkPrices);\n\t\t\t\tthis._oraclePriceCache.updateOraclePrices(...updatedOraclePrices);\n\t\t\t});\n\t}\n\n\tprivate initializeManagers(\n\t\tdlobServerHttpUrl: string,\n\t\tswiftServerUrl: string\n\t) {\n\t\t// Initialize trading operations\n\t\tthis.driftOperations = new DriftOperations(\n\t\t\tthis._driftClient,\n\t\t\t() => this._userAccountCache,\n\t\t\tdlobServerHttpUrl,\n\t\t\tswiftServerUrl,\n\t\t\t() => this.priorityFeeSubscriber.getCustomStrategyResult()\n\t\t);\n\n\t\t// Initialize subscription manager with all subscription and market operations\n\t\tthis.subscriptionManager = new SubscriptionManager(\n\t\t\tthis._driftClient,\n\t\t\tthis.accountLoader,\n\t\t\tthis._pollingDlob,\n\t\t\tthis._orderbookManager,\n\t\t\tthis._userAccountCache,\n\t\t\tthis._tradableMarkets,\n\t\t\tthis.selectedTradeMarket\n\t\t);\n\t}\n\n\tprivate unsubscribeFromPollingDlob() {\n\t\tthis.pollingDlobSubscription?.unsubscribe();\n\t\tthis.pollingDlobSubscription = null;\n\n\t\tthis._pollingDlob.stop();\n\t}\n\n\tprivate unsubscribeFromOrderbook() {\n\t\tthis.orderbookSubscription?.unsubscribe();\n\t\tthis.orderbookSubscription = null;\n\n\t\tthis._orderbookManager.unsubscribe();\n\t}\n\n\tpublic async subscribe() {\n\t\tconst handleGeoBlock = async () => {\n\t\t\ttry {\n\t\t\t\tthis._isGeoBlocked = (await checkGeoBlock()) ?? false;\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to check geoblock status:', error);\n\t\t\t\tthis._isGeoBlocked = false; // Default to not blocked if check fails\n\t\t\t}\n\t\t};\n\n\t\t// async logic that doesn't require DriftClient to be subscribed\n\t\tconst handleGeoBlockPromise = handleGeoBlock();\n\t\tconst pollingDlobStartPromise = this._pollingDlob.start();\n\t\tconst priorityFeeSubscribePromise = this.priorityFeeSubscriber.subscribe();\n\t\tconst orderbookSubscribePromise = this._orderbookManager.subscribe();\n\n\t\tawait this._driftClient.subscribe();\n\n\t\t// filter out markets that are delisted\n\t\tconst actualTradableMarkets = this._tradableMarkets.filter((market) => {\n\t\t\tconst marketAccount = market.isPerp\n\t\t\t\t? this._driftClient.getPerpMarketAccount(market.marketIndex)\n\t\t\t\t: this._driftClient.getSpotMarketAccount(market.marketIndex);\n\n\t\t\tif (\n\t\t\t\t!marketAccount ||\n\t\t\t\tDELISTED_MARKET_STATUSES.some((marketStatus) =>\n\t\t\t\t\tENUM_UTILS.match(marketAccount.status, marketStatus)\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\n\t\tthis._tradableMarkets = actualTradableMarkets;\n\t\tthis.subscriptionManager.updateTradableMarkets(actualTradableMarkets);\n\t\tthis.setupPollingDlob();\n\t\tthis.setupOrderbookManager();\n\n\t\tconst subscribeToNonWhitelistedButUserInvolvedMarketsPromise =\n\t\t\tthis.subscriptionManager.subscribeToNonWhitelistedButUserInvolvedMarkets(\n\t\t\t\tthis._driftClient.getUsers()\n\t\t\t);\n\n\t\tawait Promise.all([\n\t\t\tpollingDlobStartPromise,\n\t\t\tsubscribeToNonWhitelistedButUserInvolvedMarketsPromise,\n\t\t\tpriorityFeeSubscribePromise,\n\t\t\thandleGeoBlockPromise,\n\t\t\torderbookSubscribePromise,\n\t\t]);\n\n\t\tthis.subscriptionManager.subscribeToAllUsersUpdates();\n\n\t\t// TODO: subscribe to oracle price updates from drift client?\n\t}\n\n\tpublic async unsubscribe() {\n\t\tthis.unsubscribeFromPollingDlob();\n\t\tthis.unsubscribeFromOrderbook();\n\t\tthis._userAccountCache.destroy();\n\t\tthis._markPriceCache.destroy();\n\t\tthis._orderbookManager.destroy();\n\n\t\tconst driftClientUnsubscribePromise = this._driftClient.unsubscribe();\n\t\tconst priorityFeeUnsubscribePromise =\n\t\t\tthis.priorityFeeSubscriber.unsubscribe();\n\n\t\tawait Promise.all(\n\t\t\t[driftClientUnsubscribePromise, priorityFeeUnsubscribePromise].filter(\n\t\t\t\tBoolean\n\t\t\t)\n\t\t);\n\n\t\tthis.pollingDlobSubscription = null;\n\t}\n\n\tpublic onOraclePricesUpdate(\n\t\tcallback: (oraclePrice: OraclePriceLookup) => void\n\t) {\n\t\treturn this._oraclePriceCache.onUpdate(callback);\n\t}\n\n\tpublic onMarkPricesUpdate(callback: (markPrice: MarkPriceLookup) => void) {\n\t\treturn this._markPriceCache.onUpdate(callback);\n\t}\n\n\tpublic onUserAccountUpdate(\n\t\tcallback: (userAccount: EnhancedAccountData) => void\n\t) {\n\t\treturn this._userAccountCache.onUpdate(callback);\n\t}\n\n\tpublic onOrderbookUpdate(\n\t\tcallback: (orderbook: L2WithOracleAndMarketData) => void\n\t) {\n\t\treturn this._orderbookManager.onUpdate(callback);\n\t}\n\n\t/**\n\t * Updates the authority (wallet) for the drift client and reestablishes subscriptions.\n\t *\n\t * @param wallet - The new wallet to use as authority\n\t * @param activeSubAccountId - Optional subaccount ID to switch to after wallet update\n\t */\n\tpublic async updateAuthority(wallet: IWallet, activeSubAccountId?: number) {\n\t\treturn this.subscriptionManager.updateAuthority(wallet, activeSubAccountId);\n\t}\n\n\t/**\n\t * Updates the selected trade market and optimizes subscription polling.\n\t *\n\t * @param newSelectedTradeMarket - The new market to prioritize for trading\n\t */\n\tpublic updateSelectedTradeMarket(newSelectedTradeMarket: MarketId | null) {\n\t\tconst isNewSelectedTradeMarket =\n\t\t\t!!newSelectedTradeMarket !== !!this.selectedTradeMarket || // only one of them is null\n\t\t\t(!!newSelectedTradeMarket && // or both are not null and are different\n\t\t\t\t!!this.selectedTradeMarket &&\n\t\t\t\t!this.selectedTradeMarket.equals(newSelectedTradeMarket));\n\n\t\tif (!isNewSelectedTradeMarket) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the local reference\n\t\tthis.selectedTradeMarket = newSelectedTradeMarket;\n\n\t\t// Delegate to subscription manager for all polling optimization\n\t\tthis.subscriptionManager.updateSelectedTradeMarket(newSelectedTradeMarket);\n\t}\n\n\t/**\n\t * Creates a new user account and deposits initial collateral.\n\t *\n\t * @param params - Parameters for creating user and depositing collateral\n\t * @returns Promise resolving to transaction signature and user account public key\n\t */\n\tpublic async createUserAndDeposit(\n\t\tparams: CreateUserAndDepositParams\n\t): Promise<{\n\t\ttxSig: TransactionSignature;\n\t\tuser: User;\n\t}> {\n\t\treturn this.driftOperations.createUserAndDeposit(params);\n\t}\n\n\t/**\n\t * Creates a RevenueShareEscrow account for the user.\n\t *\n\t * @param params - Parameters for creating a RevenueShareEscrow account\n\t * @returns Promise resolving to the transaction signature of the creation\n\t */\n\tpublic async createRevenueShareEscrow(\n\t\tparams: CreateRevenueShareEscrowParams\n\t): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.createRevenueShareEscrow(params);\n\t}\n\n\t/**\n\t * Deposits collateral into a user's spot market position.\n\t *\n\t * @param params - Parameters for the deposit operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async deposit(params: DepositParams): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.deposit(params);\n\t}\n\n\t/**\n\t * Withdraws collateral from a user's spot market position.\n\t *\n\t * @param params - Parameters for the withdrawal operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async withdraw(params: WithdrawParams): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.withdraw(params);\n\t}\n\n\t/**\n\t * Opens a perpetual market order.\n\t *\n\t * @param params - Parameters for the perp order\n\t * @returns Promise resolving to the transaction signature\n\t */\n\t@enforceGeoBlock\n\tpublic async openPerpOrder(\n\t\tparams: PerpOrderParams\n\t): Promise<TransactionSignature | void> {\n\t\treturn this.driftOperations.openPerpOrder(params);\n\t}\n\n\t/**\n\t * Executes a swap between two spot markets.\n\t *\n\t * @param params - Parameters for the swap operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async swap(params: SwapParams): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.swap(params);\n\t}\n\n\tpublic async getSwapQuote(\n\t\tparams: Omit<SwapParams, 'jupiterQuote'> & {\n\t\t\tslippageBps?: number;\n\t\t\tswapMode?: SwapMode;\n\t\t\tonlyDirectRoutes?: boolean;\n\t\t}\n\t): Promise<QuoteResponse> {\n\t\treturn this.driftOperations.getSwapQuote(params);\n\t}\n\n\t/**\n\t * Settles profit and loss for a perpetual position.\n\t *\n\t * @param params - Parameters for the settle PnL operation\n\t * @returns Promise resolving to the transaction signature\n\t */\n\tpublic async settleAccountPnl(\n\t\tparams: SettleAccountPnlParams\n\t): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.settleAccountPnl(params);\n\t}\n\n\t/**\n\t * Deletes a user account from the Drift protocol.\n\t *\n\t * @param subAccountId - The ID of the sub-account to delete\n\t * @returns Promise resolving to the transaction signature of the deletion\n\t */\n\tpublic async deleteUser(subAccountId: number): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.deleteUser(subAccountId);\n\t}\n\n\t/**\n\t * Cancels a list of open orders.\n\t *\n\t * @param params - See `CancelOrdersParams`\n\t * @returns Promise resolving to the transaction signature of the cancellation\n\t */\n\tpublic async cancelOrders(\n\t\tparams: CancelOrdersParams\n\t): Promise<TransactionSignature> {\n\t\treturn this.driftOperations.cancelOrders(params);\n\t}\n\n\tpublic getTxParams(overrides?: Partial<TxParams>): TxParams {\n\t\treturn this.driftOperations.getTxParams(overrides);\n\t}\n}\n"]}
@@ -0,0 +1,62 @@
1
+ import { DriftClient } from '@drift-labs/sdk';
2
+ import { Transaction, TransactionInstruction, VersionedTransaction, PublicKey } from '@solana/web3.js';
3
+ import { WithTxnParams } from '../../types';
4
+ interface CreateRevenueShareAccountIxParams {
5
+ driftClient: DriftClient;
6
+ /**
7
+ * The authority of the revenue share account to be created.
8
+ * This is typically the builder's public key.
9
+ */
10
+ authority: PublicKey;
11
+ /**
12
+ * The public key of the account that will pay for the revenue share account rent.
13
+ * If not provided, the authority provided will be the payer.
14
+ */
15
+ payer?: PublicKey;
16
+ }
17
+ /**
18
+ * Creates a transaction instruction to initialize a RevenueShare account for a builder.
19
+ *
20
+ * The RevenueShare account tracks cumulative builder fees earned from routing trades.
21
+ * This must be initialized before a builder can receive builder fees.
22
+ *
23
+ * @param driftClient - The Drift client instance
24
+ * @param authority - The public key of the builder who will own this revenue share account
25
+ * @param payer - The public key of the account that will pay for the revenue share account rent. If not provided, the authority provided will be the payer.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const instruction = await createRevenueShareAccountIx({
30
+ * driftClient,
31
+ * authority: builderPublicKey
32
+ * });
33
+ * ```
34
+ */
35
+ export declare const createRevenueShareAccountIx: (params: CreateRevenueShareAccountIxParams) => Promise<TransactionInstruction>;
36
+ /**
37
+ * Creates a transaction to initialize a RevenueShare account for a builder.
38
+ *
39
+ * The RevenueShare account tracks cumulative builder fees earned from routing trades.
40
+ * This must be initialized before a builder can receive builder code fees.
41
+ *
42
+ * @param driftClient - The Drift client instance
43
+ * @param authority - The public key of the builder who will own this revenue share account
44
+ * @param txParams - Optional transaction parameters for customizing the transaction
45
+ *
46
+ * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * // Initialize a revenue share account for a builder
51
+ * const transaction = await createRevenueShareAccountTxn({
52
+ * driftClient,
53
+ * authority: builderPublicKey,
54
+ * txParams: { computeUnits: 200000 }
55
+ * });
56
+ *
57
+ * // Sign and send the transaction
58
+ * const signature = await wallet.sendTransaction(transaction, connection);
59
+ * ```
60
+ */
61
+ export declare const createRevenueShareAccountTxn: (params: WithTxnParams<CreateRevenueShareAccountIxParams>) => Promise<Transaction | VersionedTransaction>;
62
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRevenueShareAccountTxn = exports.createRevenueShareAccountIx = void 0;
4
+ /**
5
+ * Creates a transaction instruction to initialize a RevenueShare account for a builder.
6
+ *
7
+ * The RevenueShare account tracks cumulative builder fees earned from routing trades.
8
+ * This must be initialized before a builder can receive builder fees.
9
+ *
10
+ * @param driftClient - The Drift client instance
11
+ * @param authority - The public key of the builder who will own this revenue share account
12
+ * @param payer - The public key of the account that will pay for the revenue share account rent. If not provided, the authority provided will be the payer.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const instruction = await createRevenueShareAccountIx({
17
+ * driftClient,
18
+ * authority: builderPublicKey
19
+ * });
20
+ * ```
21
+ */
22
+ const createRevenueShareAccountIx = async (params) => {
23
+ var _a;
24
+ const { driftClient, authority } = params;
25
+ return driftClient.getInitializeRevenueShareIx(authority, {
26
+ payer: (_a = params.payer) !== null && _a !== void 0 ? _a : authority,
27
+ });
28
+ };
29
+ exports.createRevenueShareAccountIx = createRevenueShareAccountIx;
30
+ /**
31
+ * Creates a transaction to initialize a RevenueShare account for a builder.
32
+ *
33
+ * The RevenueShare account tracks cumulative builder fees earned from routing trades.
34
+ * This must be initialized before a builder can receive builder code fees.
35
+ *
36
+ * @param driftClient - The Drift client instance
37
+ * @param authority - The public key of the builder who will own this revenue share account
38
+ * @param txParams - Optional transaction parameters for customizing the transaction
39
+ *
40
+ * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // Initialize a revenue share account for a builder
45
+ * const transaction = await createRevenueShareAccountTxn({
46
+ * driftClient,
47
+ * authority: builderPublicKey,
48
+ * txParams: { computeUnits: 200000 }
49
+ * });
50
+ *
51
+ * // Sign and send the transaction
52
+ * const signature = await wallet.sendTransaction(transaction, connection);
53
+ * ```
54
+ */
55
+ const createRevenueShareAccountTxn = async (params) => {
56
+ return params.driftClient.buildTransaction(await (0, exports.createRevenueShareAccountIx)(params), params.txParams);
57
+ };
58
+ exports.createRevenueShareAccountTxn = createRevenueShareAccountTxn;
59
+ //# sourceMappingURL=createRevenueShareAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRevenueShareAccount.js","sourceRoot":"","sources":["../../../../../src/drift/base/actions/builder/createRevenueShareAccount.ts"],"names":[],"mappings":";;;AAuBA;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,2BAA2B,GAAG,KAAK,EAC/C,MAAyC,EACP,EAAE;;IACpC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAE1C,OAAO,WAAW,CAAC,2BAA2B,CAAC,SAAS,EAAE;QACzD,KAAK,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,SAAS;KAChC,CAAC,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,2BAA2B,+BAQtC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,4BAA4B,GAAG,KAAK,EAChD,MAAwD,EACV,EAAE;IAChD,OAAO,MAAM,CAAC,WAAW,CAAC,gBAAgB,CACzC,MAAM,IAAA,mCAA2B,EAAC,MAAM,CAAC,EACzC,MAAM,CAAC,QAAQ,CACf,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,4BAA4B,gCAOvC","sourcesContent":["import { DriftClient } from '@drift-labs/sdk';\nimport {\n\tTransaction,\n\tTransactionInstruction,\n\tVersionedTransaction,\n\tPublicKey,\n} from '@solana/web3.js';\nimport { WithTxnParams } from '../../types';\n\ninterface CreateRevenueShareAccountIxParams {\n\tdriftClient: DriftClient;\n\t/**\n\t * The authority of the revenue share account to be created.\n\t * This is typically the builder's public key.\n\t */\n\tauthority: PublicKey;\n\t/**\n\t * The public key of the account that will pay for the revenue share account rent.\n\t * If not provided, the authority provided will be the payer.\n\t */\n\tpayer?: PublicKey;\n}\n\n/**\n * Creates a transaction instruction to initialize a RevenueShare account for a builder.\n *\n * The RevenueShare account tracks cumulative builder fees earned from routing trades.\n * This must be initialized before a builder can receive builder fees.\n *\n * @param driftClient - The Drift client instance\n * @param authority - The public key of the builder who will own this revenue share account\n * @param payer - The public key of the account that will pay for the revenue share account rent. If not provided, the authority provided will be the payer.\n *\n * @example\n * ```typescript\n * const instruction = await createRevenueShareAccountIx({\n * driftClient,\n * authority: builderPublicKey\n * });\n * ```\n */\nexport const createRevenueShareAccountIx = async (\n\tparams: CreateRevenueShareAccountIxParams\n): Promise<TransactionInstruction> => {\n\tconst { driftClient, authority } = params;\n\n\treturn driftClient.getInitializeRevenueShareIx(authority, {\n\t\tpayer: params.payer ?? authority,\n\t});\n};\n\n/**\n * Creates a transaction to initialize a RevenueShare account for a builder.\n *\n * The RevenueShare account tracks cumulative builder fees earned from routing trades.\n * This must be initialized before a builder can receive builder code fees.\n *\n * @param driftClient - The Drift client instance\n * @param authority - The public key of the builder who will own this revenue share account\n * @param txParams - Optional transaction parameters for customizing the transaction\n *\n * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing\n *\n * @example\n * ```typescript\n * // Initialize a revenue share account for a builder\n * const transaction = await createRevenueShareAccountTxn({\n * driftClient,\n * authority: builderPublicKey,\n * txParams: { computeUnits: 200000 }\n * });\n *\n * // Sign and send the transaction\n * const signature = await wallet.sendTransaction(transaction, connection);\n * ```\n */\nexport const createRevenueShareAccountTxn = async (\n\tparams: WithTxnParams<CreateRevenueShareAccountIxParams>\n): Promise<Transaction | VersionedTransaction> => {\n\treturn params.driftClient.buildTransaction(\n\t\tawait createRevenueShareAccountIx(params),\n\t\tparams.txParams\n\t);\n};\n"]}
@@ -0,0 +1,126 @@
1
+ import { DriftClient } from '@drift-labs/sdk';
2
+ import { Transaction, TransactionInstruction, VersionedTransaction, PublicKey } from '@solana/web3.js';
3
+ import { WithTxnParams } from '../../types';
4
+ interface CreateRevenueShareEscrowIxParams {
5
+ driftClient: DriftClient;
6
+ /**
7
+ * The authority (owner) of the revenue share escrow account to be created.
8
+ * This is typically the user/taker's public key.
9
+ */
10
+ authority: PublicKey;
11
+ /**
12
+ * Number of order slots to allocate in the escrow account.
13
+ * This determines how many concurrent builder orders can be tracked.
14
+ * Recommended: 8-32 for typical users, up to 128 maximum.
15
+ */
16
+ numOrders?: number;
17
+ /**
18
+ * The public key of the account that will pay for the revenue share escrow account rent.
19
+ * If not provided, the authority provided will be the payer.
20
+ */
21
+ payer?: PublicKey;
22
+ }
23
+ /**
24
+ * Creates a transaction instruction to initialize a `RevenueShareEscrow` account for a user.
25
+ *
26
+ * The RevenueShareEscrow account stores:
27
+ * - List of approved builders with their max fee caps
28
+ * - Pending builder fee orders waiting to be settled
29
+ *
30
+ * Users must initialize this account before they can place orders with builder codes.
31
+ *
32
+ * **Important**: `numOrders` determines CONCURRENT order capacity, not lifetime total orders.
33
+ * When the escrow is full, new orders will succeed but builder fees won't be tracked.
34
+ * See README_ORDER_LIMITS.md for capacity planning guidance.
35
+ *
36
+ * @param driftClient - The Drift client instance
37
+ * @param authority - The public key of the user who will own this escrow account
38
+ * @param numOrders - Number of concurrent order slots (default: 16, range: 1-128)
39
+ * - 8: Casual traders (2-3 markets, occasional trading)
40
+ * - 16: Active traders (3-5 markets, regular trading) ← Recommended default
41
+ * - 32-64: Power users (many markets, frequent trading)
42
+ * - 128: Maximum capacity (institutional usage)
43
+ * @param payer - The public key of the account that will pay for the revenue share escrow account rent
44
+ *
45
+ * @returns Promise resolving to a TransactionInstruction that initializes the revenue share escrow
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * // Default configuration (16 order slots)
50
+ * const instruction = await createRevenueShareEscrowIx({
51
+ * driftClient,
52
+ * authority: userPublicKey
53
+ * });
54
+ *
55
+ * // Custom configuration for power user
56
+ * const instruction = await createRevenueShareEscrowIx({
57
+ * driftClient,
58
+ * authority: userPublicKey,
59
+ * numOrders: 32 // More concurrent capacity
60
+ * });
61
+ * ```
62
+ */
63
+ export declare const createRevenueShareEscrowIx: ({ driftClient, authority, numOrders, payer, }: CreateRevenueShareEscrowIxParams) => Promise<TransactionInstruction>;
64
+ interface CreateRevenueShareEscrowTxnParams extends WithTxnParams<CreateRevenueShareEscrowIxParams> {
65
+ /**
66
+ * The builder to add to the escrow account.
67
+ */
68
+ builder?: {
69
+ /**
70
+ * The public key of the builder to add to the escrow account.
71
+ */
72
+ builderAuthority: PublicKey;
73
+ /**
74
+ * The maximum fee the builder can charge, in tenths of basis points.
75
+ */
76
+ maxFeeTenthBps: number;
77
+ };
78
+ }
79
+ /**
80
+ * Creates a transaction to initialize a RevenueShareEscrow account for a user.
81
+ *
82
+ * The RevenueShareEscrow account stores:
83
+ * - List of approved builders with their max fee caps
84
+ * - Pending builder fee orders waiting to be settled
85
+ *
86
+ * Users must initialize this account before they can place orders with builder codes.
87
+ *
88
+ * **Important**: `numOrders` determines CONCURRENT order capacity, not lifetime total orders.
89
+ * When the escrow is full, new orders will succeed but builder fees won't be tracked.
90
+ * See README_ORDER_LIMITS.md for capacity planning guidance.
91
+ *
92
+ * @param driftClient - The Drift client instance
93
+ * @param authority - The public key of the user who will own this escrow account
94
+ * @param numOrders - Number of concurrent order slots (default: 16, range: 1-128)
95
+ * - 8: Casual traders (2-3 markets, occasional trading)
96
+ * - 16: Active traders (3-5 markets, regular trading) ← Recommended default
97
+ * - 32-64: Power users (many markets, frequent trading)
98
+ * - 128: Maximum capacity (institutional usage)
99
+ * @param payer - The public key of the account that will pay for the revenue share escrow account rent
100
+ * @param txParams - Optional transaction parameters for customizing the transaction
101
+ *
102
+ * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // Default configuration (16 order slots)
107
+ * const transaction = await createRevenueShareEscrowTxn({
108
+ * driftClient,
109
+ * authority: userPublicKey,
110
+ * txParams: { computeUnits: 300000 }
111
+ * });
112
+ *
113
+ * // Custom configuration for power user
114
+ * const transaction = await createRevenueShareEscrowTxn({
115
+ * driftClient,
116
+ * authority: userPublicKey,
117
+ * numOrders: 32, // More concurrent capacity
118
+ * txParams: { computeUnits: 300000 }
119
+ * });
120
+ *
121
+ * // Sign and send the transaction
122
+ * const signature = await wallet.sendTransaction(transaction, connection);
123
+ * ```
124
+ */
125
+ export declare const createRevenueShareEscrowTxn: (params: CreateRevenueShareEscrowTxnParams) => Promise<Transaction | VersionedTransaction>;
126
+ export {};
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRevenueShareEscrowTxn = exports.createRevenueShareEscrowIx = void 0;
4
+ const manageBuilder_1 = require("./manageBuilder");
5
+ /**
6
+ * Creates a transaction instruction to initialize a `RevenueShareEscrow` account for a user.
7
+ *
8
+ * The RevenueShareEscrow account stores:
9
+ * - List of approved builders with their max fee caps
10
+ * - Pending builder fee orders waiting to be settled
11
+ *
12
+ * Users must initialize this account before they can place orders with builder codes.
13
+ *
14
+ * **Important**: `numOrders` determines CONCURRENT order capacity, not lifetime total orders.
15
+ * When the escrow is full, new orders will succeed but builder fees won't be tracked.
16
+ * See README_ORDER_LIMITS.md for capacity planning guidance.
17
+ *
18
+ * @param driftClient - The Drift client instance
19
+ * @param authority - The public key of the user who will own this escrow account
20
+ * @param numOrders - Number of concurrent order slots (default: 16, range: 1-128)
21
+ * - 8: Casual traders (2-3 markets, occasional trading)
22
+ * - 16: Active traders (3-5 markets, regular trading) ← Recommended default
23
+ * - 32-64: Power users (many markets, frequent trading)
24
+ * - 128: Maximum capacity (institutional usage)
25
+ * @param payer - The public key of the account that will pay for the revenue share escrow account rent
26
+ *
27
+ * @returns Promise resolving to a TransactionInstruction that initializes the revenue share escrow
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Default configuration (16 order slots)
32
+ * const instruction = await createRevenueShareEscrowIx({
33
+ * driftClient,
34
+ * authority: userPublicKey
35
+ * });
36
+ *
37
+ * // Custom configuration for power user
38
+ * const instruction = await createRevenueShareEscrowIx({
39
+ * driftClient,
40
+ * authority: userPublicKey,
41
+ * numOrders: 32 // More concurrent capacity
42
+ * });
43
+ * ```
44
+ */
45
+ const createRevenueShareEscrowIx = async ({ driftClient, authority, numOrders = 16, payer, }) => {
46
+ return driftClient.getInitializeRevenueShareEscrowIx(authority, numOrders, {
47
+ payer: payer !== null && payer !== void 0 ? payer : authority,
48
+ });
49
+ };
50
+ exports.createRevenueShareEscrowIx = createRevenueShareEscrowIx;
51
+ /**
52
+ * Creates a transaction to initialize a RevenueShareEscrow account for a user.
53
+ *
54
+ * The RevenueShareEscrow account stores:
55
+ * - List of approved builders with their max fee caps
56
+ * - Pending builder fee orders waiting to be settled
57
+ *
58
+ * Users must initialize this account before they can place orders with builder codes.
59
+ *
60
+ * **Important**: `numOrders` determines CONCURRENT order capacity, not lifetime total orders.
61
+ * When the escrow is full, new orders will succeed but builder fees won't be tracked.
62
+ * See README_ORDER_LIMITS.md for capacity planning guidance.
63
+ *
64
+ * @param driftClient - The Drift client instance
65
+ * @param authority - The public key of the user who will own this escrow account
66
+ * @param numOrders - Number of concurrent order slots (default: 16, range: 1-128)
67
+ * - 8: Casual traders (2-3 markets, occasional trading)
68
+ * - 16: Active traders (3-5 markets, regular trading) ← Recommended default
69
+ * - 32-64: Power users (many markets, frequent trading)
70
+ * - 128: Maximum capacity (institutional usage)
71
+ * @param payer - The public key of the account that will pay for the revenue share escrow account rent
72
+ * @param txParams - Optional transaction parameters for customizing the transaction
73
+ *
74
+ * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * // Default configuration (16 order slots)
79
+ * const transaction = await createRevenueShareEscrowTxn({
80
+ * driftClient,
81
+ * authority: userPublicKey,
82
+ * txParams: { computeUnits: 300000 }
83
+ * });
84
+ *
85
+ * // Custom configuration for power user
86
+ * const transaction = await createRevenueShareEscrowTxn({
87
+ * driftClient,
88
+ * authority: userPublicKey,
89
+ * numOrders: 32, // More concurrent capacity
90
+ * txParams: { computeUnits: 300000 }
91
+ * });
92
+ *
93
+ * // Sign and send the transaction
94
+ * const signature = await wallet.sendTransaction(transaction, connection);
95
+ * ```
96
+ */
97
+ const createRevenueShareEscrowTxn = async (params) => {
98
+ var _a;
99
+ const createIx = await (0, exports.createRevenueShareEscrowIx)(params);
100
+ const ixs = [createIx];
101
+ if (params.builder) {
102
+ const addBuilderIx = await (0, manageBuilder_1.manageBuilderIx)({
103
+ driftClient: params.driftClient,
104
+ authority: params.authority,
105
+ builderAuthority: params.builder.builderAuthority,
106
+ maxFeeTenthBps: params.builder.maxFeeTenthBps,
107
+ payer: (_a = params.payer) !== null && _a !== void 0 ? _a : params.authority,
108
+ });
109
+ ixs.push(addBuilderIx);
110
+ }
111
+ return params.driftClient.buildTransaction(ixs, params.txParams);
112
+ };
113
+ exports.createRevenueShareEscrowTxn = createRevenueShareEscrowTxn;
114
+ //# sourceMappingURL=createRevenueShareEscrow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRevenueShareEscrow.js","sourceRoot":"","sources":["../../../../../src/drift/base/actions/builder/createRevenueShareEscrow.ts"],"names":[],"mappings":";;;AAQA,mDAAkD;AAsBlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACI,MAAM,0BAA0B,GAAG,KAAK,EAAE,EAChD,WAAW,EACX,SAAS,EACT,SAAS,GAAG,EAAE,EACd,KAAK,GAC6B,EAAmC,EAAE;IACvE,OAAO,WAAW,CAAC,iCAAiC,CAAC,SAAS,EAAE,SAAS,EAAE;QAC1E,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,SAAS;KACzB,CAAC,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,0BAA0B,8BASrC;AAmBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACI,MAAM,2BAA2B,GAAG,KAAK,EAC/C,MAAyC,EACK,EAAE;;IAChD,MAAM,QAAQ,GAAG,MAAM,IAAA,kCAA0B,EAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEvB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,YAAY,GAAG,MAAM,IAAA,+BAAe,EAAC;YAC1C,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB;YACjD,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,cAAc;YAC7C,KAAK,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,MAAM,CAAC,SAAS;SACvC,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;AAClE,CAAC,CAAC;AAnBW,QAAA,2BAA2B,+BAmBtC","sourcesContent":["import { DriftClient } from '@drift-labs/sdk';\nimport {\n\tTransaction,\n\tTransactionInstruction,\n\tVersionedTransaction,\n\tPublicKey,\n} from '@solana/web3.js';\nimport { WithTxnParams } from '../../types';\nimport { manageBuilderIx } from './manageBuilder';\n\ninterface CreateRevenueShareEscrowIxParams {\n\tdriftClient: DriftClient;\n\t/**\n\t * The authority (owner) of the revenue share escrow account to be created.\n\t * This is typically the user/taker's public key.\n\t */\n\tauthority: PublicKey;\n\t/**\n\t * Number of order slots to allocate in the escrow account.\n\t * This determines how many concurrent builder orders can be tracked.\n\t * Recommended: 8-32 for typical users, up to 128 maximum.\n\t */\n\tnumOrders?: number;\n\t/**\n\t * The public key of the account that will pay for the revenue share escrow account rent.\n\t * If not provided, the authority provided will be the payer.\n\t */\n\tpayer?: PublicKey;\n}\n\n/**\n * Creates a transaction instruction to initialize a `RevenueShareEscrow` account for a user.\n *\n * The RevenueShareEscrow account stores:\n * - List of approved builders with their max fee caps\n * - Pending builder fee orders waiting to be settled\n *\n * Users must initialize this account before they can place orders with builder codes.\n *\n * **Important**: `numOrders` determines CONCURRENT order capacity, not lifetime total orders.\n * When the escrow is full, new orders will succeed but builder fees won't be tracked.\n * See README_ORDER_LIMITS.md for capacity planning guidance.\n *\n * @param driftClient - The Drift client instance\n * @param authority - The public key of the user who will own this escrow account\n * @param numOrders - Number of concurrent order slots (default: 16, range: 1-128)\n * - 8: Casual traders (2-3 markets, occasional trading)\n * - 16: Active traders (3-5 markets, regular trading) ← Recommended default\n * - 32-64: Power users (many markets, frequent trading)\n * - 128: Maximum capacity (institutional usage)\n * @param payer - The public key of the account that will pay for the revenue share escrow account rent\n *\n * @returns Promise resolving to a TransactionInstruction that initializes the revenue share escrow\n *\n * @example\n * ```typescript\n * // Default configuration (16 order slots)\n * const instruction = await createRevenueShareEscrowIx({\n * driftClient,\n * authority: userPublicKey\n * });\n *\n * // Custom configuration for power user\n * const instruction = await createRevenueShareEscrowIx({\n * driftClient,\n * authority: userPublicKey,\n * numOrders: 32 // More concurrent capacity\n * });\n * ```\n */\nexport const createRevenueShareEscrowIx = async ({\n\tdriftClient,\n\tauthority,\n\tnumOrders = 16,\n\tpayer,\n}: CreateRevenueShareEscrowIxParams): Promise<TransactionInstruction> => {\n\treturn driftClient.getInitializeRevenueShareEscrowIx(authority, numOrders, {\n\t\tpayer: payer ?? authority,\n\t});\n};\n\ninterface CreateRevenueShareEscrowTxnParams\n\textends WithTxnParams<CreateRevenueShareEscrowIxParams> {\n\t/**\n\t * The builder to add to the escrow account.\n\t */\n\tbuilder?: {\n\t\t/**\n\t\t * The public key of the builder to add to the escrow account.\n\t\t */\n\t\tbuilderAuthority: PublicKey;\n\t\t/**\n\t\t * The maximum fee the builder can charge, in tenths of basis points.\n\t\t */\n\t\tmaxFeeTenthBps: number;\n\t};\n}\n\n/**\n * Creates a transaction to initialize a RevenueShareEscrow account for a user.\n *\n * The RevenueShareEscrow account stores:\n * - List of approved builders with their max fee caps\n * - Pending builder fee orders waiting to be settled\n *\n * Users must initialize this account before they can place orders with builder codes.\n *\n * **Important**: `numOrders` determines CONCURRENT order capacity, not lifetime total orders.\n * When the escrow is full, new orders will succeed but builder fees won't be tracked.\n * See README_ORDER_LIMITS.md for capacity planning guidance.\n *\n * @param driftClient - The Drift client instance\n * @param authority - The public key of the user who will own this escrow account\n * @param numOrders - Number of concurrent order slots (default: 16, range: 1-128)\n * - 8: Casual traders (2-3 markets, occasional trading)\n * - 16: Active traders (3-5 markets, regular trading) ← Recommended default\n * - 32-64: Power users (many markets, frequent trading)\n * - 128: Maximum capacity (institutional usage)\n * @param payer - The public key of the account that will pay for the revenue share escrow account rent\n * @param txParams - Optional transaction parameters for customizing the transaction\n *\n * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing\n *\n * @example\n * ```typescript\n * // Default configuration (16 order slots)\n * const transaction = await createRevenueShareEscrowTxn({\n * driftClient,\n * authority: userPublicKey,\n * txParams: { computeUnits: 300000 }\n * });\n *\n * // Custom configuration for power user\n * const transaction = await createRevenueShareEscrowTxn({\n * driftClient,\n * authority: userPublicKey,\n * numOrders: 32, // More concurrent capacity\n * txParams: { computeUnits: 300000 }\n * });\n *\n * // Sign and send the transaction\n * const signature = await wallet.sendTransaction(transaction, connection);\n * ```\n */\nexport const createRevenueShareEscrowTxn = async (\n\tparams: CreateRevenueShareEscrowTxnParams\n): Promise<Transaction | VersionedTransaction> => {\n\tconst createIx = await createRevenueShareEscrowIx(params);\n\tconst ixs = [createIx];\n\n\tif (params.builder) {\n\t\tconst addBuilderIx = await manageBuilderIx({\n\t\t\tdriftClient: params.driftClient,\n\t\t\tauthority: params.authority,\n\t\t\tbuilderAuthority: params.builder.builderAuthority,\n\t\t\tmaxFeeTenthBps: params.builder.maxFeeTenthBps,\n\t\t\tpayer: params.payer ?? params.authority,\n\t\t});\n\n\t\tixs.push(addBuilderIx);\n\t}\n\n\treturn params.driftClient.buildTransaction(ixs, params.txParams);\n};\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './createRevenueShareAccount';
2
+ export * from './createRevenueShareEscrow';
3
+ export * from './manageBuilder';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./createRevenueShareAccount"), exports);
18
+ __exportStar(require("./createRevenueShareEscrow"), exports);
19
+ __exportStar(require("./manageBuilder"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/drift/base/actions/builder/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,6DAA2C;AAC3C,kDAAgC","sourcesContent":["export * from './createRevenueShareAccount';\nexport * from './createRevenueShareEscrow';\nexport * from './manageBuilder';\n"]}