@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,164 @@
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
+ AccountRole,
11
+ isProgramDerivedAddress,
12
+ isTransactionSigner as kitIsTransactionSigner,
13
+ type AccountMeta,
14
+ type AccountSignerMeta,
15
+ type Address,
16
+ type ProgramDerivedAddress,
17
+ type TransactionSigner,
18
+ upgradeRoleToSigner,
19
+ } from "@solana/kit";
20
+
21
+ /**
22
+ * Asserts that the given value is not null or undefined.
23
+ * @internal
24
+ */
25
+ export function expectSome<T>(value: T | null | undefined): T {
26
+ if (value === null || value === undefined) {
27
+ throw new Error("Expected a value but received null or undefined.");
28
+ }
29
+ return value;
30
+ }
31
+
32
+ /**
33
+ * Asserts that the given value is a PublicKey.
34
+ * @internal
35
+ */
36
+ export function expectAddress<T extends string = string>(
37
+ value:
38
+ | Address<T>
39
+ | ProgramDerivedAddress<T>
40
+ | TransactionSigner<T>
41
+ | null
42
+ | undefined,
43
+ ): Address<T> {
44
+ if (!value) {
45
+ throw new Error("Expected a Address.");
46
+ }
47
+ if (typeof value === "object" && "address" in value) {
48
+ return value.address;
49
+ }
50
+ if (Array.isArray(value)) {
51
+ return value[0] as Address<T>;
52
+ }
53
+ return value as Address<T>;
54
+ }
55
+
56
+ /**
57
+ * Asserts that the given value is a PDA.
58
+ * @internal
59
+ */
60
+ export function expectProgramDerivedAddress<T extends string = string>(
61
+ value:
62
+ | Address<T>
63
+ | ProgramDerivedAddress<T>
64
+ | TransactionSigner<T>
65
+ | null
66
+ | undefined,
67
+ ): ProgramDerivedAddress<T> {
68
+ if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {
69
+ throw new Error("Expected a ProgramDerivedAddress.");
70
+ }
71
+ return value;
72
+ }
73
+
74
+ /**
75
+ * Asserts that the given value is a TransactionSigner.
76
+ * @internal
77
+ */
78
+ export function expectTransactionSigner<T extends string = string>(
79
+ value:
80
+ | Address<T>
81
+ | ProgramDerivedAddress<T>
82
+ | TransactionSigner<T>
83
+ | null
84
+ | undefined,
85
+ ): TransactionSigner<T> {
86
+ if (!value || !isTransactionSigner(value)) {
87
+ throw new Error("Expected a TransactionSigner.");
88
+ }
89
+ return value;
90
+ }
91
+
92
+ /**
93
+ * Defines an instruction account to resolve.
94
+ * @internal
95
+ */
96
+ export type ResolvedAccount<
97
+ T extends string = string,
98
+ U extends
99
+ | Address<T>
100
+ | ProgramDerivedAddress<T>
101
+ | TransactionSigner<T>
102
+ | null =
103
+ | Address<T>
104
+ | ProgramDerivedAddress<T>
105
+ | TransactionSigner<T>
106
+ | null,
107
+ > = {
108
+ isWritable: boolean;
109
+ value: U;
110
+ };
111
+
112
+ /**
113
+ * Defines an instruction that stores additional bytes on-chain.
114
+ * @internal
115
+ */
116
+ export type InstructionWithByteDelta = {
117
+ byteDelta: number;
118
+ };
119
+
120
+ /**
121
+ * Get account metas and signers from resolved accounts.
122
+ * @internal
123
+ */
124
+ export function getAccountMetaFactory(
125
+ programAddress: Address,
126
+ optionalAccountStrategy: "omitted" | "programId",
127
+ ) {
128
+ return (
129
+ account: ResolvedAccount,
130
+ ): AccountMeta | AccountSignerMeta | undefined => {
131
+ if (!account.value) {
132
+ if (optionalAccountStrategy === "omitted") return;
133
+ return Object.freeze({
134
+ address: programAddress,
135
+ role: AccountRole.READONLY,
136
+ });
137
+ }
138
+
139
+ const writableRole = account.isWritable
140
+ ? AccountRole.WRITABLE
141
+ : AccountRole.READONLY;
142
+ return Object.freeze({
143
+ address: expectAddress(account.value),
144
+ role: isTransactionSigner(account.value)
145
+ ? upgradeRoleToSigner(writableRole)
146
+ : writableRole,
147
+ ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),
148
+ });
149
+ };
150
+ }
151
+
152
+ export function isTransactionSigner<TAddress extends string = string>(
153
+ value:
154
+ | Address<TAddress>
155
+ | ProgramDerivedAddress<TAddress>
156
+ | TransactionSigner<TAddress>,
157
+ ): value is TransactionSigner<TAddress> {
158
+ return (
159
+ !!value &&
160
+ typeof value === "object" &&
161
+ "address" in value &&
162
+ kitIsTransactionSigner(value)
163
+ );
164
+ }
@@ -0,0 +1,73 @@
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
+ getF64Decoder,
14
+ getF64Encoder,
15
+ getI64Decoder,
16
+ getI64Encoder,
17
+ getStructDecoder,
18
+ getStructEncoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ export type ImpliedVolatilityUpdated = {
26
+ optionAccount: Address;
27
+ oldIv: number;
28
+ newIv: number;
29
+ poolUtilization: number;
30
+ baselineVolatility: number;
31
+ updatedAt: bigint;
32
+ };
33
+
34
+ export type ImpliedVolatilityUpdatedArgs = {
35
+ optionAccount: Address;
36
+ oldIv: number;
37
+ newIv: number;
38
+ poolUtilization: number;
39
+ baselineVolatility: number;
40
+ updatedAt: number | bigint;
41
+ };
42
+
43
+ export function getImpliedVolatilityUpdatedEncoder(): FixedSizeEncoder<ImpliedVolatilityUpdatedArgs> {
44
+ return getStructEncoder([
45
+ ["optionAccount", getAddressEncoder()],
46
+ ["oldIv", getF64Encoder()],
47
+ ["newIv", getF64Encoder()],
48
+ ["poolUtilization", getF64Encoder()],
49
+ ["baselineVolatility", getF64Encoder()],
50
+ ["updatedAt", getI64Encoder()],
51
+ ]);
52
+ }
53
+
54
+ export function getImpliedVolatilityUpdatedDecoder(): FixedSizeDecoder<ImpliedVolatilityUpdated> {
55
+ return getStructDecoder([
56
+ ["optionAccount", getAddressDecoder()],
57
+ ["oldIv", getF64Decoder()],
58
+ ["newIv", getF64Decoder()],
59
+ ["poolUtilization", getF64Decoder()],
60
+ ["baselineVolatility", getF64Decoder()],
61
+ ["updatedAt", getI64Decoder()],
62
+ ]);
63
+ }
64
+
65
+ export function getImpliedVolatilityUpdatedCodec(): FixedSizeCodec<
66
+ ImpliedVolatilityUpdatedArgs,
67
+ ImpliedVolatilityUpdated
68
+ > {
69
+ return combineCodec(
70
+ getImpliedVolatilityUpdatedEncoder(),
71
+ getImpliedVolatilityUpdatedDecoder(),
72
+ );
73
+ }
@@ -0,0 +1,28 @@
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
+ export * from "./impliedVolatilityUpdated";
10
+ export * from "./liquidationExecuted";
11
+ export * from "./liquidationRescueEvent";
12
+ export * from "./marketDataInitialized";
13
+ export * from "./marketDataUpdated";
14
+ export * from "./optionClosed";
15
+ export * from "./optionExercised";
16
+ export * from "./optionExpired";
17
+ export * from "./optionMinted";
18
+ export * from "./optionType";
19
+ export * from "./optionValidated";
20
+ export * from "./poolLoanCreated";
21
+ export * from "./poolLoanRepaid";
22
+ export * from "./positionDeposited";
23
+ export * from "./positionWithdrawn";
24
+ export * from "./protocolFeeUpdated";
25
+ export * from "./vaultCreated";
26
+ export * from "./vaultFeeWalletUpdated";
27
+ export * from "./vaultInterestModelUpdated";
28
+ export * from "./vaultLiquidationThresholdUpdated";
@@ -0,0 +1,73 @@
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
+ getU64Decoder,
18
+ getU64Encoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ export type LiquidationExecuted = {
26
+ writer: Address;
27
+ optionPool: Address;
28
+ collateralSeized: bigint;
29
+ principalRepaid: bigint;
30
+ interestRepaid: bigint;
31
+ liquidatedAt: bigint;
32
+ };
33
+
34
+ export type LiquidationExecutedArgs = {
35
+ writer: Address;
36
+ optionPool: Address;
37
+ collateralSeized: number | bigint;
38
+ principalRepaid: number | bigint;
39
+ interestRepaid: number | bigint;
40
+ liquidatedAt: number | bigint;
41
+ };
42
+
43
+ export function getLiquidationExecutedEncoder(): FixedSizeEncoder<LiquidationExecutedArgs> {
44
+ return getStructEncoder([
45
+ ["writer", getAddressEncoder()],
46
+ ["optionPool", getAddressEncoder()],
47
+ ["collateralSeized", getU64Encoder()],
48
+ ["principalRepaid", getU64Encoder()],
49
+ ["interestRepaid", getU64Encoder()],
50
+ ["liquidatedAt", getI64Encoder()],
51
+ ]);
52
+ }
53
+
54
+ export function getLiquidationExecutedDecoder(): FixedSizeDecoder<LiquidationExecuted> {
55
+ return getStructDecoder([
56
+ ["writer", getAddressDecoder()],
57
+ ["optionPool", getAddressDecoder()],
58
+ ["collateralSeized", getU64Decoder()],
59
+ ["principalRepaid", getU64Decoder()],
60
+ ["interestRepaid", getU64Decoder()],
61
+ ["liquidatedAt", getI64Decoder()],
62
+ ]);
63
+ }
64
+
65
+ export function getLiquidationExecutedCodec(): FixedSizeCodec<
66
+ LiquidationExecutedArgs,
67
+ LiquidationExecuted
68
+ > {
69
+ return combineCodec(
70
+ getLiquidationExecutedEncoder(),
71
+ getLiquidationExecutedDecoder(),
72
+ );
73
+ }
@@ -0,0 +1,82 @@
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
+ getU64Decoder,
18
+ getU64Encoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ /**
26
+ * Emitted by the permissioned rescue path when a writer's debt cannot be
27
+ * covered fully from collateral + theta. `recovered` is what OMLP actually
28
+ * got back; `shortfall` is written to `Vault::bad_debt_lamports`.
29
+ */
30
+ export type LiquidationRescueEvent = {
31
+ writer: Address;
32
+ optionPool: Address;
33
+ vault: Address;
34
+ recovered: bigint;
35
+ shortfall: bigint;
36
+ thetaForfeited: bigint;
37
+ rescuedAt: bigint;
38
+ };
39
+
40
+ export type LiquidationRescueEventArgs = {
41
+ writer: Address;
42
+ optionPool: Address;
43
+ vault: Address;
44
+ recovered: number | bigint;
45
+ shortfall: number | bigint;
46
+ thetaForfeited: number | bigint;
47
+ rescuedAt: number | bigint;
48
+ };
49
+
50
+ export function getLiquidationRescueEventEncoder(): FixedSizeEncoder<LiquidationRescueEventArgs> {
51
+ return getStructEncoder([
52
+ ["writer", getAddressEncoder()],
53
+ ["optionPool", getAddressEncoder()],
54
+ ["vault", getAddressEncoder()],
55
+ ["recovered", getU64Encoder()],
56
+ ["shortfall", getU64Encoder()],
57
+ ["thetaForfeited", getU64Encoder()],
58
+ ["rescuedAt", getI64Encoder()],
59
+ ]);
60
+ }
61
+
62
+ export function getLiquidationRescueEventDecoder(): FixedSizeDecoder<LiquidationRescueEvent> {
63
+ return getStructDecoder([
64
+ ["writer", getAddressDecoder()],
65
+ ["optionPool", getAddressDecoder()],
66
+ ["vault", getAddressDecoder()],
67
+ ["recovered", getU64Decoder()],
68
+ ["shortfall", getU64Decoder()],
69
+ ["thetaForfeited", getU64Decoder()],
70
+ ["rescuedAt", getI64Decoder()],
71
+ ]);
72
+ }
73
+
74
+ export function getLiquidationRescueEventCodec(): FixedSizeCodec<
75
+ LiquidationRescueEventArgs,
76
+ LiquidationRescueEvent
77
+ > {
78
+ return combineCodec(
79
+ getLiquidationRescueEventEncoder(),
80
+ getLiquidationRescueEventDecoder(),
81
+ );
82
+ }
@@ -0,0 +1,61 @@
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
+ getF64Decoder,
14
+ getF64Encoder,
15
+ getStructDecoder,
16
+ getStructEncoder,
17
+ type Address,
18
+ type FixedSizeCodec,
19
+ type FixedSizeDecoder,
20
+ type FixedSizeEncoder,
21
+ } from "@solana/kit";
22
+
23
+ export type MarketDataInitialized = {
24
+ marketData: Address;
25
+ underlyingAsset: Address;
26
+ authority: Address;
27
+ riskFreeRate: number;
28
+ historicalVolatility: number;
29
+ };
30
+
31
+ export type MarketDataInitializedArgs = MarketDataInitialized;
32
+
33
+ export function getMarketDataInitializedEncoder(): FixedSizeEncoder<MarketDataInitializedArgs> {
34
+ return getStructEncoder([
35
+ ["marketData", getAddressEncoder()],
36
+ ["underlyingAsset", getAddressEncoder()],
37
+ ["authority", getAddressEncoder()],
38
+ ["riskFreeRate", getF64Encoder()],
39
+ ["historicalVolatility", getF64Encoder()],
40
+ ]);
41
+ }
42
+
43
+ export function getMarketDataInitializedDecoder(): FixedSizeDecoder<MarketDataInitialized> {
44
+ return getStructDecoder([
45
+ ["marketData", getAddressDecoder()],
46
+ ["underlyingAsset", getAddressDecoder()],
47
+ ["authority", getAddressDecoder()],
48
+ ["riskFreeRate", getF64Decoder()],
49
+ ["historicalVolatility", getF64Decoder()],
50
+ ]);
51
+ }
52
+
53
+ export function getMarketDataInitializedCodec(): FixedSizeCodec<
54
+ MarketDataInitializedArgs,
55
+ MarketDataInitialized
56
+ > {
57
+ return combineCodec(
58
+ getMarketDataInitializedEncoder(),
59
+ getMarketDataInitializedDecoder(),
60
+ );
61
+ }
@@ -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
+ getF64Decoder,
14
+ getF64Encoder,
15
+ getI64Decoder,
16
+ getI64Encoder,
17
+ getStructDecoder,
18
+ getStructEncoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ export type MarketDataUpdated = {
26
+ marketData: Address;
27
+ underlyingAsset: Address;
28
+ riskFreeRate: number;
29
+ historicalVolatility: number;
30
+ updatedAt: bigint;
31
+ };
32
+
33
+ export type MarketDataUpdatedArgs = {
34
+ marketData: Address;
35
+ underlyingAsset: Address;
36
+ riskFreeRate: number;
37
+ historicalVolatility: number;
38
+ updatedAt: number | bigint;
39
+ };
40
+
41
+ export function getMarketDataUpdatedEncoder(): FixedSizeEncoder<MarketDataUpdatedArgs> {
42
+ return getStructEncoder([
43
+ ["marketData", getAddressEncoder()],
44
+ ["underlyingAsset", getAddressEncoder()],
45
+ ["riskFreeRate", getF64Encoder()],
46
+ ["historicalVolatility", getF64Encoder()],
47
+ ["updatedAt", getI64Encoder()],
48
+ ]);
49
+ }
50
+
51
+ export function getMarketDataUpdatedDecoder(): FixedSizeDecoder<MarketDataUpdated> {
52
+ return getStructDecoder([
53
+ ["marketData", getAddressDecoder()],
54
+ ["underlyingAsset", getAddressDecoder()],
55
+ ["riskFreeRate", getF64Decoder()],
56
+ ["historicalVolatility", getF64Decoder()],
57
+ ["updatedAt", getI64Decoder()],
58
+ ]);
59
+ }
60
+
61
+ export function getMarketDataUpdatedCodec(): FixedSizeCodec<
62
+ MarketDataUpdatedArgs,
63
+ MarketDataUpdated
64
+ > {
65
+ return combineCodec(
66
+ getMarketDataUpdatedEncoder(),
67
+ getMarketDataUpdatedDecoder(),
68
+ );
69
+ }
@@ -0,0 +1,56 @@
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
+ getStructDecoder,
14
+ getStructEncoder,
15
+ getU64Decoder,
16
+ getU64Encoder,
17
+ type Address,
18
+ type FixedSizeCodec,
19
+ type FixedSizeDecoder,
20
+ type FixedSizeEncoder,
21
+ } from "@solana/kit";
22
+
23
+ export type OptionClosed = {
24
+ optionAccount: Address;
25
+ maker: Address;
26
+ tokensBurned: bigint;
27
+ };
28
+
29
+ export type OptionClosedArgs = {
30
+ optionAccount: Address;
31
+ maker: Address;
32
+ tokensBurned: number | bigint;
33
+ };
34
+
35
+ export function getOptionClosedEncoder(): FixedSizeEncoder<OptionClosedArgs> {
36
+ return getStructEncoder([
37
+ ["optionAccount", getAddressEncoder()],
38
+ ["maker", getAddressEncoder()],
39
+ ["tokensBurned", getU64Encoder()],
40
+ ]);
41
+ }
42
+
43
+ export function getOptionClosedDecoder(): FixedSizeDecoder<OptionClosed> {
44
+ return getStructDecoder([
45
+ ["optionAccount", getAddressDecoder()],
46
+ ["maker", getAddressDecoder()],
47
+ ["tokensBurned", getU64Decoder()],
48
+ ]);
49
+ }
50
+
51
+ export function getOptionClosedCodec(): FixedSizeCodec<
52
+ OptionClosedArgs,
53
+ OptionClosed
54
+ > {
55
+ return combineCodec(getOptionClosedEncoder(), getOptionClosedDecoder());
56
+ }
@@ -0,0 +1,62 @@
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
+ getU64Decoder,
18
+ getU64Encoder,
19
+ type Address,
20
+ type FixedSizeCodec,
21
+ type FixedSizeDecoder,
22
+ type FixedSizeEncoder,
23
+ } from "@solana/kit";
24
+
25
+ export type OptionExercised = {
26
+ buyer: Address;
27
+ optionAccount: Address;
28
+ exerciseValue: bigint;
29
+ exercisedAt: bigint;
30
+ };
31
+
32
+ export type OptionExercisedArgs = {
33
+ buyer: Address;
34
+ optionAccount: Address;
35
+ exerciseValue: number | bigint;
36
+ exercisedAt: number | bigint;
37
+ };
38
+
39
+ export function getOptionExercisedEncoder(): FixedSizeEncoder<OptionExercisedArgs> {
40
+ return getStructEncoder([
41
+ ["buyer", getAddressEncoder()],
42
+ ["optionAccount", getAddressEncoder()],
43
+ ["exerciseValue", getU64Encoder()],
44
+ ["exercisedAt", getI64Encoder()],
45
+ ]);
46
+ }
47
+
48
+ export function getOptionExercisedDecoder(): FixedSizeDecoder<OptionExercised> {
49
+ return getStructDecoder([
50
+ ["buyer", getAddressDecoder()],
51
+ ["optionAccount", getAddressDecoder()],
52
+ ["exerciseValue", getU64Decoder()],
53
+ ["exercisedAt", getI64Decoder()],
54
+ ]);
55
+ }
56
+
57
+ export function getOptionExercisedCodec(): FixedSizeCodec<
58
+ OptionExercisedArgs,
59
+ OptionExercised
60
+ > {
61
+ return combineCodec(getOptionExercisedEncoder(), getOptionExercisedDecoder());
62
+ }