@epicentral/sos-sdk 0.9.0-beta

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 (113) hide show
  1. package/.env.example +1 -0
  2. package/AGENTS.md +7 -0
  3. package/LICENSE +21 -0
  4. package/README.md +568 -0
  5. package/accounts/fetchers.ts +196 -0
  6. package/accounts/list.ts +184 -0
  7. package/accounts/pdas.ts +325 -0
  8. package/accounts/resolve-option.ts +104 -0
  9. package/client/lookup-table.ts +114 -0
  10. package/client/program.ts +13 -0
  11. package/client/types.ts +9 -0
  12. package/generated/accounts/collateralPool.ts +217 -0
  13. package/generated/accounts/config.ts +156 -0
  14. package/generated/accounts/escrowState.ts +183 -0
  15. package/generated/accounts/index.ts +20 -0
  16. package/generated/accounts/lenderPosition.ts +211 -0
  17. package/generated/accounts/makerCollateralShare.ts +229 -0
  18. package/generated/accounts/marketDataAccount.ts +176 -0
  19. package/generated/accounts/optionAccount.ts +247 -0
  20. package/generated/accounts/optionPool.ts +285 -0
  21. package/generated/accounts/poolLoan.ts +232 -0
  22. package/generated/accounts/positionAccount.ts +201 -0
  23. package/generated/accounts/vault.ts +366 -0
  24. package/generated/accounts/writerPosition.ts +327 -0
  25. package/generated/errors/index.ts +9 -0
  26. package/generated/errors/optionProgram.ts +476 -0
  27. package/generated/index.ts +13 -0
  28. package/generated/instructions/acceptAdmin.ts +230 -0
  29. package/generated/instructions/autoExerciseAllExpired.ts +685 -0
  30. package/generated/instructions/autoExerciseExpired.ts +754 -0
  31. package/generated/instructions/borrowFromPool.ts +619 -0
  32. package/generated/instructions/buyFromPool.ts +761 -0
  33. package/generated/instructions/closeLongToPool.ts +762 -0
  34. package/generated/instructions/closeOption.ts +235 -0
  35. package/generated/instructions/createEscrowV2.ts +518 -0
  36. package/generated/instructions/depositCollateral.ts +624 -0
  37. package/generated/instructions/depositToPosition.ts +429 -0
  38. package/generated/instructions/index.ts +47 -0
  39. package/generated/instructions/initCollateralPool.ts +513 -0
  40. package/generated/instructions/initConfig.ts +279 -0
  41. package/generated/instructions/initOptionPool.ts +587 -0
  42. package/generated/instructions/initializeMarketData.ts +359 -0
  43. package/generated/instructions/liquidateWriterPosition.ts +750 -0
  44. package/generated/instructions/liquidateWriterPositionRescue.ts +623 -0
  45. package/generated/instructions/omlpCreateVault.ts +553 -0
  46. package/generated/instructions/omlpUpdateFeeWallet.ts +473 -0
  47. package/generated/instructions/omlpUpdateInterestModel.ts +322 -0
  48. package/generated/instructions/omlpUpdateLiquidationThreshold.ts +304 -0
  49. package/generated/instructions/omlpUpdateMaintenanceBuffer.ts +304 -0
  50. package/generated/instructions/omlpUpdateMaxBorrowCap.ts +304 -0
  51. package/generated/instructions/omlpUpdateMaxLeverage.ts +304 -0
  52. package/generated/instructions/omlpUpdateProtocolFee.ts +304 -0
  53. package/generated/instructions/omlpUpdateSupplyLimit.ts +304 -0
  54. package/generated/instructions/optionExercise.ts +617 -0
  55. package/generated/instructions/optionMint.ts +1373 -0
  56. package/generated/instructions/optionValidate.ts +302 -0
  57. package/generated/instructions/repayPoolLoan.ts +558 -0
  58. package/generated/instructions/repayPoolLoanFromCollateral.ts +514 -0
  59. package/generated/instructions/repayPoolLoanFromWallet.ts +542 -0
  60. package/generated/instructions/settleMakerCollateral.ts +509 -0
  61. package/generated/instructions/syncWriterPosition.ts +206 -0
  62. package/generated/instructions/transferAdmin.ts +245 -0
  63. package/generated/instructions/unwindWriterUnsold.ts +764 -0
  64. package/generated/instructions/updateImpliedVolatility.ts +226 -0
  65. package/generated/instructions/updateMarketData.ts +315 -0
  66. package/generated/instructions/withdrawFromPosition.ts +405 -0
  67. package/generated/instructions/writeToPool.ts +619 -0
  68. package/generated/programs/index.ts +9 -0
  69. package/generated/programs/optionProgram.ts +1144 -0
  70. package/generated/shared/index.ts +164 -0
  71. package/generated/types/impliedVolatilityUpdated.ts +73 -0
  72. package/generated/types/index.ts +28 -0
  73. package/generated/types/liquidationExecuted.ts +73 -0
  74. package/generated/types/liquidationRescueEvent.ts +82 -0
  75. package/generated/types/marketDataInitialized.ts +61 -0
  76. package/generated/types/marketDataUpdated.ts +69 -0
  77. package/generated/types/optionClosed.ts +56 -0
  78. package/generated/types/optionExercised.ts +62 -0
  79. package/generated/types/optionExpired.ts +49 -0
  80. package/generated/types/optionMinted.ts +78 -0
  81. package/generated/types/optionType.ts +38 -0
  82. package/generated/types/optionValidated.ts +82 -0
  83. package/generated/types/poolLoanCreated.ts +74 -0
  84. package/generated/types/poolLoanRepaid.ts +74 -0
  85. package/generated/types/positionDeposited.ts +73 -0
  86. package/generated/types/positionWithdrawn.ts +81 -0
  87. package/generated/types/protocolFeeUpdated.ts +69 -0
  88. package/generated/types/vaultCreated.ts +60 -0
  89. package/generated/types/vaultFeeWalletUpdated.ts +67 -0
  90. package/generated/types/vaultInterestModelUpdated.ts +77 -0
  91. package/generated/types/vaultLiquidationThresholdUpdated.ts +69 -0
  92. package/index.ts +68 -0
  93. package/long/builders.ts +690 -0
  94. package/long/exercise.ts +123 -0
  95. package/long/preflight.ts +214 -0
  96. package/long/quotes.ts +48 -0
  97. package/long/remaining-accounts.ts +111 -0
  98. package/omlp/builders.ts +94 -0
  99. package/omlp/service.ts +136 -0
  100. package/oracle/switchboard.ts +315 -0
  101. package/package.json +34 -0
  102. package/shared/amounts.ts +53 -0
  103. package/shared/balances.ts +57 -0
  104. package/shared/errors.ts +12 -0
  105. package/shared/remaining-accounts.ts +41 -0
  106. package/shared/trade-config.ts +27 -0
  107. package/shared/transactions.ts +121 -0
  108. package/short/builders.ts +874 -0
  109. package/short/close-option.ts +34 -0
  110. package/short/pool.ts +189 -0
  111. package/short/preflight.ts +619 -0
  112. package/tsconfig.json +13 -0
  113. package/wsol/instructions.ts +247 -0
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ combineCodec,
11
+ getAddressDecoder,
12
+ getAddressEncoder,
13
+ getI64Decoder,
14
+ getI64Encoder,
15
+ getStructDecoder,
16
+ getStructEncoder,
17
+ type Address,
18
+ type FixedSizeCodec,
19
+ type FixedSizeDecoder,
20
+ type FixedSizeEncoder,
21
+ } from "@solana/kit";
22
+
23
+ export type VaultFeeWalletUpdated = {
24
+ vault: Address;
25
+ oldFeeWallet: Address;
26
+ newFeeWallet: Address;
27
+ updatedBy: Address;
28
+ updatedAt: bigint;
29
+ };
30
+
31
+ export type VaultFeeWalletUpdatedArgs = {
32
+ vault: Address;
33
+ oldFeeWallet: Address;
34
+ newFeeWallet: Address;
35
+ updatedBy: Address;
36
+ updatedAt: number | bigint;
37
+ };
38
+
39
+ export function getVaultFeeWalletUpdatedEncoder(): FixedSizeEncoder<VaultFeeWalletUpdatedArgs> {
40
+ return getStructEncoder([
41
+ ["vault", getAddressEncoder()],
42
+ ["oldFeeWallet", getAddressEncoder()],
43
+ ["newFeeWallet", getAddressEncoder()],
44
+ ["updatedBy", getAddressEncoder()],
45
+ ["updatedAt", getI64Encoder()],
46
+ ]);
47
+ }
48
+
49
+ export function getVaultFeeWalletUpdatedDecoder(): FixedSizeDecoder<VaultFeeWalletUpdated> {
50
+ return getStructDecoder([
51
+ ["vault", getAddressDecoder()],
52
+ ["oldFeeWallet", getAddressDecoder()],
53
+ ["newFeeWallet", getAddressDecoder()],
54
+ ["updatedBy", getAddressDecoder()],
55
+ ["updatedAt", getI64Decoder()],
56
+ ]);
57
+ }
58
+
59
+ export function getVaultFeeWalletUpdatedCodec(): FixedSizeCodec<
60
+ VaultFeeWalletUpdatedArgs,
61
+ VaultFeeWalletUpdated
62
+ > {
63
+ return combineCodec(
64
+ getVaultFeeWalletUpdatedEncoder(),
65
+ getVaultFeeWalletUpdatedDecoder(),
66
+ );
67
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ combineCodec,
11
+ getAddressDecoder,
12
+ getAddressEncoder,
13
+ getI64Decoder,
14
+ getI64Encoder,
15
+ getStructDecoder,
16
+ getStructEncoder,
17
+ getU16Decoder,
18
+ getU16Encoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ export type VaultInterestModelUpdated = {
26
+ vault: Address;
27
+ baseRateBps: number;
28
+ optimalUtilizationBps: number;
29
+ rateSlope1Bps: number;
30
+ rateSlope2Bps: number;
31
+ updatedBy: Address;
32
+ updatedAt: bigint;
33
+ };
34
+
35
+ export type VaultInterestModelUpdatedArgs = {
36
+ vault: Address;
37
+ baseRateBps: number;
38
+ optimalUtilizationBps: number;
39
+ rateSlope1Bps: number;
40
+ rateSlope2Bps: number;
41
+ updatedBy: Address;
42
+ updatedAt: number | bigint;
43
+ };
44
+
45
+ export function getVaultInterestModelUpdatedEncoder(): FixedSizeEncoder<VaultInterestModelUpdatedArgs> {
46
+ return getStructEncoder([
47
+ ["vault", getAddressEncoder()],
48
+ ["baseRateBps", getU16Encoder()],
49
+ ["optimalUtilizationBps", getU16Encoder()],
50
+ ["rateSlope1Bps", getU16Encoder()],
51
+ ["rateSlope2Bps", getU16Encoder()],
52
+ ["updatedBy", getAddressEncoder()],
53
+ ["updatedAt", getI64Encoder()],
54
+ ]);
55
+ }
56
+
57
+ export function getVaultInterestModelUpdatedDecoder(): FixedSizeDecoder<VaultInterestModelUpdated> {
58
+ return getStructDecoder([
59
+ ["vault", getAddressDecoder()],
60
+ ["baseRateBps", getU16Decoder()],
61
+ ["optimalUtilizationBps", getU16Decoder()],
62
+ ["rateSlope1Bps", getU16Decoder()],
63
+ ["rateSlope2Bps", getU16Decoder()],
64
+ ["updatedBy", getAddressDecoder()],
65
+ ["updatedAt", getI64Decoder()],
66
+ ]);
67
+ }
68
+
69
+ export function getVaultInterestModelUpdatedCodec(): FixedSizeCodec<
70
+ VaultInterestModelUpdatedArgs,
71
+ VaultInterestModelUpdated
72
+ > {
73
+ return combineCodec(
74
+ getVaultInterestModelUpdatedEncoder(),
75
+ getVaultInterestModelUpdatedDecoder(),
76
+ );
77
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ combineCodec,
11
+ getAddressDecoder,
12
+ getAddressEncoder,
13
+ getI64Decoder,
14
+ getI64Encoder,
15
+ getStructDecoder,
16
+ getStructEncoder,
17
+ getU16Decoder,
18
+ getU16Encoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ export type VaultLiquidationThresholdUpdated = {
26
+ vault: Address;
27
+ oldLiqThresholdBps: number;
28
+ newLiqThresholdBps: number;
29
+ updatedBy: Address;
30
+ updatedAt: bigint;
31
+ };
32
+
33
+ export type VaultLiquidationThresholdUpdatedArgs = {
34
+ vault: Address;
35
+ oldLiqThresholdBps: number;
36
+ newLiqThresholdBps: number;
37
+ updatedBy: Address;
38
+ updatedAt: number | bigint;
39
+ };
40
+
41
+ export function getVaultLiquidationThresholdUpdatedEncoder(): FixedSizeEncoder<VaultLiquidationThresholdUpdatedArgs> {
42
+ return getStructEncoder([
43
+ ["vault", getAddressEncoder()],
44
+ ["oldLiqThresholdBps", getU16Encoder()],
45
+ ["newLiqThresholdBps", getU16Encoder()],
46
+ ["updatedBy", getAddressEncoder()],
47
+ ["updatedAt", getI64Encoder()],
48
+ ]);
49
+ }
50
+
51
+ export function getVaultLiquidationThresholdUpdatedDecoder(): FixedSizeDecoder<VaultLiquidationThresholdUpdated> {
52
+ return getStructDecoder([
53
+ ["vault", getAddressDecoder()],
54
+ ["oldLiqThresholdBps", getU16Decoder()],
55
+ ["newLiqThresholdBps", getU16Decoder()],
56
+ ["updatedBy", getAddressDecoder()],
57
+ ["updatedAt", getI64Decoder()],
58
+ ]);
59
+ }
60
+
61
+ export function getVaultLiquidationThresholdUpdatedCodec(): FixedSizeCodec<
62
+ VaultLiquidationThresholdUpdatedArgs,
63
+ VaultLiquidationThresholdUpdated
64
+ > {
65
+ return combineCodec(
66
+ getVaultLiquidationThresholdUpdatedEncoder(),
67
+ getVaultLiquidationThresholdUpdatedDecoder(),
68
+ );
69
+ }
package/index.ts ADDED
@@ -0,0 +1,68 @@
1
+ export * from "./client/program";
2
+ export * from "./client/types";
3
+ export * from "./client/lookup-table";
4
+ export { OptionType } from "./generated/types";
5
+
6
+ export * from "./accounts/pdas";
7
+ export * from "./accounts/fetchers";
8
+ export * from "./accounts/list";
9
+ export * from "./accounts/resolve-option";
10
+
11
+ export * from "./shared/amounts";
12
+ export * from "./shared/balances";
13
+ export * from "./shared/errors";
14
+ export * from "./shared/remaining-accounts";
15
+ export * from "./shared/transactions";
16
+
17
+ export * from "./long/builders";
18
+ export * from "./long/exercise";
19
+ export * from "./long/preflight";
20
+ export * from "./long/quotes";
21
+ export {
22
+ getBuyFromPoolRemainingAccounts,
23
+ getCloseLongToPoolRemainingAccounts,
24
+ } from "./long/remaining-accounts";
25
+
26
+ export * from "./short/builders";
27
+ export * from "./short/close-option";
28
+ export * from "./short/pool";
29
+ export * from "./short/preflight";
30
+
31
+ export * from "./omlp/builders";
32
+ export * from "./omlp/service";
33
+ export * from "./shared/trade-config";
34
+ export {
35
+ resolveSwitchboardFeedFromMarketData,
36
+ resolveSwitchboardFeedIdFromMarketData,
37
+ buildSwitchboardQuoteInstruction,
38
+ buildSwitchboardQuoteWeb3JsInstruction,
39
+ buildSwitchboardPullFeedUpdate,
40
+ buildSwitchboardCrank,
41
+ inferSwitchboardNetwork,
42
+ prependSwitchboardCrank,
43
+ prependSwitchboardQuote,
44
+ feedIdBytesToHex,
45
+ getDefaultSwitchboardQueueAddress,
46
+ SWITCHBOARD_DEFAULT_DEVNET_QUEUE,
47
+ SWITCHBOARD_DEFAULT_MAINNET_QUEUE,
48
+ SLOT_HASHES_SYSVAR_ADDRESS,
49
+ INSTRUCTIONS_SYSVAR_ADDRESS,
50
+ type SwitchboardPullFeedLike,
51
+ type BuildSwitchboardPullFeedUpdateParams,
52
+ type BuildSwitchboardCrankParams,
53
+ type BuildSwitchboardQuoteInstructionParams,
54
+ type SwitchboardQuoteInstructionResult,
55
+ type SwitchboardCrankResult,
56
+ type SwitchboardNetwork,
57
+ } from "./oracle/switchboard";
58
+
59
+ export {
60
+ getWrapSOLInstructions,
61
+ getUnwrapSOLInstructions,
62
+ getSyncNativeInstruction,
63
+ getCloseAccountInstruction,
64
+ getCreateAssociatedTokenIdempotentInstructionWithAddress,
65
+ NATIVE_MINT,
66
+ } from "./wsol/instructions";
67
+
68
+ export { getCreateEscrowV2InstructionAsync } from "./generated/instructions/createEscrowV2";