@lightconexyz/lightcone-sdk 0.2.0 → 0.2.1

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 (51) hide show
  1. package/dist/domain/orderbook/wire.d.ts +2 -0
  2. package/dist/domain/orderbook/wire.d.ts.map +1 -1
  3. package/dist/domain/orderbook/wire.js.map +1 -1
  4. package/dist/domain/price_history/wire.d.ts +5 -7
  5. package/dist/domain/price_history/wire.d.ts.map +1 -1
  6. package/dist/domain/price_history/wire.js.map +1 -1
  7. package/dist/prelude.d.ts +4 -4
  8. package/dist/prelude.d.ts.map +1 -1
  9. package/dist/prelude.js.map +1 -1
  10. package/dist/program/accounts.d.ts +2 -4
  11. package/dist/program/accounts.d.ts.map +1 -1
  12. package/dist/program/accounts.js +3 -12
  13. package/dist/program/accounts.js.map +1 -1
  14. package/dist/program/client.d.ts +1 -4
  15. package/dist/program/client.d.ts.map +1 -1
  16. package/dist/program/client.js +1 -6
  17. package/dist/program/client.js.map +1 -1
  18. package/dist/program/constants.d.ts +1 -2
  19. package/dist/program/constants.d.ts.map +1 -1
  20. package/dist/program/constants.js +2 -3
  21. package/dist/program/constants.js.map +1 -1
  22. package/dist/program/index.d.ts +2 -2
  23. package/dist/program/index.d.ts.map +1 -1
  24. package/dist/program/index.js +2 -3
  25. package/dist/program/index.js.map +1 -1
  26. package/dist/program/instructions.d.ts +17 -63
  27. package/dist/program/instructions.d.ts.map +1 -1
  28. package/dist/program/instructions.js +45 -206
  29. package/dist/program/instructions.js.map +1 -1
  30. package/dist/program/types.d.ts +2 -23
  31. package/dist/program/types.d.ts.map +1 -1
  32. package/dist/program/types.js.map +1 -1
  33. package/dist/ws/client.browser.d.ts +46 -0
  34. package/dist/ws/client.browser.d.ts.map +1 -0
  35. package/dist/ws/client.browser.js +245 -0
  36. package/dist/ws/client.browser.js.map +1 -0
  37. package/dist/ws/{client.d.ts → client.node.d.ts} +3 -2
  38. package/dist/ws/client.node.d.ts.map +1 -0
  39. package/dist/ws/{client.js → client.node.js} +1 -1
  40. package/dist/ws/client.node.js.map +1 -0
  41. package/dist/ws/index.d.ts +2 -1
  42. package/dist/ws/index.d.ts.map +1 -1
  43. package/dist/ws/index.js +1 -1
  44. package/dist/ws/index.js.map +1 -1
  45. package/dist/ws/types.d.ts +23 -0
  46. package/dist/ws/types.d.ts.map +1 -0
  47. package/dist/ws/types.js +3 -0
  48. package/dist/ws/types.js.map +1 -0
  49. package/package.json +8 -3
  50. package/dist/ws/client.d.ts.map +0 -1
  51. package/dist/ws/client.js.map +0 -1
@@ -21,7 +21,6 @@ exports.buildDepositToGlobalIx = buildDepositToGlobalIx;
21
21
  exports.buildGlobalToMarketDepositIx = buildGlobalToMarketDepositIx;
22
22
  exports.buildInitPositionTokensIx = buildInitPositionTokensIx;
23
23
  exports.buildDepositAndSwapIx = buildDepositAndSwapIx;
24
- exports.buildExtendPositionTokensIx = buildExtendPositionTokensIx;
25
24
  const web3_js_1 = require("@solana/web3.js");
26
25
  const constants_1 = require("./constants");
27
26
  const pda_1 = require("./pda");
