@drift-labs/common 1.0.11 → 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 (73) hide show
  1. package/lib/common-ui-utils/commonUiUtils.d.ts +6 -0
  2. package/lib/common-ui-utils/trading.d.ts +6 -0
  3. package/lib/common-ui-utils/trading.js +59 -0
  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 +38 -1
  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/Drift/clients/CentralServerDrift/index.js +11 -2
  14. package/lib/drift/Drift/clients/CentralServerDrift/index.js.map +1 -1
  15. package/lib/drift/Drift/clients/CentralServerDrift/types.d.ts +1 -1
  16. package/lib/drift/Drift/clients/CentralServerDrift/types.js.map +1 -1
  17. package/lib/drift/base/actions/builder/createRevenueShareAccount.d.ts +62 -0
  18. package/lib/drift/base/actions/builder/createRevenueShareAccount.js +59 -0
  19. package/lib/drift/base/actions/builder/createRevenueShareAccount.js.map +1 -0
  20. package/lib/drift/base/actions/builder/createRevenueShareEscrow.d.ts +126 -0
  21. package/lib/drift/base/actions/builder/createRevenueShareEscrow.js +114 -0
  22. package/lib/drift/base/actions/builder/createRevenueShareEscrow.js.map +1 -0
  23. package/lib/drift/base/actions/builder/index.d.ts +3 -0
  24. package/lib/drift/base/actions/builder/index.js +20 -0
  25. package/lib/drift/base/actions/builder/index.js.map +1 -0
  26. package/lib/drift/base/actions/builder/manageBuilder.d.ts +157 -0
  27. package/lib/drift/base/actions/builder/manageBuilder.js +139 -0
  28. package/lib/drift/base/actions/builder/manageBuilder.js.map +1 -0
  29. package/lib/drift/base/actions/index.d.ts +1 -0
  30. package/lib/drift/base/actions/index.js +1 -0
  31. package/lib/drift/base/actions/index.js.map +1 -1
  32. package/lib/drift/base/actions/trade/cancelOrder.d.ts +12 -4
  33. package/lib/drift/base/actions/trade/cancelOrder.js +7 -4
  34. package/lib/drift/base/actions/trade/cancelOrder.js.map +1 -1
  35. package/lib/drift/base/actions/trade/editOrder.d.ts +18 -4
  36. package/lib/drift/base/actions/trade/editOrder.js +44 -8
  37. package/lib/drift/base/actions/trade/editOrder.js.map +1 -1
  38. package/lib/drift/base/actions/trade/openPerpOrder/auction.d.ts +16 -0
  39. package/lib/drift/base/actions/trade/openPerpOrder/auction.js +68 -0
  40. package/lib/drift/base/actions/trade/openPerpOrder/auction.js.map +1 -0
  41. package/lib/drift/base/actions/trade/openPerpOrder/dlobServer/index.d.ts +1 -1
  42. package/lib/drift/base/actions/trade/openPerpOrder/dlobServer/index.js +18 -9
  43. package/lib/drift/base/actions/trade/openPerpOrder/dlobServer/index.js.map +1 -1
  44. package/lib/drift/base/actions/trade/openPerpOrder/index.d.ts +1 -0
  45. package/lib/drift/base/actions/trade/openPerpOrder/index.js +1 -0
  46. package/lib/drift/base/actions/trade/openPerpOrder/index.js.map +1 -1
  47. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.d.ts +51 -5
  48. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js +24 -7
  49. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js.map +1 -1
  50. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.d.ts +20 -2
  51. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js +23 -61
  52. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js.map +1 -1
  53. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.d.ts +62 -4
  54. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js +9 -4
  55. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js.map +1 -1
  56. package/lib/drift/base/actions/trade/openPerpOrder/positionMaxLeverage.d.ts +7 -0
  57. package/lib/drift/base/actions/trade/openPerpOrder/positionMaxLeverage.js +29 -0
  58. package/lib/drift/base/actions/trade/openPerpOrder/positionMaxLeverage.js.map +1 -0
  59. package/lib/drift/base/actions/trade/openPerpOrder/types.d.ts +8 -4
  60. package/lib/drift/base/actions/trade/openPerpOrder/types.js.map +1 -1
  61. package/lib/drift/base/constants/auction.d.ts +1 -0
  62. package/lib/drift/base/constants/auction.js +5 -0
  63. package/lib/drift/base/constants/auction.js.map +1 -0
  64. package/lib/drift/base/constants/index.d.ts +2 -0
  65. package/lib/drift/base/constants/index.js +19 -0
  66. package/lib/drift/base/constants/index.js.map +1 -0
  67. package/lib/drift/base/types.d.ts +4 -0
  68. package/lib/drift/base/types.js +3 -0
  69. package/lib/drift/base/types.js.map +1 -0
  70. package/lib/drift/index.d.ts +1 -0
  71. package/lib/drift/index.js +1 -0
  72. package/lib/drift/index.js.map +1 -1
  73. package/package.json +4 -4
