@epicentral/sos-sdk 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +239 -0
- package/accounts/fetchers.ts +140 -0
- package/accounts/list.ts +152 -0
- package/accounts/pdas.ts +308 -0
- package/client/lookup-table.ts +32 -0
- package/client/program.ts +13 -0
- package/client/types.ts +8 -0
- package/generated/accounts/collateralPool.ts +217 -0
- package/generated/accounts/config.ts +156 -0
- package/generated/accounts/dualSourceContract.ts +235 -0
- package/generated/accounts/escrowState.ts +183 -0
- package/generated/accounts/index.ts +24 -0
- package/generated/accounts/lenderPosition.ts +211 -0
- package/generated/accounts/liquidityRouter.ts +223 -0
- package/generated/accounts/makerCollateralShare.ts +229 -0
- package/generated/accounts/makerPoolShare.ts +203 -0
- package/generated/accounts/marketDataAccount.ts +176 -0
- package/generated/accounts/optionAccount.ts +247 -0
- package/generated/accounts/optionPool.ts +253 -0
- package/generated/accounts/poolLoan.ts +220 -0
- package/generated/accounts/positionAccount.ts +187 -0
- package/generated/accounts/priceUpdateV2.ts +163 -0
- package/generated/accounts/vault.ts +304 -0
- package/generated/accounts/writerPosition.ts +297 -0
- package/generated/errors/index.ts +9 -0
- package/generated/errors/optionProgram.ts +392 -0
- package/generated/index.ts +13 -0
- package/generated/instructions/acceptAdmin.ts +230 -0
- package/generated/instructions/autoExerciseAllExpired.ts +523 -0
- package/generated/instructions/autoExerciseExpired.ts +623 -0
- package/generated/instructions/borrowFromPool.ts +554 -0
- package/generated/instructions/buyFromPool.ts +684 -0
- package/generated/instructions/claimPremium.ts +377 -0
- package/generated/instructions/closeLongToPool.ts +716 -0
- package/generated/instructions/closeOption.ts +235 -0
- package/generated/instructions/createEscrowV2.ts +518 -0
- package/generated/instructions/createLiquidityRouter.ts +361 -0
- package/generated/instructions/depositCollateral.ts +624 -0
- package/generated/instructions/depositToPool.ts +497 -0
- package/generated/instructions/depositToPosition.ts +429 -0
- package/generated/instructions/index.ts +45 -0
- package/generated/instructions/initCollateralPool.ts +513 -0
- package/generated/instructions/initConfig.ts +279 -0
- package/generated/instructions/initOptionPool.ts +587 -0
- package/generated/instructions/initializeMarketData.ts +359 -0
- package/generated/instructions/liquidateWriterPosition.ts +592 -0
- package/generated/instructions/omlpCreateVault.ts +547 -0
- package/generated/instructions/omlpTakeOfferWithFailover.ts +606 -0
- package/generated/instructions/omlpUpdateMaxLeverage.ts +304 -0
- package/generated/instructions/omlpUpdateProtocolFee.ts +304 -0
- package/generated/instructions/omlpUpdateSupplyLimit.ts +304 -0
- package/generated/instructions/optionExercise.ts +540 -0
- package/generated/instructions/optionMint.ts +1349 -0
- package/generated/instructions/optionValidate.ts +255 -0
- package/generated/instructions/repayPoolLoan.ts +499 -0
- package/generated/instructions/repayPoolLoanFromCollateral.ts +514 -0
- package/generated/instructions/settleMakerCollateral.ts +472 -0
- package/generated/instructions/syncWriterPosition.ts +206 -0
- package/generated/instructions/transferAdmin.ts +245 -0
- package/generated/instructions/unwindWriterUnsold.ts +668 -0
- package/generated/instructions/updateImpliedVolatility.ts +226 -0
- package/generated/instructions/updateMarketData.ts +315 -0
- package/generated/instructions/withdrawFromPool.ts +429 -0
- package/generated/instructions/withdrawFromPosition.ts +405 -0
- package/generated/instructions/writeToPool.ts +594 -0
- package/generated/programs/index.ts +9 -0
- package/generated/programs/optionProgram.ts +832 -0
- package/generated/shared/index.ts +164 -0
- package/generated/types/borrowedFromSAP1.ts +75 -0
- package/generated/types/borrowedFromSAP2.ts +83 -0
- package/generated/types/failoverTriggered.ts +85 -0
- package/generated/types/impliedVolatilityUpdated.ts +73 -0
- package/generated/types/index.ts +32 -0
- package/generated/types/liquidationExecuted.ts +73 -0
- package/generated/types/liquidityMetrics.ts +69 -0
- package/generated/types/liquidityRouterCreated.ts +79 -0
- package/generated/types/marketDataInitialized.ts +61 -0
- package/generated/types/marketDataUpdated.ts +69 -0
- package/generated/types/optionClosed.ts +56 -0
- package/generated/types/optionExercised.ts +62 -0
- package/generated/types/optionExpired.ts +49 -0
- package/generated/types/optionMinted.ts +78 -0
- package/generated/types/optionType.ts +38 -0
- package/generated/types/optionValidated.ts +82 -0
- package/generated/types/poolLoanCreated.ts +74 -0
- package/generated/types/poolLoanRepaid.ts +74 -0
- package/generated/types/positionDeposited.ts +73 -0
- package/generated/types/positionWithdrawn.ts +81 -0
- package/generated/types/priceFeedMessage.ts +117 -0
- package/generated/types/protocolFeeUpdated.ts +69 -0
- package/generated/types/sap2Provider.ts +38 -0
- package/generated/types/vaultCreated.ts +60 -0
- package/generated/types/verificationLevel.ts +95 -0
- package/index.ts +25 -0
- package/long/builders.ts +126 -0
- package/long/exercise.ts +49 -0
- package/long/quotes.ts +48 -0
- package/omlp/builders.ts +74 -0
- package/omlp/service.ts +94 -0
- package/package.json +22 -0
- package/shared/amounts.ts +32 -0
- package/shared/errors.ts +12 -0
- package/shared/remaining-accounts.ts +41 -0
- package/shared/transactions.ts +49 -0
- package/short/builders.ts +268 -0
- package/short/claim-premium.ts +37 -0
- package/short/close-option.ts +34 -0
- package/short/pool.ts +224 -0
- package/tsconfig.json +12 -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,75 @@
|
|
|
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
|
+
addDecoderSizePrefix,
|
|
11
|
+
addEncoderSizePrefix,
|
|
12
|
+
combineCodec,
|
|
13
|
+
getAddressDecoder,
|
|
14
|
+
getAddressEncoder,
|
|
15
|
+
getStructDecoder,
|
|
16
|
+
getStructEncoder,
|
|
17
|
+
getU16Decoder,
|
|
18
|
+
getU16Encoder,
|
|
19
|
+
getU32Decoder,
|
|
20
|
+
getU32Encoder,
|
|
21
|
+
getU64Decoder,
|
|
22
|
+
getU64Encoder,
|
|
23
|
+
getUtf8Decoder,
|
|
24
|
+
getUtf8Encoder,
|
|
25
|
+
type Address,
|
|
26
|
+
type Codec,
|
|
27
|
+
type Decoder,
|
|
28
|
+
type Encoder,
|
|
29
|
+
} from "@solana/kit";
|
|
30
|
+
|
|
31
|
+
export type BorrowedFromSAP1 = {
|
|
32
|
+
contract: Address;
|
|
33
|
+
maker: Address;
|
|
34
|
+
amount: bigint;
|
|
35
|
+
omlpUtilization: number;
|
|
36
|
+
source: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type BorrowedFromSAP1Args = {
|
|
40
|
+
contract: Address;
|
|
41
|
+
maker: Address;
|
|
42
|
+
amount: number | bigint;
|
|
43
|
+
omlpUtilization: number;
|
|
44
|
+
source: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function getBorrowedFromSAP1Encoder(): Encoder<BorrowedFromSAP1Args> {
|
|
48
|
+
return getStructEncoder([
|
|
49
|
+
["contract", getAddressEncoder()],
|
|
50
|
+
["maker", getAddressEncoder()],
|
|
51
|
+
["amount", getU64Encoder()],
|
|
52
|
+
["omlpUtilization", getU16Encoder()],
|
|
53
|
+
["source", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getBorrowedFromSAP1Decoder(): Decoder<BorrowedFromSAP1> {
|
|
58
|
+
return getStructDecoder([
|
|
59
|
+
["contract", getAddressDecoder()],
|
|
60
|
+
["maker", getAddressDecoder()],
|
|
61
|
+
["amount", getU64Decoder()],
|
|
62
|
+
["omlpUtilization", getU16Decoder()],
|
|
63
|
+
["source", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getBorrowedFromSAP1Codec(): Codec<
|
|
68
|
+
BorrowedFromSAP1Args,
|
|
69
|
+
BorrowedFromSAP1
|
|
70
|
+
> {
|
|
71
|
+
return combineCodec(
|
|
72
|
+
getBorrowedFromSAP1Encoder(),
|
|
73
|
+
getBorrowedFromSAP1Decoder(),
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
addDecoderSizePrefix,
|
|
11
|
+
addEncoderSizePrefix,
|
|
12
|
+
combineCodec,
|
|
13
|
+
getAddressDecoder,
|
|
14
|
+
getAddressEncoder,
|
|
15
|
+
getStructDecoder,
|
|
16
|
+
getStructEncoder,
|
|
17
|
+
getU32Decoder,
|
|
18
|
+
getU32Encoder,
|
|
19
|
+
getU64Decoder,
|
|
20
|
+
getU64Encoder,
|
|
21
|
+
getUtf8Decoder,
|
|
22
|
+
getUtf8Encoder,
|
|
23
|
+
type Address,
|
|
24
|
+
type Codec,
|
|
25
|
+
type Decoder,
|
|
26
|
+
type Encoder,
|
|
27
|
+
} from "@solana/kit";
|
|
28
|
+
import {
|
|
29
|
+
getSap2ProviderDecoder,
|
|
30
|
+
getSap2ProviderEncoder,
|
|
31
|
+
type Sap2Provider,
|
|
32
|
+
type Sap2ProviderArgs,
|
|
33
|
+
} from ".";
|
|
34
|
+
|
|
35
|
+
export type BorrowedFromSAP2 = {
|
|
36
|
+
contract: Address;
|
|
37
|
+
maker: Address;
|
|
38
|
+
amount: bigint;
|
|
39
|
+
externalLoanId: bigint;
|
|
40
|
+
provider: Sap2Provider;
|
|
41
|
+
source: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type BorrowedFromSAP2Args = {
|
|
45
|
+
contract: Address;
|
|
46
|
+
maker: Address;
|
|
47
|
+
amount: number | bigint;
|
|
48
|
+
externalLoanId: number | bigint;
|
|
49
|
+
provider: Sap2ProviderArgs;
|
|
50
|
+
source: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export function getBorrowedFromSAP2Encoder(): Encoder<BorrowedFromSAP2Args> {
|
|
54
|
+
return getStructEncoder([
|
|
55
|
+
["contract", getAddressEncoder()],
|
|
56
|
+
["maker", getAddressEncoder()],
|
|
57
|
+
["amount", getU64Encoder()],
|
|
58
|
+
["externalLoanId", getU64Encoder()],
|
|
59
|
+
["provider", getSap2ProviderEncoder()],
|
|
60
|
+
["source", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getBorrowedFromSAP2Decoder(): Decoder<BorrowedFromSAP2> {
|
|
65
|
+
return getStructDecoder([
|
|
66
|
+
["contract", getAddressDecoder()],
|
|
67
|
+
["maker", getAddressDecoder()],
|
|
68
|
+
["amount", getU64Decoder()],
|
|
69
|
+
["externalLoanId", getU64Decoder()],
|
|
70
|
+
["provider", getSap2ProviderDecoder()],
|
|
71
|
+
["source", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function getBorrowedFromSAP2Codec(): Codec<
|
|
76
|
+
BorrowedFromSAP2Args,
|
|
77
|
+
BorrowedFromSAP2
|
|
78
|
+
> {
|
|
79
|
+
return combineCodec(
|
|
80
|
+
getBorrowedFromSAP2Encoder(),
|
|
81
|
+
getBorrowedFromSAP2Decoder(),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
addDecoderSizePrefix,
|
|
11
|
+
addEncoderSizePrefix,
|
|
12
|
+
combineCodec,
|
|
13
|
+
getAddressDecoder,
|
|
14
|
+
getAddressEncoder,
|
|
15
|
+
getI64Decoder,
|
|
16
|
+
getI64Encoder,
|
|
17
|
+
getStructDecoder,
|
|
18
|
+
getStructEncoder,
|
|
19
|
+
getU16Decoder,
|
|
20
|
+
getU16Encoder,
|
|
21
|
+
getU32Decoder,
|
|
22
|
+
getU32Encoder,
|
|
23
|
+
getU64Decoder,
|
|
24
|
+
getU64Encoder,
|
|
25
|
+
getUtf8Decoder,
|
|
26
|
+
getUtf8Encoder,
|
|
27
|
+
type Address,
|
|
28
|
+
type Codec,
|
|
29
|
+
type Decoder,
|
|
30
|
+
type Encoder,
|
|
31
|
+
} from "@solana/kit";
|
|
32
|
+
|
|
33
|
+
export type FailoverTriggered = {
|
|
34
|
+
contract: Address;
|
|
35
|
+
fromSap: string;
|
|
36
|
+
toSap: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
sap1Utilization: number;
|
|
39
|
+
amountRequested: bigint;
|
|
40
|
+
triggeredAt: bigint;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type FailoverTriggeredArgs = {
|
|
44
|
+
contract: Address;
|
|
45
|
+
fromSap: string;
|
|
46
|
+
toSap: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
sap1Utilization: number;
|
|
49
|
+
amountRequested: number | bigint;
|
|
50
|
+
triggeredAt: number | bigint;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export function getFailoverTriggeredEncoder(): Encoder<FailoverTriggeredArgs> {
|
|
54
|
+
return getStructEncoder([
|
|
55
|
+
["contract", getAddressEncoder()],
|
|
56
|
+
["fromSap", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
57
|
+
["toSap", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
58
|
+
["reason", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
59
|
+
["sap1Utilization", getU16Encoder()],
|
|
60
|
+
["amountRequested", getU64Encoder()],
|
|
61
|
+
["triggeredAt", getI64Encoder()],
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function getFailoverTriggeredDecoder(): Decoder<FailoverTriggered> {
|
|
66
|
+
return getStructDecoder([
|
|
67
|
+
["contract", getAddressDecoder()],
|
|
68
|
+
["fromSap", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
69
|
+
["toSap", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
70
|
+
["reason", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
71
|
+
["sap1Utilization", getU16Decoder()],
|
|
72
|
+
["amountRequested", getU64Decoder()],
|
|
73
|
+
["triggeredAt", getI64Decoder()],
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getFailoverTriggeredCodec(): Codec<
|
|
78
|
+
FailoverTriggeredArgs,
|
|
79
|
+
FailoverTriggered
|
|
80
|
+
> {
|
|
81
|
+
return combineCodec(
|
|
82
|
+
getFailoverTriggeredEncoder(),
|
|
83
|
+
getFailoverTriggeredDecoder(),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -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,32 @@
|
|
|
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 "./borrowedFromSAP1";
|
|
10
|
+
export * from "./borrowedFromSAP2";
|
|
11
|
+
export * from "./failoverTriggered";
|
|
12
|
+
export * from "./impliedVolatilityUpdated";
|
|
13
|
+
export * from "./liquidationExecuted";
|
|
14
|
+
export * from "./liquidityMetrics";
|
|
15
|
+
export * from "./liquidityRouterCreated";
|
|
16
|
+
export * from "./marketDataInitialized";
|
|
17
|
+
export * from "./marketDataUpdated";
|
|
18
|
+
export * from "./optionClosed";
|
|
19
|
+
export * from "./optionExercised";
|
|
20
|
+
export * from "./optionExpired";
|
|
21
|
+
export * from "./optionMinted";
|
|
22
|
+
export * from "./optionType";
|
|
23
|
+
export * from "./optionValidated";
|
|
24
|
+
export * from "./poolLoanCreated";
|
|
25
|
+
export * from "./poolLoanRepaid";
|
|
26
|
+
export * from "./positionDeposited";
|
|
27
|
+
export * from "./positionWithdrawn";
|
|
28
|
+
export * from "./priceFeedMessage";
|
|
29
|
+
export * from "./protocolFeeUpdated";
|
|
30
|
+
export * from "./sap2Provider";
|
|
31
|
+
export * from "./vaultCreated";
|
|
32
|
+
export * from "./verificationLevel";
|
|
@@ -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,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
|
+
getU64Decoder,
|
|
18
|
+
getU64Encoder,
|
|
19
|
+
type Address,
|
|
20
|
+
type FixedSizeCodec,
|
|
21
|
+
type FixedSizeDecoder,
|
|
22
|
+
type FixedSizeEncoder,
|
|
23
|
+
} from "@solana/kit";
|
|
24
|
+
|
|
25
|
+
export type LiquidityMetrics = {
|
|
26
|
+
router: Address;
|
|
27
|
+
sap1Total: bigint;
|
|
28
|
+
sap2Total: bigint;
|
|
29
|
+
failoverCount: bigint;
|
|
30
|
+
timestamp: bigint;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type LiquidityMetricsArgs = {
|
|
34
|
+
router: Address;
|
|
35
|
+
sap1Total: number | bigint;
|
|
36
|
+
sap2Total: number | bigint;
|
|
37
|
+
failoverCount: number | bigint;
|
|
38
|
+
timestamp: number | bigint;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function getLiquidityMetricsEncoder(): FixedSizeEncoder<LiquidityMetricsArgs> {
|
|
42
|
+
return getStructEncoder([
|
|
43
|
+
["router", getAddressEncoder()],
|
|
44
|
+
["sap1Total", getU64Encoder()],
|
|
45
|
+
["sap2Total", getU64Encoder()],
|
|
46
|
+
["failoverCount", getU64Encoder()],
|
|
47
|
+
["timestamp", getI64Encoder()],
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getLiquidityMetricsDecoder(): FixedSizeDecoder<LiquidityMetrics> {
|
|
52
|
+
return getStructDecoder([
|
|
53
|
+
["router", getAddressDecoder()],
|
|
54
|
+
["sap1Total", getU64Decoder()],
|
|
55
|
+
["sap2Total", getU64Decoder()],
|
|
56
|
+
["failoverCount", getU64Decoder()],
|
|
57
|
+
["timestamp", getI64Decoder()],
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getLiquidityMetricsCodec(): FixedSizeCodec<
|
|
62
|
+
LiquidityMetricsArgs,
|
|
63
|
+
LiquidityMetrics
|
|
64
|
+
> {
|
|
65
|
+
return combineCodec(
|
|
66
|
+
getLiquidityMetricsEncoder(),
|
|
67
|
+
getLiquidityMetricsDecoder(),
|
|
68
|
+
);
|
|
69
|
+
}
|