@@ -133,14 +132,12 @@ function buildAddDepositMintIx(params, market, numOutcomes, programId = constant
133
132
  if (params.outcomeMetadata.length !== numOutcomes) {
134
133
  throw new Error(`Outcome metadata count (${params.outcomeMetadata.length}) must match numOutcomes (${numOutcomes})`);
135
134
  }
136
- const [exchange] = (0, pda_1.getExchangePda)(programId);
137
135
  const [vault] = (0, pda_1.getVaultPda)(params.depositMint, market, programId);
138
136
  const [mintAuthority] = (0, pda_1.getMintAuthorityPda)(market, programId);
139
137
  const conditionalMints = (0, pda_1.getAllConditionalMintPdas)(market, params.depositMint, numOutcomes, programId);
140
138
  const keys = [
141
139
  signerMut(params.payer),
142
- readonly(exchange),
143
- readonly(market),
140
+ writable(market),
144
141
  readonly(params.depositMint),
145
142
  writable(vault),
146
143
  readonly(mintAuthority),
@@ -714,7 +711,7 @@ function buildWhitelistDepositTokenIx(params, programId = constants_1.PROGRAM_ID
714
711
  const [globalDepositToken] = (0, pda_1.getGlobalDepositTokenPda)(params.mint, programId);
715
712
  const keys = [
716
713
  signerMut(params.authority),
717
- writable(exchange),
714
+ readonly(exchange),
718
715
  readonly(params.mint),
719
716
  writable(globalDepositToken),
720
717
  readonly(constants_1.SYSTEM_PROGRAM_ID),
@@ -737,12 +734,7 @@ function buildWhitelistDepositTokenIx(params, programId = constants_1.PROGRAM_ID
737
734
  * 5. token_program (readonly)
738
735
  * 6. system_program (readonly)
739
736
  *
740
- * Optional (for ALT creation/extension when first deposit to this mint):
741
- * 7. user_nonce (readonly)
742
- * 8. lookup_table (mut)
743
- * 9. alt_program (readonly)
744
- *
745
- * Data: [discriminator, amount (u64), optional recent_slot (u64)]
737
+ * Data: [discriminator, amount (u64)]
746
738
  */
747
739
  function buildDepositToGlobalIx(params, programId = constants_1.PROGRAM_ID) {
748
740
  const [globalDepositToken] = (0, pda_1.getGlobalDepositTokenPda)(params.mint, programId);
@@ -757,24 +749,14 @@ function buildDepositToGlobalIx(params, programId = constants_1.PROGRAM_ID) {
757
749
  readonly(constants_1.TOKEN_PROGRAM_ID),
758
750
  readonly(constants_1.SYSTEM_PROGRAM_ID),
759
751
  ];
760
- // Optional ALT accounts
761
- if (params.userNonce && params.lookupTable) {
762
- keys.push(readonly(params.userNonce));
763
- keys.push(writable(params.lookupTable));
764
- keys.push(readonly(constants_1.ALT_PROGRAM_ID));
765
- }
766
- const dataBuffers = [
752
+ const data = Buffer.concat([
767
753
  Buffer.from([constants_1.INSTRUCTION.DEPOSIT_TO_GLOBAL]),
768
754
  (0, utils_1.toU64Le)(params.amount),
769
- ];
770
- // Optional recent_slot for ALT creation
771
- if (params.recentSlot !== undefined) {
772
- dataBuffers.push((0, utils_1.toU64Le)(params.recentSlot));
773
- }
755
+ ]);
774
756
  return new web3_js_1.TransactionInstruction({
775
757
  keys,
776
758
  programId,
777
- data: Buffer.concat(dataBuffers),
759
+ data,
778
760
  });
779
761
  }
780
762
  /**
@@ -840,39 +822,36 @@ function buildGlobalToMarketDepositIx(params, numOutcomes, programId = constants
840
822
  }
841
823
  /**
842
824
  * Build InitPositionTokens instruction
843
- * Permissionless: payer pays, user is position owner (no signature required)
844
825
  *
845
826
  * Accounts:
846
- * 0. payer (signer, mut)
847
- * 1. user (readonly)
848
- * 2. exchange (readonly)
849
- * 3. market (readonly)
850
- * 4. position (mut)
851
- * 5. lookup_table (mut)
852
- * 6. mint_authority (readonly)
853
- * 7. token_2022_program (readonly)
854
- * 8. ata_program (readonly)
855
- * 9. alt_program (readonly)
856
- * 10. system_program (readonly)
857
- *
858
- * Remaining per deposit_mint (in ascending GDT index order):
859
- * deposit_mint, vault, gdt, [conditional_mint[i], position_conditional_ata[i]]*numOutcomes
827
+ * 0. user (signer, mut)
828
+ * 1. exchange (readonly)
829
+ * 2. market (readonly)
830
+ * 3. deposit_mint (readonly)
831
+ * 4. vault (readonly)
832
+ * 5. position (mut)
833
+ * 6. lookup_table (mut)
834
+ * 7. mint_authority (readonly)
835
+ * 8. token_2022_program (readonly)
836
+ * 9. ata_program (readonly)
837
+ * 10. alt_program (readonly)
838
+ * 11. system_program (readonly)
839
+ * + per outcome: conditional_mint[i] (readonly), position_conditional_ata[i] (mut)
860
840
  *
861
- * Data: [discriminator, recent_slot (u64), num_deposit_mints (u8)]
841
+ * Data: [discriminator, recent_slot (u64)]
862
842
  */
863
843
  function buildInitPositionTokensIx(params, numOutcomes, programId = constants_1.PROGRAM_ID) {
864
- if (params.depositMints.length === 0) {
865
- throw new Error("At least one deposit mint is required");
866
- }
867
844
  const [exchange] = (0, pda_1.getExchangePda)(programId);
845
+ const [vault] = (0, pda_1.getVaultPda)(params.depositMint, params.market, programId);
868
846
  const [position] = (0, pda_1.getPositionPda)(params.user, params.market, programId);
869
847
  const [lookupTable] = (0, pda_1.getPositionAltPda)(position, params.recentSlot);
870
848
  const [mintAuthority] = (0, pda_1.getMintAuthorityPda)(params.market, programId);
871
849
  const keys = [
872
- signerMut(params.payer),
873
- readonly(params.user),
850
+ signerMut(params.user),
874
851
  readonly(exchange),
875
852
  readonly(params.market),
853
+ readonly(params.depositMint),
854
+ readonly(vault),
876
855
  writable(position),
877
856
  writable(lookupTable),
878
857
  readonly(mintAuthority),
@@ -881,23 +860,14 @@ function buildInitPositionTokensIx(params, numOutcomes, programId = constants_1.
881
860
  readonly(constants_1.ALT_PROGRAM_ID),
882
861
  readonly(constants_1.SYSTEM_PROGRAM_ID),
883
862
  ];
884
- // Remaining accounts: per deposit_mint group
885
- for (const depositMint of params.depositMints) {
886
- const [vault] = (0, pda_1.getVaultPda)(depositMint, params.market, programId);
887
- const [gdt] = (0, pda_1.getGlobalDepositTokenPda)(depositMint, programId);
888
- keys.push(readonly(depositMint));
889
- keys.push(readonly(vault));
890
- keys.push(readonly(gdt));
891
- for (let i = 0; i < numOutcomes; i += 1) {
892
- const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, depositMint, numOutcomes, programId)[i];
893
- keys.push(readonly(conditionalMint));
894
- keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, position)));
895
- }
863
+ for (let i = 0; i < numOutcomes; i += 1) {
864
+ const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, params.depositMint, numOutcomes, programId)[i];
865
+ keys.push(readonly(conditionalMint));
866
+ keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, position)));
896
867
  }