@@ -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"]}
@@ -0,0 +1,157 @@
1
+ import { DriftClient } from '@drift-labs/sdk';
2
+ import { Transaction, TransactionInstruction, VersionedTransaction, PublicKey } from '@solana/web3.js';
3
+ import { WithTxnParams } from '../../types';
4
+ interface ManageBuilderIxParams {
5
+ driftClient: DriftClient;
6
+ /**
7
+ * The public key of the builder to manage.
8
+ * This is the builder's authority address that owns their RevenueShare account.
9
+ */
10
+ builderAuthority: PublicKey;
11
+ /**
12
+ * Maximum fee the builder can charge, in tenths of basis points.
13
+ *
14
+ * Examples:
15
+ * - 10 = 1 bps = 0.01%
16
+ * - 50 = 5 bps = 0.05%
17
+ * - 100 = 10 bps = 0.1%
18
+ * - 1000 = 100 bps = 1%
19
+ *
20
+ * Special values:
21
+ * - Set to 0 to revoke the builder (they remain in list but cannot be used)
22
+ */
23
+ maxFeeTenthBps: number;
24
+ /**
25
+ * The public key of the authority to add the builder to the approved builders list.
26
+ */
27
+ authority: PublicKey;
28
+ /**
29
+ * The public key of the wallet that will pay for the transaction.
30
+ * If not provided, the authority provided will be the payer.
31
+ */
32
+ payer?: PublicKey;
33
+ }
34
+ /**
35
+ * Creates a transaction instruction to manage a builder's approval status and fee cap.
36
+ *
37
+ * This unified function handles all builder management operations:
38
+ * - **Approve**: Add a new builder to the approved list
39
+ * - **Update**: Modify an existing builder's max fee cap
40
+ * - **Revoke**: Disable a builder by setting their max fee to 0
41
+ *
42
+ * ## Behavior:
43
+ *
44
+ * ### If builder NOT in list:
45
+ * - Adds builder with specified `maxFeeTenthBps`
46
+ *
47
+ * ### If builder already in list:
48
+ * - Updates builder's `maxFeeTenthBps` to new value
49
+ * - Set to 0 to revoke (builder stays in list but cannot be used)
50
+ *
51
+ * ## Revocation Constraints:
52
+ * When setting `maxFeeTenthBps = 0`, the builder cannot have active orders:
53
+ * - No Open orders using this builder
54
+ * - No Completed (unsettled) orders using this builder
55
+ * - Error: `CannotRevokeBuilderWithOpenOrders` if constraint violated
56
+ *
57
+ * **Prerequisites**:
58
+ * - User must have initialized a RevenueShareEscrow account
59
+ * - Builder must have initialized a RevenueShare account (for receiving fees)
60
+ *
61
+ * @param driftClient - The Drift client instance
62
+ * @param builderAuthority - The public key of the builder to manage
63
+ * @param maxFeeTenthBps - Maximum fee cap in tenths of basis points
64
+ *
65
+ * @returns Promise resolving to a TransactionInstruction
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * // Approve a new builder with 5 bps max fee
70
+ * const ix = await manageBuilderIx({
71
+ * driftClient,
72
+ * builderAuthority: new PublicKey('BuilderAddress...'),
73
+ * maxFeeTenthBps: 50 // 5 bps = 0.05%
74
+ * });
75
+ * ```
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // Update existing builder to 10 bps max fee
80
+ * const ix = await manageBuilderIx({
81
+ * driftClient,
82
+ * builderAuthority: builderPubkey,
83
+ * maxFeeTenthBps: 100 // 10 bps = 0.1%
84
+ * });
85
+ * ```
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // Revoke builder (set max fee to 0)
90
+ * // IMPORTANT: Must settle all builder's orders first!
91
+ * const ix = await manageBuilderIx({
92
+ * driftClient,
93
+ * builderAuthority: builderPubkey,
94
+ * maxFeeTenthBps: 0 // Revoked
95
+ * });
96
+ * ```
97
+ */
98
+ export declare const manageBuilderIx: (params: ManageBuilderIxParams) => Promise<TransactionInstruction>;
99
+ /**
100
+ * Creates a transaction to manage a builder's approval status and fee cap.
101
+ *
102
+ * This unified function handles all builder management operations:
103
+ * - **Approve**: Add a new builder to the approved list
104
+ * - **Update**: Modify an existing builder's max fee cap
105
+ * - **Revoke**: Disable a builder by setting their max fee to 0
106
+ *
107
+ * ## Behavior:
108
+ *
109
+ * ### If builder NOT in list:
110
+ * - Adds builder with specified `maxFeeTenthBps`
111
+ *
112
+ * ### If builder already in list:
113
+ * - Updates builder's `maxFeeTenthBps` to new value
114
+ * - Set to 0 to revoke (builder stays in list but cannot be used)
115
+ *
116
+ * ## Revocation Constraints:
117
+ * When setting `maxFeeTenthBps = 0`, the builder cannot have active orders:
118
+ * - No Open orders using this builder
119
+ * - No Completed (unsettled) orders using this builder
120
+ * - Error: `CannotRevokeBuilderWithOpenOrders` if constraint violated
121
+ *
122
+ * **Prerequisites**:
123
+ * - User must have initialized a RevenueShareEscrow account
124
+ * - Builder must have initialized a RevenueShare account (for receiving fees)
125
+ *
126
+ * @param driftClient - The Drift client instance
127
+ * @param builderAuthority - The public key of the builder to manage
128
+ * @param maxFeeTenthBps - Maximum fee cap in tenths of basis points
129
+ * @param txParams - Optional transaction parameters for customizing the transaction
130
+ *
131
+ * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * // Approve a new builder with 2 bps max fee
136
+ * const tx = await manageBuilderTxn({
137
+ * driftClient,
138
+ * builderAuthority: new PublicKey('BuilderAddress...'),
139
+ * maxFeeTenthBps: 20,
140
+ * txParams: { computeUnits: 200000 }
141
+ * });
142
+ *
143
+ * const signature = await wallet.sendTransaction(tx, connection);
144
+ * ```
145
+
146
+ * @example
147
+ * ```typescript
148
+ * // Update existing builder's fee
149
+ * await manageBuilderTxn({
150
+ * driftClient,
151
+ * builderAuthority: builderPubkey,
152
+ * maxFeeTenthBps: 100 // Increase to 10 bps
153
+ * });
154
+ * ```
155
+ */
156
+ export declare const manageBuilderTxn: (params: WithTxnParams<ManageBuilderIxParams>) => Promise<Transaction | VersionedTransaction>;
157
+ export {};
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.manageBuilderTxn = exports.manageBuilderIx = void 0;
4
+ /**
5
+ * Creates a transaction instruction to manage a builder's approval status and fee cap.
6
+ *
7
+ * This unified function handles all builder management operations:
8
+ * - **Approve**: Add a new builder to the approved list
9
+ * - **Update**: Modify an existing builder's max fee cap
10
+ * - **Revoke**: Disable a builder by setting their max fee to 0
11
+ *
12
+ * ## Behavior:
13
+ *
14
+ * ### If builder NOT in list:
15
+ * - Adds builder with specified `maxFeeTenthBps`
16
+ *
17
+ * ### If builder already in list:
18
+ * - Updates builder's `maxFeeTenthBps` to new value
19
+ * - Set to 0 to revoke (builder stays in list but cannot be used)
20
+ *
21
+ * ## Revocation Constraints:
22
+ * When setting `maxFeeTenthBps = 0`, the builder cannot have active orders:
23
+ * - No Open orders using this builder
24
+ * - No Completed (unsettled) orders using this builder
25
+ * - Error: `CannotRevokeBuilderWithOpenOrders` if constraint violated
26
+ *
27
+ * **Prerequisites**:
28
+ * - User must have initialized a RevenueShareEscrow account
29
+ * - Builder must have initialized a RevenueShare account (for receiving fees)
30
+ *
31
+ * @param driftClient - The Drift client instance
32
+ * @param builderAuthority - The public key of the builder to manage
33
+ * @param maxFeeTenthBps - Maximum fee cap in tenths of basis points
34
+ *
35
+ * @returns Promise resolving to a TransactionInstruction
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Approve a new builder with 5 bps max fee
40
+ * const ix = await manageBuilderIx({
41
+ * driftClient,
42
+ * builderAuthority: new PublicKey('BuilderAddress...'),
43
+ * maxFeeTenthBps: 50 // 5 bps = 0.05%
44
+ * });
45
+ * ```
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * // Update existing builder to 10 bps max fee
50
+ * const ix = await manageBuilderIx({
51
+ * driftClient,
52
+ * builderAuthority: builderPubkey,
53
+ * maxFeeTenthBps: 100 // 10 bps = 0.1%
54
+ * });
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Revoke builder (set max fee to 0)
60
+ * // IMPORTANT: Must settle all builder's orders first!
61
+ * const ix = await manageBuilderIx({
62
+ * driftClient,
63
+ * builderAuthority: builderPubkey,
64
+ * maxFeeTenthBps: 0 // Revoked
65
+ * });
66
+ * ```
67
+ */
68
+ const manageBuilderIx = async (params) => {
69
+ const { driftClient, builderAuthority, maxFeeTenthBps, authority, payer } = params;
70
+ const isRevoke = maxFeeTenthBps === 0;
71
+ return driftClient.getChangeApprovedBuilderIx(builderAuthority, maxFeeTenthBps, !isRevoke, // add = true (approve/update), false (revoke)
72
+ {
73
+ authority,
74
+ payer: payer !== null && payer !== void 0 ? payer : authority,
75
+ });
76
+ };
77
+ exports.manageBuilderIx = manageBuilderIx;
78
+ /**
79
+ * Creates a transaction to manage a builder's approval status and fee cap.
80
+ *
81
+ * This unified function handles all builder management operations:
82
+ * - **Approve**: Add a new builder to the approved list
83
+ * - **Update**: Modify an existing builder's max fee cap
84
+ * - **Revoke**: Disable a builder by setting their max fee to 0
85
+ *
86
+ * ## Behavior:
87
+ *
88
+ * ### If builder NOT in list:
89
+ * - Adds builder with specified `maxFeeTenthBps`
90
+ *
91
+ * ### If builder already in list:
92
+ * - Updates builder's `maxFeeTenthBps` to new value
93
+ * - Set to 0 to revoke (builder stays in list but cannot be used)
94
+ *
95
+ * ## Revocation Constraints:
96
+ * When setting `maxFeeTenthBps = 0`, the builder cannot have active orders:
97
+ * - No Open orders using this builder
98
+ * - No Completed (unsettled) orders using this builder
99
+ * - Error: `CannotRevokeBuilderWithOpenOrders` if constraint violated
100
+ *
101
+ * **Prerequisites**:
102
+ * - User must have initialized a RevenueShareEscrow account
103
+ * - Builder must have initialized a RevenueShare account (for receiving fees)
104
+ *
105
+ * @param driftClient - The Drift client instance
106
+ * @param builderAuthority - The public key of the builder to manage
107
+ * @param maxFeeTenthBps - Maximum fee cap in tenths of basis points
108
+ * @param txParams - Optional transaction parameters for customizing the transaction
109
+ *
110
+ * @returns Promise resolving to a Transaction or VersionedTransaction ready for signing
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * // Approve a new builder with 2 bps max fee
115
+ * const tx = await manageBuilderTxn({
116
+ * driftClient,
117
+ * builderAuthority: new PublicKey('BuilderAddress...'),
118
+ * maxFeeTenthBps: 20,
119
+ * txParams: { computeUnits: 200000 }
120
+ * });
121
+ *
122
+ * const signature = await wallet.sendTransaction(tx, connection);
123
+ * ```
124
+
125
+ * @example
126
+ * ```typescript
127
+ * // Update existing builder's fee
128
+ * await manageBuilderTxn({
129
+ * driftClient,
130
+ * builderAuthority: builderPubkey,
131
+ * maxFeeTenthBps: 100 // Increase to 10 bps
132
+ * });
133
+ * ```
134
+ */
135
+ const manageBuilderTxn = async (params) => {
136
+ return params.driftClient.buildTransaction(await (0, exports.manageBuilderIx)(params), params.txParams);
137
+ };
138
+ exports.manageBuilderTxn = manageBuilderTxn;
139
+ //# sourceMappingURL=manageBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manageBuilder.js","sourceRoot":"","sources":["../../../../../src/drift/base/actions/builder/manageBuilder.ts"],"names":[],"mappings":";;;AAwCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACI,MAAM,eAAe,GAAG,KAAK,EACnC,MAA6B,EACK,EAAE;IACpC,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,GACxE,MAAM,CAAC;IAER,MAAM,QAAQ,GAAG,cAAc,KAAK,CAAC,CAAC;IAEtC,OAAO,WAAW,CAAC,0BAA0B,CAC5C,gBAAgB,EAChB,cAAc,EACd,CAAC,QAAQ,EAAE,8CAA8C;IACzD;QACC,SAAS;QACT,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,SAAS;KACzB,CACD,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACI,MAAM,gBAAgB,GAAG,KAAK,EACpC,MAA4C,EACE,EAAE;IAChD,OAAO,MAAM,CAAC,WAAW,CAAC,gBAAgB,CACzC,MAAM,IAAA,uBAAe,EAAC,MAAM,CAAC,EAC7B,MAAM,CAAC,QAAQ,CACf,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B","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 ManageBuilderIxParams {\n\tdriftClient: DriftClient;\n\t/**\n\t * The public key of the builder to manage.\n\t * This is the builder's authority address that owns their RevenueShare account.\n\t */\n\tbuilderAuthority: PublicKey;\n\t/**\n\t * Maximum fee the builder can charge, in tenths of basis points.\n\t *\n\t * Examples:\n\t * - 10 = 1 bps = 0.01%\n\t * - 50 = 5 bps = 0.05%\n\t * - 100 = 10 bps = 0.1%\n\t * - 1000 = 100 bps = 1%\n\t *\n\t * Special values:\n\t * - Set to 0 to revoke the builder (they remain in list but cannot be used)\n\t */\n\tmaxFeeTenthBps: number;\n\t/**\n\t * The public key of the authority to add the builder to the approved builders list.\n\t */\n\tauthority: PublicKey;\n\t/**\n\t * The public key of the wallet that will pay for the transaction.\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 manage a builder's approval status and fee cap.\n *\n * This unified function handles all builder management operations:\n * - **Approve**: Add a new builder to the approved list\n * - **Update**: Modify an existing builder's max fee cap\n * - **Revoke**: Disable a builder by setting their max fee to 0\n *\n * ## Behavior:\n *\n * ### If builder NOT in list:\n * - Adds builder with specified `maxFeeTenthBps`\n *\n * ### If builder already in list:\n * - Updates builder's `maxFeeTenthBps` to new value\n * - Set to 0 to revoke (builder stays in list but cannot be used)\n *\n * ## Revocation Constraints:\n * When setting `maxFeeTenthBps = 0`, the builder cannot have active orders:\n * - No Open orders using this builder\n * - No Completed (unsettled) orders using this builder\n * - Error: `CannotRevokeBuilderWithOpenOrders` if constraint violated\n *\n * **Prerequisites**:\n * - User must have initialized a RevenueShareEscrow account\n * - Builder must have initialized a RevenueShare account (for receiving fees)\n *\n * @param driftClient - The Drift client instance\n * @param builderAuthority - The public key of the builder to manage\n * @param maxFeeTenthBps - Maximum fee cap in tenths of basis points\n *\n * @returns Promise resolving to a TransactionInstruction\n *\n * @example\n * ```typescript\n * // Approve a new builder with 5 bps max fee\n * const ix = await manageBuilderIx({\n * driftClient,\n * builderAuthority: new PublicKey('BuilderAddress...'),\n * maxFeeTenthBps: 50 // 5 bps = 0.05%\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Update existing builder to 10 bps max fee\n * const ix = await manageBuilderIx({\n * driftClient,\n * builderAuthority: builderPubkey,\n * maxFeeTenthBps: 100 // 10 bps = 0.1%\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Revoke builder (set max fee to 0)\n * // IMPORTANT: Must settle all builder's orders first!\n * const ix = await manageBuilderIx({\n * driftClient,\n * builderAuthority: builderPubkey,\n * maxFeeTenthBps: 0 // Revoked\n * });\n * ```\n */\nexport const manageBuilderIx = async (\n\tparams: ManageBuilderIxParams\n): Promise<TransactionInstruction> => {\n\tconst { driftClient, builderAuthority, maxFeeTenthBps, authority, payer } =\n\t\tparams;\n\n\tconst isRevoke = maxFeeTenthBps === 0;\n\n\treturn driftClient.getChangeApprovedBuilderIx(\n\t\tbuilderAuthority,\n\t\tmaxFeeTenthBps,\n\t\t!isRevoke, // add = true (approve/update), false (revoke)\n\t\t{\n\t\t\tauthority,\n\t\t\tpayer: payer ?? authority,\n\t\t}\n\t);\n};\n\n/**\n * Creates a transaction to manage a builder's approval status and fee cap.\n *\n * This unified function handles all builder management operations:\n * - **Approve**: Add a new builder to the approved list\n * - **Update**: Modify an existing builder's max fee cap\n * - **Revoke**: Disable a builder by setting their max fee to 0\n *\n * ## Behavior:\n *\n * ### If builder NOT in list:\n * - Adds builder with specified `maxFeeTenthBps`\n *\n * ### If builder already in list:\n * - Updates builder's `maxFeeTenthBps` to new value\n * - Set to 0 to revoke (builder stays in list but cannot be used)\n *\n * ## Revocation Constraints:\n * When setting `maxFeeTenthBps = 0`, the builder cannot have active orders:\n * - No Open orders using this builder\n * - No Completed (unsettled) orders using this builder\n * - Error: `CannotRevokeBuilderWithOpenOrders` if constraint violated\n *\n * **Prerequisites**:\n * - User must have initialized a RevenueShareEscrow account\n * - Builder must have initialized a RevenueShare account (for receiving fees)\n *\n * @param driftClient - The Drift client instance\n * @param builderAuthority - The public key of the builder to manage\n * @param maxFeeTenthBps - Maximum fee cap in tenths of basis points\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 * // Approve a new builder with 2 bps max fee\n * const tx = await manageBuilderTxn({\n * driftClient,\n * builderAuthority: new PublicKey('BuilderAddress...'),\n * maxFeeTenthBps: 20,\n * txParams: { computeUnits: 200000 }\n * });\n *\n * const signature = await wallet.sendTransaction(tx, connection);\n * ```\n\n * @example\n * ```typescript\n * // Update existing builder's fee\n * await manageBuilderTxn({\n * driftClient,\n * builderAuthority: builderPubkey,\n * maxFeeTenthBps: 100 // Increase to 10 bps\n * });\n * ```\n */\nexport const manageBuilderTxn = async (\n\tparams: WithTxnParams<ManageBuilderIxParams>\n): Promise<Transaction | VersionedTransaction> => {\n\treturn params.driftClient.buildTransaction(\n\t\tawait manageBuilderIx(params),\n\t\tparams.txParams\n\t);\n};\n"]}
@@ -2,3 +2,4 @@ export * from './user';
2
2
  export * from './trade';
3
3
  export * from './perp';
4
4
  export * from './spot';
5
+ export * from './builder';
@@ -18,4 +18,5 @@ __exportStar(require("./user"), exports);
18
18
  __exportStar(require("./trade"), exports);
19
19
  __exportStar(require("./perp"), exports);
20
20
  __exportStar(require("./spot"), exports);
21
+ __exportStar(require("./builder"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/drift/base/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB","sourcesContent":["export * from './user';\nexport * from './trade';\nexport * from './perp';\nexport * from './spot';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/drift/base/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,4CAA0B","sourcesContent":["export * from './user';\nexport * from './trade';\nexport * from './perp';\nexport * from './spot';\nexport * from './builder';\n"]}
@@ -1,5 +1,12 @@
1
- import { DriftClient, TxParams, User } from '@drift-labs/sdk';
2
- import { Transaction, TransactionInstruction, VersionedTransaction } from '@solana/web3.js';
1
+ import { DriftClient, User } from '@drift-labs/sdk';
2
+ import { Transaction, TransactionInstruction, VersionedTransaction, PublicKey } from '@solana/web3.js';
3
+ import { WithTxnParams } from '../../types';
4
+ interface CreateCancelOrdersIxParams {
5
+ driftClient: DriftClient;
6
+ user: User;
7
+ orderIds: number[];
8
+ mainSignerOverride?: PublicKey;
9
+ }
3
10
  /**
4
11
  * Creates a transaction instruction to cancel multiple orders by their order IDs.
5
12
  *
@@ -19,7 +26,7 @@ import { Transaction, TransactionInstruction, VersionedTransaction } from '@sola
19
26
  *
20
27
  * ```
21
28
  */
22
- export declare const createCancelOrdersIx: (driftClient: DriftClient, orderIds: number[], user: User) => Promise<TransactionInstruction>;
29
+ export declare const createCancelOrdersIx: (params: CreateCancelOrdersIxParams) => Promise<TransactionInstruction>;
23
30
  /**
24
31
  * Creates a transaction to cancel multiple orders by their IDs.
25
32
  *
@@ -44,4 +51,5 @@ export declare const createCancelOrdersIx: (driftClient: DriftClient, orderIds:
44
51
  * const signature = await wallet.sendTransaction(transaction, connection);
45
52
  * ```
46
53
  */
47
- export declare const createCancelOrdersTxn: (driftClient: DriftClient, user: User, orderIds: number[], txParams?: TxParams) => Promise<Transaction | VersionedTransaction>;
54
+ export declare const createCancelOrdersTxn: (params: WithTxnParams<CreateCancelOrdersIxParams>) => Promise<Transaction | VersionedTransaction>;
55
+ export {};