897
868
  const data = Buffer.concat([
898
869
  Buffer.from([constants_1.INSTRUCTION.INIT_POSITION_TOKENS]),
899
870
  (0, utils_1.toU64Le)(params.recentSlot),
900
- (0, utils_1.toU8)(params.depositMints.length),
901
871
  ]);
902
872
  return new web3_js_1.TransactionInstruction({
903
873
  keys,
@@ -907,24 +877,7 @@ function buildInitPositionTokensIx(params, numOutcomes, programId = constants_1.
907
877
  }
908
878
  /**
909
879
  * Build DepositAndSwap instruction.
910
- *
911
- * deposit_bitmask controls per-participant deposit vs swap routing:
912
- * bit 7 = taker deposits, bits 0..n = maker i deposits
913
- *
914
- * Account layout:
915
- * Fixed (5): operator, exchange, market, mint_authority, token_program
916
- * Taker: [order_status], nonce, position, base_mint, quote_mint,
917
- * taker_receive_ata, taker_give_ata, token_2022, system
918
- * Taker deposit (if bit 7): deposit_mint, vault, gdt, user_global_deposit,
919
- * [cond_mint, ata]*numOutcomes
920
- * Per maker:
921
- * Common: [order_status], nonce, position
922
- * If deposit: deposit_mint, vault, gdt, user_global_deposit,
923
- * [cond_mint, ata]*numOutcomes, maker_receive_ata, maker_give_ata
924
- * If swap: maker_receive_ata, maker_give_ata
925
- *
926
- * Data: [disc, takerOrder(29), takerSig(64), numMakers(1),
927
- * fullFillBitmask(1), depositBitmask(1), ...makerData(109*n)]
880
+ * Data format is identical to matchOrdersMulti.
928
881
  */
929
882
  function buildDepositAndSwapIx(params, numOutcomes, programId = constants_1.PROGRAM_ID) {
930
883
  if (params.makerOrders.length === 0) {
@@ -940,64 +893,40 @@ function buildDepositAndSwapIx(params, numOutcomes, programId = constants_1.PROG
940
893
  throw new Error("taker_fill_amounts length must match maker_orders");
941
894
  }
942
895
  const [exchange] = (0, pda_1.getExchangePda)(programId);
896
+ const [vault] = (0, pda_1.getVaultPda)(params.depositMint, params.market, programId);
897
+ const [globalDepositToken] = (0, pda_1.getGlobalDepositTokenPda)(params.depositMint, programId);
943
898
  const [mintAuthority] = (0, pda_1.getMintAuthorityPda)(params.market, programId);
944
899
  const takerOrderHash = (0, orders_1.hashOrder)(params.takerOrder);
945
900
  const [takerNonce] = (0, pda_1.getUserNoncePda)(params.takerOrder.maker, programId);
946
901
  const [takerPosition] = (0, pda_1.getPositionPda)(params.takerOrder.maker, params.market, programId);
947
- const takerFullFill = (params.fullFillBitmask & 0x80) !== 0;
948
- const takerIsDeposit = (params.depositBitmask & 0x80) !== 0;
949
- // Determine receive/give mints based on taker side
950
- const takerSide = params.takerOrder.side;
951
- const receiveMint = takerSide === 0 ? params.baseMint : params.quoteMint;
952
- const giveMint = takerSide === 0 ? params.quoteMint : params.baseMint;
902
+ const takerFullFill = ((params.fullFillBitmask >> 7) & 1) === 1;
953
903
  const keys = [];
954
- // Fixed accounts (5)
955
904
  keys.push(signerMut(params.operator));
956
905
  keys.push(readonly(exchange));
957
906
  keys.push(readonly(params.market));
907
+ keys.push(readonly(params.depositMint));
908
+ keys.push(writable(vault));
909
+ keys.push(readonly(globalDepositToken));
958
910
  keys.push(readonly(mintAuthority));
959
911
  keys.push(readonly(constants_1.TOKEN_PROGRAM_ID));
960
- // Taker order_status (if not fully filled)
961
912
  if (!takerFullFill) {
962
913
  const [takerOrderStatus] = (0, pda_1.getOrderStatusPda)(takerOrderHash, programId);
963
914
  keys.push(writable(takerOrderStatus));
964
915
  }
965
- // Taker common block (8 accounts)
966
916
  keys.push(readonly(takerNonce));
967
917
  keys.push(writable(takerPosition));
968
918
  keys.push(readonly(params.baseMint));
969
919
  keys.push(readonly(params.quoteMint));
970
- const takerReceiveAta = (0, utils_1.getConditionalTokenAta)(receiveMint, takerPosition);
971
- const takerGiveAta = (0, utils_1.getConditionalTokenAta)(giveMint, takerPosition);
972
- keys.push(writable(takerReceiveAta));
973
- keys.push(writable(takerGiveAta));
974
920
  keys.push(readonly(constants_1.TOKEN_2022_PROGRAM_ID));
975
921
  keys.push(readonly(constants_1.SYSTEM_PROGRAM_ID));
976
- // Taker deposit block (if taker deposits)
977
- if (takerIsDeposit) {
978
- if (!params.takerDepositMint) {
979
- throw new Error("takerDepositMint is required when taker deposits (depositBitmask bit 7)");
980
- }
981
- const takerDm = params.takerDepositMint;
982
- const [takerVault] = (0, pda_1.getVaultPda)(takerDm, params.market, programId);
983
- const [takerGdt] = (0, pda_1.getGlobalDepositTokenPda)(takerDm, programId);
984
- const [takerUgd] = (0, pda_1.getUserGlobalDepositPda)(params.takerOrder.maker, takerDm, programId);
985
- keys.push(readonly(takerDm));
986
- keys.push(writable(takerVault));
987
- keys.push(readonly(takerGdt));
988
- keys.push(writable(takerUgd));
989
- for (let j = 0; j < numOutcomes; j += 1) {
990
- const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, takerDm, numOutcomes, programId)[j];
991
- keys.push(writable(conditionalMint));
992
- keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, takerPosition)));
993
- }
922
+ for (let i = 0; i < numOutcomes; i += 1) {
923
+ const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, params.depositMint, numOutcomes, programId)[i];
924
+ keys.push(writable(conditionalMint));
925
+ keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, takerPosition)));
994
926
  }
995
- // Per-maker accounts
996
927
  for (let i = 0; i < params.makerOrders.length; i += 1) {
997
928
  const makerOrder = params.makerOrders[i];
998
- const makerFullFill = (params.fullFillBitmask & (1 << i)) !== 0;
999
- const makerIsDeposit = (params.depositBitmask & (1 << i)) !== 0;
1000
- // Maker order_status (if not fully filled)
929
+ const makerFullFill = ((params.fullFillBitmask >> i) & 1) === 1;
1001
930
  if (!makerFullFill) {
1002
931
  const makerOrderHash = (0, orders_1.hashOrder)(makerOrder);
1003
932
  const [makerOrderStatus] = (0, pda_1.getOrderStatusPda)(makerOrderHash, programId);
@@ -1005,49 +934,21 @@ function buildDepositAndSwapIx(params, numOutcomes, programId = constants_1.PROG
1005
934
  }
1006
935
  const [makerNonce] = (0, pda_1.getUserNoncePda)(makerOrder.maker, programId);
1007
936
  const [makerPosition] = (0, pda_1.getPositionPda)(makerOrder.maker, params.market, programId);
1008
- // Common: nonce, position
937
+ const [makerGlobalDeposit] = (0, pda_1.getUserGlobalDepositPda)(makerOrder.maker, params.depositMint, programId);
1009
938
  keys.push(readonly(makerNonce));
1010
939
  keys.push(writable(makerPosition));
1011
- if (makerIsDeposit) {
1012
- // Maker deposit: deposit_mint, vault, gdt, ugd, [cond_mint, ata]*n, receive_ata, give_ata
1013
- const makerDm = params.makerDepositMints?.[i];
1014
- if (!makerDm) {
1015
- throw new Error(`makerDepositMints[${i}] is required when maker ${i} deposits`);
1016
- }
1017
- const [makerVault] = (0, pda_1.getVaultPda)(makerDm, params.market, programId);
1018
- const [makerGdt] = (0, pda_1.getGlobalDepositTokenPda)(makerDm, programId);
1019
- const [makerUgd] = (0, pda_1.getUserGlobalDepositPda)(makerOrder.maker, makerDm, programId);
1020
- keys.push(readonly(makerDm));
1021
- keys.push(writable(makerVault));
1022
- keys.push(readonly(makerGdt));
1023
- keys.push(writable(makerUgd));
1024
- for (let j = 0; j < numOutcomes; j += 1) {
1025
- const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, makerDm, numOutcomes, programId)[j];
1026
- keys.push(writable(conditionalMint));
1027
- keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, makerPosition)));
1028
- }
1029
- // Maker swap ATAs (always present after deposit block)
1030
- const makerReceiveAta = (0, utils_1.getConditionalTokenAta)(receiveMint, makerPosition);
1031
- const makerGiveAta = (0, utils_1.getConditionalTokenAta)(giveMint, makerPosition);
1032
- keys.push(writable(makerReceiveAta));
1033
- keys.push(writable(makerGiveAta));
1034
- }
1035
- else {
1036
- // Maker swap: receive_ata, give_ata
1037
- const makerReceiveAta = (0, utils_1.getConditionalTokenAta)(receiveMint, makerPosition);
1038
- const makerGiveAta = (0, utils_1.getConditionalTokenAta)(giveMint, makerPosition);
1039
- keys.push(writable(makerReceiveAta));
1040
- keys.push(writable(makerGiveAta));
940
+ keys.push(writable(makerGlobalDeposit));
941
+ for (let j = 0; j < numOutcomes; j += 1) {
942
+ const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, params.depositMint, numOutcomes, programId)[j];
943
+ keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, makerPosition)));
1041
944
  }
1042
945
  }
1043
- // Build data (96-byte header + 109 per maker)
1044
946
  const buffers = [
1045
947
  Buffer.from([constants_1.INSTRUCTION.DEPOSIT_AND_SWAP]),
1046
948
  (0, orders_1.serializeOrder)((0, orders_1.signedOrderToOrder)(params.takerOrder)),
1047
949
  params.takerOrder.signature,
1048
950
  (0, utils_1.toU8)(params.makerOrders.length),
1049
951
  (0, utils_1.toU8)(params.fullFillBitmask),
1050
- (0, utils_1.toU8)(params.depositBitmask),
1051
952
  ];
1052
953
  for (let i = 0; i < params.makerOrders.length; i += 1) {
1053
954
  const makerOrder = params.makerOrders[i];
@@ -1062,66 +963,4 @@ function buildDepositAndSwapIx(params, numOutcomes, programId = constants_1.PROG
1062
963
  data: Buffer.concat(buffers),
1063
964
  });
1064
965
  }
1065
- /**
1066
- * Build ExtendPositionTokens instruction
1067
- * Permissionless: anyone can pay to extend ALTs for any user
1068
- *
1069
- * Accounts:
1070
- * 0. payer (signer, mut)
1071
- * 1. user (readonly)
1072
- * 2. exchange (readonly)
1073
- * 3. market (readonly)
1074
- * 4. position (readonly)
1075
- * 5. lookup_table (mut)
1076
- * 6. token_2022_program (readonly)
1077
- * 7. ata_program (readonly)
1078
- * 8. alt_program (readonly)
1079
- * 9. system_program (readonly)
1080
- *
1081
- * Remaining per deposit_mint (in ascending GDT index order):
1082
- * deposit_mint, vault, gdt, [conditional_mint[i], position_conditional_ata[i]]*numOutcomes
1083
- *
1084
- * Data: [discriminator, num_deposit_mints (u8)]
1085
- */
1086
- function buildExtendPositionTokensIx(params, numOutcomes, lookupTable, programId = constants_1.PROGRAM_ID) {
1087
- if (params.depositMints.length === 0) {
1088
- throw new Error("At least one deposit mint is required");
1089
- }
1090
- const [exchange] = (0, pda_1.getExchangePda)(programId);
1091
- const [position] = (0, pda_1.getPositionPda)(params.user, params.market, programId);
1092
- const keys = [
1093
- signerMut(params.payer),
1094
- readonly(params.user),
1095
- readonly(exchange),
1096
- readonly(params.market),
1097
- readonly(position),
1098
- writable(lookupTable),
1099
- readonly(constants_1.TOKEN_2022_PROGRAM_ID),
1100
- readonly(constants_1.ASSOCIATED_TOKEN_PROGRAM_ID),
1101
- readonly(constants_1.ALT_PROGRAM_ID),
1102
- readonly(constants_1.SYSTEM_PROGRAM_ID),
1103
- ];
1104
- // Remaining accounts: per deposit_mint group
1105
- for (const depositMint of params.depositMints) {
1106
- const [vault] = (0, pda_1.getVaultPda)(depositMint, params.market, programId);
1107
- const [gdt] = (0, pda_1.getGlobalDepositTokenPda)(depositMint, programId);
1108
- keys.push(readonly(depositMint));
1109
- keys.push(readonly(vault));
1110
- keys.push(readonly(gdt));
1111
- for (let i = 0; i < numOutcomes; i += 1) {
1112
- const [conditionalMint] = (0, pda_1.getAllConditionalMintPdas)(params.market, depositMint, numOutcomes, programId)[i];
1113
- keys.push(readonly(conditionalMint));
1114
- keys.push(writable((0, utils_1.getConditionalTokenAta)(conditionalMint, position)));
1115
- }
1116
- }
1117
- const data = Buffer.concat([
1118
- Buffer.from([constants_1.INSTRUCTION.EXTEND_POSITION_TOKENS]),
1119
- (0, utils_1.toU8)(params.depositMints.length),
1120
- ]);
1121
- return new web3_js_1.TransactionInstruction({
1122
- keys,
1123
- programId,
1124
- data,
1125
- });
1126
- }
1127
966
  //# sourceMappingURL=instructions.js.map