@acta-markets/ts-sdk 0.0.1-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.
- package/README.md +308 -0
- package/dist/actaClient.d.ts +46 -0
- package/dist/actaClient.js +99 -0
- package/dist/chain/client.d.ts +65 -0
- package/dist/chain/client.js +82 -0
- package/dist/chain/fetch.d.ts +204 -0
- package/dist/chain/fetch.js +392 -0
- package/dist/chain/fetch.test.d.ts +1 -0
- package/dist/chain/fetch.test.js +158 -0
- package/dist/chain/flows/index.d.ts +1 -0
- package/dist/chain/flows/index.js +1 -0
- package/dist/chain/flows/openPosition.d.ts +48 -0
- package/dist/chain/flows/openPosition.js +78 -0
- package/dist/chain/flows/openPosition.test.d.ts +1 -0
- package/dist/chain/flows/openPosition.test.js +43 -0
- package/dist/chain/helpers.d.ts +16 -0
- package/dist/chain/helpers.js +60 -0
- package/dist/chain/index.d.ts +9 -0
- package/dist/chain/index.js +9 -0
- package/dist/chain/instructions.admin.d.ts +44 -0
- package/dist/chain/instructions.admin.js +113 -0
- package/dist/chain/instructions.d.ts +5 -0
- package/dist/chain/instructions.js +5 -0
- package/dist/chain/instructions.maker.d.ts +34 -0
- package/dist/chain/instructions.maker.js +86 -0
- package/dist/chain/instructions.market.d.ts +39 -0
- package/dist/chain/instructions.market.js +107 -0
- package/dist/chain/instructions.oracle.d.ts +38 -0
- package/dist/chain/instructions.oracle.js +63 -0
- package/dist/chain/instructions.position.d.ts +82 -0
- package/dist/chain/instructions.position.js +240 -0
- package/dist/chain/instructions.resolve.test.d.ts +1 -0
- package/dist/chain/instructions.resolve.test.js +32 -0
- package/dist/chain/instructions.shared.d.ts +23 -0
- package/dist/chain/instructions.shared.js +55 -0
- package/dist/chain/orders.d.ts +40 -0
- package/dist/chain/orders.js +117 -0
- package/dist/chain/orders.test.d.ts +1 -0
- package/dist/chain/orders.test.js +67 -0
- package/dist/chain/signers.d.ts +9 -0
- package/dist/chain/signers.js +19 -0
- package/dist/chain/signers.test.d.ts +1 -0
- package/dist/chain/signers.test.js +13 -0
- package/dist/chain/token.d.ts +59 -0
- package/dist/chain/token.js +136 -0
- package/dist/chain/token.test.d.ts +1 -0
- package/dist/chain/token.test.js +69 -0
- package/dist/chain/tx.d.ts +72 -0
- package/dist/chain/tx.js +97 -0
- package/dist/cjs/actaClient.js +103 -0
- package/dist/cjs/chain/client.js +119 -0
- package/dist/cjs/chain/fetch.js +431 -0
- package/dist/cjs/chain/fetch.test.js +160 -0
- package/dist/cjs/chain/flows/index.js +17 -0
- package/dist/cjs/chain/flows/openPosition.js +81 -0
- package/dist/cjs/chain/flows/openPosition.test.js +45 -0
- package/dist/cjs/chain/helpers.js +67 -0
- package/dist/cjs/chain/index.js +48 -0
- package/dist/cjs/chain/instructions.admin.js +119 -0
- package/dist/cjs/chain/instructions.js +21 -0
- package/dist/cjs/chain/instructions.maker.js +92 -0
- package/dist/cjs/chain/instructions.market.js +112 -0
- package/dist/cjs/chain/instructions.oracle.js +70 -0
- package/dist/cjs/chain/instructions.position.js +247 -0
- package/dist/cjs/chain/instructions.resolve.test.js +34 -0
- package/dist/cjs/chain/instructions.shared.js +64 -0
- package/dist/cjs/chain/orders.js +126 -0
- package/dist/cjs/chain/orders.test.js +69 -0
- package/dist/cjs/chain/signers.js +22 -0
- package/dist/cjs/chain/signers.test.js +15 -0
- package/dist/cjs/chain/token.js +147 -0
- package/dist/cjs/chain/token.test.js +71 -0
- package/dist/cjs/chain/tx.js +103 -0
- package/dist/cjs/constants.js +6 -0
- package/dist/cjs/constants.test.js +31 -0
- package/dist/cjs/events.js +75 -0
- package/dist/cjs/events.test.js +384 -0
- package/dist/cjs/generated/accounts/config.js +79 -0
- package/dist/cjs/generated/accounts/index.js +28 -0
- package/dist/cjs/generated/accounts/maker.js +71 -0
- package/dist/cjs/generated/accounts/market.js +93 -0
- package/dist/cjs/generated/accounts/oracle.js +85 -0
- package/dist/cjs/generated/accounts/position.js +89 -0
- package/dist/cjs/generated/errors/actaContract.js +154 -0
- package/dist/cjs/generated/errors/index.js +24 -0
- package/dist/cjs/generated/index.js +28 -0
- package/dist/cjs/generated/instructions/changeOracleSource.js +81 -0
- package/dist/cjs/generated/instructions/closeMarket.js +83 -0
- package/dist/cjs/generated/instructions/closeOracle.js +79 -0
- package/dist/cjs/generated/instructions/createMarket.js +116 -0
- package/dist/cjs/generated/instructions/createOracle.js +99 -0
- package/dist/cjs/generated/instructions/depositFundsToPosition.js +101 -0
- package/dist/cjs/generated/instructions/depositPremium.js +96 -0
- package/dist/cjs/generated/instructions/finalizeMarket.js +91 -0
- package/dist/cjs/generated/instructions/index.js +43 -0
- package/dist/cjs/generated/instructions/initializeConfig.js +108 -0
- package/dist/cjs/generated/instructions/liquidatePosition.js +107 -0
- package/dist/cjs/generated/instructions/openPosition.js +154 -0
- package/dist/cjs/generated/instructions/registerMaker.js +90 -0
- package/dist/cjs/generated/instructions/setOracleConfig.js +80 -0
- package/dist/cjs/generated/instructions/settlePosition.js +104 -0
- package/dist/cjs/generated/instructions/topupFeeFund.js +96 -0
- package/dist/cjs/generated/instructions/updateConfig.js +86 -0
- package/dist/cjs/generated/instructions/updateMakerQuoteSigning.js +79 -0
- package/dist/cjs/generated/instructions/updateMarketOracles.js +96 -0
- package/dist/cjs/generated/instructions/updateOraclePrice.js +89 -0
- package/dist/cjs/generated/instructions/withdrawFromFeeFund.js +96 -0
- package/dist/cjs/generated/instructions/withdrawPremium.js +96 -0
- package/dist/cjs/generated/programs/actaContract.js +108 -0
- package/dist/cjs/generated/programs/index.js +24 -0
- package/dist/cjs/generated/shared/index.js +94 -0
- package/dist/cjs/generated/types/actaEvent.js +342 -0
- package/dist/cjs/generated/types/eventKind.js +45 -0
- package/dist/cjs/generated/types/index.js +27 -0
- package/dist/cjs/generated/types/positionStatus.js +31 -0
- package/dist/cjs/generated/types/positionType.js +28 -0
- package/dist/cjs/idl/acta_contract.json +2329 -0
- package/dist/cjs/idl/hash.js +4 -0
- package/dist/cjs/index.js +84 -0
- package/dist/cjs/nonce.js +93 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types/index.js +18 -0
- package/dist/cjs/types/orderId.js +40 -0
- package/dist/cjs/types/orders.js +10 -0
- package/dist/cjs/ws/apy.js +106 -0
- package/dist/cjs/ws/apy.test.js +29 -0
- package/dist/cjs/ws/auth.js +104 -0
- package/dist/cjs/ws/client.handshake.integration.test.js +69 -0
- package/dist/cjs/ws/client.js +861 -0
- package/dist/cjs/ws/client.test.js +230 -0
- package/dist/cjs/ws/discovery.js +48 -0
- package/dist/cjs/ws/flows.js +101 -0
- package/dist/cjs/ws/flows.test.js +85 -0
- package/dist/cjs/ws/index.js +23 -0
- package/dist/cjs/ws/sponsoredTx.js +95 -0
- package/dist/cjs/ws/types.js +14 -0
- package/dist/cjs/ws/wirePolicy.js +34 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +3 -0
- package/dist/constants.test.d.ts +1 -0
- package/dist/constants.test.js +29 -0
- package/dist/events.d.ts +15 -0
- package/dist/events.js +64 -0
- package/dist/events.test.d.ts +1 -0
- package/dist/events.test.js +382 -0
- package/dist/generated/accounts/config.d.ts +47 -0
- package/dist/generated/accounts/config.js +68 -0
- package/dist/generated/accounts/index.d.ts +12 -0
- package/dist/generated/accounts/index.js +12 -0
- package/dist/generated/accounts/maker.d.ts +39 -0
- package/dist/generated/accounts/maker.js +60 -0
- package/dist/generated/accounts/market.d.ts +61 -0
- package/dist/generated/accounts/market.js +82 -0
- package/dist/generated/accounts/oracle.d.ts +53 -0
- package/dist/generated/accounts/oracle.js +74 -0
- package/dist/generated/accounts/position.d.ts +57 -0
- package/dist/generated/accounts/position.js +78 -0
- package/dist/generated/errors/actaContract.d.ts +103 -0
- package/dist/generated/errors/actaContract.js +149 -0
- package/dist/generated/errors/index.d.ts +8 -0
- package/dist/generated/errors/index.js +8 -0
- package/dist/generated/index.d.ts +12 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/instructions/changeOracleSource.d.ts +50 -0
- package/dist/generated/instructions/changeOracleSource.js +72 -0
- package/dist/generated/instructions/closeMarket.d.ts +58 -0
- package/dist/generated/instructions/closeMarket.js +74 -0
- package/dist/generated/instructions/closeOracle.d.ts +48 -0
- package/dist/generated/instructions/closeOracle.js +70 -0
- package/dist/generated/instructions/createMarket.d.ts +90 -0
- package/dist/generated/instructions/createMarket.js +107 -0
- package/dist/generated/instructions/createOracle.d.ts +71 -0
- package/dist/generated/instructions/createOracle.js +90 -0
- package/dist/generated/instructions/depositFundsToPosition.d.ts +73 -0
- package/dist/generated/instructions/depositFundsToPosition.js +92 -0
- package/dist/generated/instructions/depositPremium.d.ts +62 -0
- package/dist/generated/instructions/depositPremium.js +87 -0
- package/dist/generated/instructions/finalizeMarket.d.ts +63 -0
- package/dist/generated/instructions/finalizeMarket.js +82 -0
- package/dist/generated/instructions/index.d.ts +27 -0
- package/dist/generated/instructions/index.js +27 -0
- package/dist/generated/instructions/initializeConfig.d.ts +75 -0
- package/dist/generated/instructions/initializeConfig.js +99 -0
- package/dist/generated/instructions/liquidatePosition.d.ts +78 -0
- package/dist/generated/instructions/liquidatePosition.js +98 -0
- package/dist/generated/instructions/openPosition.d.ts +130 -0
- package/dist/generated/instructions/openPosition.js +145 -0
- package/dist/generated/instructions/registerMaker.d.ts +57 -0
- package/dist/generated/instructions/registerMaker.js +81 -0
- package/dist/generated/instructions/setOracleConfig.d.ts +53 -0
- package/dist/generated/instructions/setOracleConfig.js +71 -0
- package/dist/generated/instructions/settlePosition.d.ts +78 -0
- package/dist/generated/instructions/settlePosition.js +95 -0
- package/dist/generated/instructions/topupFeeFund.d.ts +67 -0
- package/dist/generated/instructions/topupFeeFund.js +87 -0
- package/dist/generated/instructions/updateConfig.d.ts +58 -0
- package/dist/generated/instructions/updateConfig.js +77 -0
- package/dist/generated/instructions/updateMakerQuoteSigning.d.ts +47 -0
- package/dist/generated/instructions/updateMakerQuoteSigning.js +70 -0
- package/dist/generated/instructions/updateMarketOracles.d.ts +65 -0
- package/dist/generated/instructions/updateMarketOracles.js +87 -0
- package/dist/generated/instructions/updateOraclePrice.d.ts +55 -0
- package/dist/generated/instructions/updateOraclePrice.js +80 -0
- package/dist/generated/instructions/withdrawFromFeeFund.d.ts +62 -0
- package/dist/generated/instructions/withdrawFromFeeFund.js +87 -0
- package/dist/generated/instructions/withdrawPremium.d.ts +62 -0
- package/dist/generated/instructions/withdrawPremium.js +87 -0
- package/dist/generated/programs/actaContract.d.ts +83 -0
- package/dist/generated/programs/actaContract.js +104 -0
- package/dist/generated/programs/index.d.ts +8 -0
- package/dist/generated/programs/index.js +8 -0
- package/dist/generated/shared/index.d.ts +49 -0
- package/dist/generated/shared/index.js +86 -0
- package/dist/generated/types/actaEvent.d.ts +249 -0
- package/dist/generated/types/actaEvent.js +335 -0
- package/dist/generated/types/eventKind.d.ts +33 -0
- package/dist/generated/types/eventKind.js +39 -0
- package/dist/generated/types/index.d.ts +11 -0
- package/dist/generated/types/index.js +11 -0
- package/dist/generated/types/positionStatus.d.ts +19 -0
- package/dist/generated/types/positionStatus.js +25 -0
- package/dist/generated/types/positionType.d.ts +16 -0
- package/dist/generated/types/positionType.js +22 -0
- package/dist/idl/acta_contract.json +2329 -0
- package/dist/idl/hash.d.ts +1 -0
- package/dist/idl/hash.js +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +34 -0
- package/dist/nonce.d.ts +29 -0
- package/dist/nonce.js +89 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/orderId.d.ts +13 -0
- package/dist/types/orderId.js +35 -0
- package/dist/types/orders.d.ts +9 -0
- package/dist/types/orders.js +9 -0
- package/dist/ws/apy.d.ts +79 -0
- package/dist/ws/apy.js +98 -0
- package/dist/ws/apy.test.d.ts +1 -0
- package/dist/ws/apy.test.js +27 -0
- package/dist/ws/auth.d.ts +67 -0
- package/dist/ws/auth.js +98 -0
- package/dist/ws/client.d.ts +263 -0
- package/dist/ws/client.handshake.integration.test.d.ts +1 -0
- package/dist/ws/client.handshake.integration.test.js +64 -0
- package/dist/ws/client.js +857 -0
- package/dist/ws/client.test.d.ts +1 -0
- package/dist/ws/client.test.js +228 -0
- package/dist/ws/discovery.d.ts +13 -0
- package/dist/ws/discovery.js +44 -0
- package/dist/ws/flows.d.ts +44 -0
- package/dist/ws/flows.js +96 -0
- package/dist/ws/flows.test.d.ts +1 -0
- package/dist/ws/flows.test.js +83 -0
- package/dist/ws/index.d.ts +7 -0
- package/dist/ws/index.js +7 -0
- package/dist/ws/sponsoredTx.d.ts +39 -0
- package/dist/ws/sponsoredTx.js +92 -0
- package/dist/ws/types.d.ts +900 -0
- package/dist/ws/types.js +13 -0
- package/dist/ws/wirePolicy.d.ts +12 -0
- package/dist/ws/wirePolicy.js +30 -0
- package/package.json +87 -0
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
export declare const UPDATE_ORACLE_PRICE_DISCRIMINATOR = 16;
|
|
11
|
+
export declare function getUpdateOraclePriceDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type UpdateOraclePriceInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountOraclePda extends string | AccountMeta<string> = string, TAccountClockSysvar extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
14
|
+
TAccountOraclePda extends string ? WritableAccount<TAccountOraclePda> : TAccountOraclePda,
|
|
15
|
+
TAccountClockSysvar extends string ? ReadonlyAccount<TAccountClockSysvar> : TAccountClockSysvar,
|
|
16
|
+
...TRemainingAccounts
|
|
17
|
+
]>;
|
|
18
|
+
export type UpdateOraclePriceInstructionData = {
|
|
19
|
+
discriminator: number;
|
|
20
|
+
price: bigint;
|
|
21
|
+
settledExpiryTs: bigint;
|
|
22
|
+
};
|
|
23
|
+
export type UpdateOraclePriceInstructionDataArgs = {
|
|
24
|
+
price: number | bigint;
|
|
25
|
+
settledExpiryTs: number | bigint;
|
|
26
|
+
};
|
|
27
|
+
export declare function getUpdateOraclePriceInstructionDataEncoder(): FixedSizeEncoder<UpdateOraclePriceInstructionDataArgs>;
|
|
28
|
+
export declare function getUpdateOraclePriceInstructionDataDecoder(): FixedSizeDecoder<UpdateOraclePriceInstructionData>;
|
|
29
|
+
export declare function getUpdateOraclePriceInstructionDataCodec(): FixedSizeCodec<UpdateOraclePriceInstructionDataArgs, UpdateOraclePriceInstructionData>;
|
|
30
|
+
export type UpdateOraclePriceInput<TAccountAuthority extends string = string, TAccountOraclePda extends string = string, TAccountClockSysvar extends string = string> = {
|
|
31
|
+
/** Oracle authority signer (or protocol admin) */
|
|
32
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
33
|
+
/** Oracle PDA to update */
|
|
34
|
+
oraclePda: Address<TAccountOraclePda>;
|
|
35
|
+
/** Clock sysvar account */
|
|
36
|
+
clockSysvar?: Address<TAccountClockSysvar>;
|
|
37
|
+
price: UpdateOraclePriceInstructionDataArgs["price"];
|
|
38
|
+
settledExpiryTs: UpdateOraclePriceInstructionDataArgs["settledExpiryTs"];
|
|
39
|
+
};
|
|
40
|
+
export declare function getUpdateOraclePriceInstruction<TAccountAuthority extends string, TAccountOraclePda extends string, TAccountClockSysvar extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: UpdateOraclePriceInput<TAccountAuthority, TAccountOraclePda, TAccountClockSysvar>, config?: {
|
|
41
|
+
programAddress?: TProgramAddress;
|
|
42
|
+
}): UpdateOraclePriceInstruction<TProgramAddress, TAccountAuthority, TAccountOraclePda, TAccountClockSysvar>;
|
|
43
|
+
export type ParsedUpdateOraclePriceInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
44
|
+
programAddress: Address<TProgram>;
|
|
45
|
+
accounts: {
|
|
46
|
+
/** Oracle authority signer (or protocol admin) */
|
|
47
|
+
authority: TAccountMetas[0];
|
|
48
|
+
/** Oracle PDA to update */
|
|
49
|
+
oraclePda: TAccountMetas[1];
|
|
50
|
+
/** Clock sysvar account */
|
|
51
|
+
clockSysvar: TAccountMetas[2];
|
|
52
|
+
};
|
|
53
|
+
data: UpdateOraclePriceInstructionData;
|
|
54
|
+
};
|
|
55
|
+
export declare function parseUpdateOraclePriceInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateOraclePriceInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
import { combineCodec, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const UPDATE_ORACLE_PRICE_DISCRIMINATOR = 16;
|
|
12
|
+
export function getUpdateOraclePriceDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(UPDATE_ORACLE_PRICE_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getUpdateOraclePriceInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["price", getU64Encoder()],
|
|
19
|
+
["settledExpiryTs", getU64Encoder()],
|
|
20
|
+
]), (value) => ({ ...value, discriminator: UPDATE_ORACLE_PRICE_DISCRIMINATOR }));
|
|
21
|
+
}
|
|
22
|
+
export function getUpdateOraclePriceInstructionDataDecoder() {
|
|
23
|
+
return getStructDecoder([
|
|
24
|
+
["discriminator", getU8Decoder()],
|
|
25
|
+
["price", getU64Decoder()],
|
|
26
|
+
["settledExpiryTs", getU64Decoder()],
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
export function getUpdateOraclePriceInstructionDataCodec() {
|
|
30
|
+
return combineCodec(getUpdateOraclePriceInstructionDataEncoder(), getUpdateOraclePriceInstructionDataDecoder());
|
|
31
|
+
}
|
|
32
|
+
export function getUpdateOraclePriceInstruction(input, config) {
|
|
33
|
+
// Program address.
|
|
34
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
35
|
+
// Original accounts.
|
|
36
|
+
const originalAccounts = {
|
|
37
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
38
|
+
oraclePda: { value: input.oraclePda ?? null, isWritable: true },
|
|
39
|
+
clockSysvar: { value: input.clockSysvar ?? null, isWritable: false },
|
|
40
|
+
};
|
|
41
|
+
const accounts = originalAccounts;
|
|
42
|
+
// Original args.
|
|
43
|
+
const args = { ...input };
|
|
44
|
+
// Resolve default values.
|
|
45
|
+
if (!accounts.clockSysvar.value) {
|
|
46
|
+
accounts.clockSysvar.value =
|
|
47
|
+
"SysvarC1ock11111111111111111111111111111111";
|
|
48
|
+
}
|
|
49
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
50
|
+
return Object.freeze({
|
|
51
|
+
accounts: [
|
|
52
|
+
getAccountMeta(accounts.authority),
|
|
53
|
+
getAccountMeta(accounts.oraclePda),
|
|
54
|
+
getAccountMeta(accounts.clockSysvar),
|
|
55
|
+
],
|
|
56
|
+
data: getUpdateOraclePriceInstructionDataEncoder().encode(args),
|
|
57
|
+
programAddress,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function parseUpdateOraclePriceInstruction(instruction) {
|
|
61
|
+
if (instruction.accounts.length < 3) {
|
|
62
|
+
// TODO: Coded error.
|
|
63
|
+
throw new Error("Not enough accounts");
|
|
64
|
+
}
|
|
65
|
+
let accountIndex = 0;
|
|
66
|
+
const getNextAccount = () => {
|
|
67
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
68
|
+
accountIndex += 1;
|
|
69
|
+
return accountMeta;
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
programAddress: instruction.programAddress,
|
|
73
|
+
accounts: {
|
|
74
|
+
authority: getNextAccount(),
|
|
75
|
+
oraclePda: getNextAccount(),
|
|
76
|
+
clockSysvar: getNextAccount(),
|
|
77
|
+
},
|
|
78
|
+
data: getUpdateOraclePriceInstructionDataDecoder().decode(instruction.data),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -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
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
export declare const WITHDRAW_FROM_FEE_FUND_DISCRIMINATOR = 12;
|
|
11
|
+
export declare function getWithdrawFromFeeFundDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type WithdrawFromFeeFundInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountConfigPda extends string | AccountMeta<string> = string, TAccountProtocolFeeAta extends string | AccountMeta<string> = string, TAccountRecipientAta extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountAdmin extends string ? ReadonlySignerAccount<TAccountAdmin> & AccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
14
|
+
TAccountConfigPda extends string ? ReadonlyAccount<TAccountConfigPda> : TAccountConfigPda,
|
|
15
|
+
TAccountProtocolFeeAta extends string ? WritableAccount<TAccountProtocolFeeAta> : TAccountProtocolFeeAta,
|
|
16
|
+
TAccountRecipientAta extends string ? WritableAccount<TAccountRecipientAta> : TAccountRecipientAta,
|
|
17
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
18
|
+
...TRemainingAccounts
|
|
19
|
+
]>;
|
|
20
|
+
export type WithdrawFromFeeFundInstructionData = {
|
|
21
|
+
discriminator: number;
|
|
22
|
+
amount: bigint;
|
|
23
|
+
};
|
|
24
|
+
export type WithdrawFromFeeFundInstructionDataArgs = {
|
|
25
|
+
amount: number | bigint;
|
|
26
|
+
};
|
|
27
|
+
export declare function getWithdrawFromFeeFundInstructionDataEncoder(): FixedSizeEncoder<WithdrawFromFeeFundInstructionDataArgs>;
|
|
28
|
+
export declare function getWithdrawFromFeeFundInstructionDataDecoder(): FixedSizeDecoder<WithdrawFromFeeFundInstructionData>;
|
|
29
|
+
export declare function getWithdrawFromFeeFundInstructionDataCodec(): FixedSizeCodec<WithdrawFromFeeFundInstructionDataArgs, WithdrawFromFeeFundInstructionData>;
|
|
30
|
+
export type WithdrawFromFeeFundInput<TAccountAdmin extends string = string, TAccountConfigPda extends string = string, TAccountProtocolFeeAta extends string = string, TAccountRecipientAta extends string = string, TAccountTokenProgram extends string = string> = {
|
|
31
|
+
/** Protocol admin authority */
|
|
32
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
33
|
+
/** Config PDA for admin verification */
|
|
34
|
+
configPda: Address<TAccountConfigPda>;
|
|
35
|
+
/** Protocol fee custody ATA (source) */
|
|
36
|
+
protocolFeeAta: Address<TAccountProtocolFeeAta>;
|
|
37
|
+
/** Recipient ATA (destination) */
|
|
38
|
+
recipientAta: Address<TAccountRecipientAta>;
|
|
39
|
+
/** SPL token program */
|
|
40
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
41
|
+
amount: WithdrawFromFeeFundInstructionDataArgs["amount"];
|
|
42
|
+
};
|
|
43
|
+
export declare function getWithdrawFromFeeFundInstruction<TAccountAdmin extends string, TAccountConfigPda extends string, TAccountProtocolFeeAta extends string, TAccountRecipientAta extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: WithdrawFromFeeFundInput<TAccountAdmin, TAccountConfigPda, TAccountProtocolFeeAta, TAccountRecipientAta, TAccountTokenProgram>, config?: {
|
|
44
|
+
programAddress?: TProgramAddress;
|
|
45
|
+
}): WithdrawFromFeeFundInstruction<TProgramAddress, TAccountAdmin, TAccountConfigPda, TAccountProtocolFeeAta, TAccountRecipientAta, TAccountTokenProgram>;
|
|
46
|
+
export type ParsedWithdrawFromFeeFundInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
47
|
+
programAddress: Address<TProgram>;
|
|
48
|
+
accounts: {
|
|
49
|
+
/** Protocol admin authority */
|
|
50
|
+
admin: TAccountMetas[0];
|
|
51
|
+
/** Config PDA for admin verification */
|
|
52
|
+
configPda: TAccountMetas[1];
|
|
53
|
+
/** Protocol fee custody ATA (source) */
|
|
54
|
+
protocolFeeAta: TAccountMetas[2];
|
|
55
|
+
/** Recipient ATA (destination) */
|
|
56
|
+
recipientAta: TAccountMetas[3];
|
|
57
|
+
/** SPL token program */
|
|
58
|
+
tokenProgram: TAccountMetas[4];
|
|
59
|
+
};
|
|
60
|
+
data: WithdrawFromFeeFundInstructionData;
|
|
61
|
+
};
|
|
62
|
+
export declare function parseWithdrawFromFeeFundInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedWithdrawFromFeeFundInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
import { combineCodec, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const WITHDRAW_FROM_FEE_FUND_DISCRIMINATOR = 12;
|
|
12
|
+
export function getWithdrawFromFeeFundDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(WITHDRAW_FROM_FEE_FUND_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getWithdrawFromFeeFundInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["amount", getU64Encoder()],
|
|
19
|
+
]), (value) => ({
|
|
20
|
+
...value,
|
|
21
|
+
discriminator: WITHDRAW_FROM_FEE_FUND_DISCRIMINATOR,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
export function getWithdrawFromFeeFundInstructionDataDecoder() {
|
|
25
|
+
return getStructDecoder([
|
|
26
|
+
["discriminator", getU8Decoder()],
|
|
27
|
+
["amount", getU64Decoder()],
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
export function getWithdrawFromFeeFundInstructionDataCodec() {
|
|
31
|
+
return combineCodec(getWithdrawFromFeeFundInstructionDataEncoder(), getWithdrawFromFeeFundInstructionDataDecoder());
|
|
32
|
+
}
|
|
33
|
+
export function getWithdrawFromFeeFundInstruction(input, config) {
|
|
34
|
+
// Program address.
|
|
35
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
36
|
+
// Original accounts.
|
|
37
|
+
const originalAccounts = {
|
|
38
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
39
|
+
configPda: { value: input.configPda ?? null, isWritable: false },
|
|
40
|
+
protocolFeeAta: { value: input.protocolFeeAta ?? null, isWritable: true },
|
|
41
|
+
recipientAta: { value: input.recipientAta ?? null, isWritable: true },
|
|
42
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
43
|
+
};
|
|
44
|
+
const accounts = originalAccounts;
|
|
45
|
+
// Original args.
|
|
46
|
+
const args = { ...input };
|
|
47
|
+
// Resolve default values.
|
|
48
|
+
if (!accounts.tokenProgram.value) {
|
|
49
|
+
accounts.tokenProgram.value =
|
|
50
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
51
|
+
}
|
|
52
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
accounts: [
|
|
55
|
+
getAccountMeta(accounts.admin),
|
|
56
|
+
getAccountMeta(accounts.configPda),
|
|
57
|
+
getAccountMeta(accounts.protocolFeeAta),
|
|
58
|
+
getAccountMeta(accounts.recipientAta),
|
|
59
|
+
getAccountMeta(accounts.tokenProgram),
|
|
60
|
+
],
|
|
61
|
+
data: getWithdrawFromFeeFundInstructionDataEncoder().encode(args),
|
|
62
|
+
programAddress,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function parseWithdrawFromFeeFundInstruction(instruction) {
|
|
66
|
+
if (instruction.accounts.length < 5) {
|
|
67
|
+
// TODO: Coded error.
|
|
68
|
+
throw new Error("Not enough accounts");
|
|
69
|
+
}
|
|
70
|
+
let accountIndex = 0;
|
|
71
|
+
const getNextAccount = () => {
|
|
72
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
73
|
+
accountIndex += 1;
|
|
74
|
+
return accountMeta;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
programAddress: instruction.programAddress,
|
|
78
|
+
accounts: {
|
|
79
|
+
admin: getNextAccount(),
|
|
80
|
+
configPda: getNextAccount(),
|
|
81
|
+
protocolFeeAta: getNextAccount(),
|
|
82
|
+
recipientAta: getNextAccount(),
|
|
83
|
+
tokenProgram: getNextAccount(),
|
|
84
|
+
},
|
|
85
|
+
data: getWithdrawFromFeeFundInstructionDataDecoder().decode(instruction.data),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -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
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
export declare const WITHDRAW_PREMIUM_DISCRIMINATOR = 5;
|
|
11
|
+
export declare function getWithdrawPremiumDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type WithdrawPremiumInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMakerOwner extends string | AccountMeta<string> = string, TAccountMakerPda extends string | AccountMeta<string> = string, TAccountMakerPremiumAta extends string | AccountMeta<string> = string, TAccountMakerOwnerPremiumAta extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountMakerOwner extends string ? ReadonlySignerAccount<TAccountMakerOwner> & AccountSignerMeta<TAccountMakerOwner> : TAccountMakerOwner,
|
|
14
|
+
TAccountMakerPda extends string ? WritableAccount<TAccountMakerPda> : TAccountMakerPda,
|
|
15
|
+
TAccountMakerPremiumAta extends string ? WritableAccount<TAccountMakerPremiumAta> : TAccountMakerPremiumAta,
|
|
16
|
+
TAccountMakerOwnerPremiumAta extends string ? WritableAccount<TAccountMakerOwnerPremiumAta> : TAccountMakerOwnerPremiumAta,
|
|
17
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
18
|
+
...TRemainingAccounts
|
|
19
|
+
]>;
|
|
20
|
+
export type WithdrawPremiumInstructionData = {
|
|
21
|
+
discriminator: number;
|
|
22
|
+
amount: bigint;
|
|
23
|
+
};
|
|
24
|
+
export type WithdrawPremiumInstructionDataArgs = {
|
|
25
|
+
amount: number | bigint;
|
|
26
|
+
};
|
|
27
|
+
export declare function getWithdrawPremiumInstructionDataEncoder(): FixedSizeEncoder<WithdrawPremiumInstructionDataArgs>;
|
|
28
|
+
export declare function getWithdrawPremiumInstructionDataDecoder(): FixedSizeDecoder<WithdrawPremiumInstructionData>;
|
|
29
|
+
export declare function getWithdrawPremiumInstructionDataCodec(): FixedSizeCodec<WithdrawPremiumInstructionDataArgs, WithdrawPremiumInstructionData>;
|
|
30
|
+
export type WithdrawPremiumInput<TAccountMakerOwner extends string = string, TAccountMakerPda extends string = string, TAccountMakerPremiumAta extends string = string, TAccountMakerOwnerPremiumAta extends string = string, TAccountTokenProgram extends string = string> = {
|
|
31
|
+
/** Maker owner authority */
|
|
32
|
+
makerOwner: TransactionSigner<TAccountMakerOwner>;
|
|
33
|
+
/** Maker PDA for signer seeds */
|
|
34
|
+
makerPda: Address<TAccountMakerPda>;
|
|
35
|
+
/** Maker custody ATA (source) */
|
|
36
|
+
makerPremiumAta: Address<TAccountMakerPremiumAta>;
|
|
37
|
+
/** Maker wallet ATA (destination) */
|
|
38
|
+
makerOwnerPremiumAta: Address<TAccountMakerOwnerPremiumAta>;
|
|
39
|
+
/** SPL token program */
|
|
40
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
41
|
+
amount: WithdrawPremiumInstructionDataArgs["amount"];
|
|
42
|
+
};
|
|
43
|
+
export declare function getWithdrawPremiumInstruction<TAccountMakerOwner extends string, TAccountMakerPda extends string, TAccountMakerPremiumAta extends string, TAccountMakerOwnerPremiumAta extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: WithdrawPremiumInput<TAccountMakerOwner, TAccountMakerPda, TAccountMakerPremiumAta, TAccountMakerOwnerPremiumAta, TAccountTokenProgram>, config?: {
|
|
44
|
+
programAddress?: TProgramAddress;
|
|
45
|
+
}): WithdrawPremiumInstruction<TProgramAddress, TAccountMakerOwner, TAccountMakerPda, TAccountMakerPremiumAta, TAccountMakerOwnerPremiumAta, TAccountTokenProgram>;
|
|
46
|
+
export type ParsedWithdrawPremiumInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
47
|
+
programAddress: Address<TProgram>;
|
|
48
|
+
accounts: {
|
|
49
|
+
/** Maker owner authority */
|
|
50
|
+
makerOwner: TAccountMetas[0];
|
|
51
|
+
/** Maker PDA for signer seeds */
|
|
52
|
+
makerPda: TAccountMetas[1];
|
|
53
|
+
/** Maker custody ATA (source) */
|
|
54
|
+
makerPremiumAta: TAccountMetas[2];
|
|
55
|
+
/** Maker wallet ATA (destination) */
|
|
56
|
+
makerOwnerPremiumAta: TAccountMetas[3];
|
|
57
|
+
/** SPL token program */
|
|
58
|
+
tokenProgram: TAccountMetas[4];
|
|
59
|
+
};
|
|
60
|
+
data: WithdrawPremiumInstructionData;
|
|
61
|
+
};
|
|
62
|
+
export declare function parseWithdrawPremiumInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedWithdrawPremiumInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
import { combineCodec, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const WITHDRAW_PREMIUM_DISCRIMINATOR = 5;
|
|
12
|
+
export function getWithdrawPremiumDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(WITHDRAW_PREMIUM_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getWithdrawPremiumInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["amount", getU64Encoder()],
|
|
19
|
+
]), (value) => ({ ...value, discriminator: WITHDRAW_PREMIUM_DISCRIMINATOR }));
|
|
20
|
+
}
|
|
21
|
+
export function getWithdrawPremiumInstructionDataDecoder() {
|
|
22
|
+
return getStructDecoder([
|
|
23
|
+
["discriminator", getU8Decoder()],
|
|
24
|
+
["amount", getU64Decoder()],
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
export function getWithdrawPremiumInstructionDataCodec() {
|
|
28
|
+
return combineCodec(getWithdrawPremiumInstructionDataEncoder(), getWithdrawPremiumInstructionDataDecoder());
|
|
29
|
+
}
|
|
30
|
+
export function getWithdrawPremiumInstruction(input, config) {
|
|
31
|
+
// Program address.
|
|
32
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
33
|
+
// Original accounts.
|
|
34
|
+
const originalAccounts = {
|
|
35
|
+
makerOwner: { value: input.makerOwner ?? null, isWritable: false },
|
|
36
|
+
makerPda: { value: input.makerPda ?? null, isWritable: true },
|
|
37
|
+
makerPremiumAta: { value: input.makerPremiumAta ?? null, isWritable: true },
|
|
38
|
+
makerOwnerPremiumAta: {
|
|
39
|
+
value: input.makerOwnerPremiumAta ?? null,
|
|
40
|
+
isWritable: true,
|
|
41
|
+
},
|
|
42
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
43
|
+
};
|
|
44
|
+
const accounts = originalAccounts;
|
|
45
|
+
// Original args.
|
|
46
|
+
const args = { ...input };
|
|
47
|
+
// Resolve default values.
|
|
48
|
+
if (!accounts.tokenProgram.value) {
|
|
49
|
+
accounts.tokenProgram.value =
|
|
50
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
51
|
+
}
|
|
52
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
accounts: [
|
|
55
|
+
getAccountMeta(accounts.makerOwner),
|
|
56
|
+
getAccountMeta(accounts.makerPda),
|
|
57
|
+
getAccountMeta(accounts.makerPremiumAta),
|
|
58
|
+
getAccountMeta(accounts.makerOwnerPremiumAta),
|
|
59
|
+
getAccountMeta(accounts.tokenProgram),
|
|
60
|
+
],
|
|
61
|
+
data: getWithdrawPremiumInstructionDataEncoder().encode(args),
|
|
62
|
+
programAddress,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function parseWithdrawPremiumInstruction(instruction) {
|
|
66
|
+
if (instruction.accounts.length < 5) {
|
|
67
|
+
// TODO: Coded error.
|
|
68
|
+
throw new Error("Not enough accounts");
|
|
69
|
+
}
|
|
70
|
+
let accountIndex = 0;
|
|
71
|
+
const getNextAccount = () => {
|
|
72
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
73
|
+
accountIndex += 1;
|
|
74
|
+
return accountMeta;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
programAddress: instruction.programAddress,
|
|
78
|
+
accounts: {
|
|
79
|
+
makerOwner: getNextAccount(),
|
|
80
|
+
makerPda: getNextAccount(),
|
|
81
|
+
makerPremiumAta: getNextAccount(),
|
|
82
|
+
makerOwnerPremiumAta: getNextAccount(),
|
|
83
|
+
tokenProgram: getNextAccount(),
|
|
84
|
+
},
|
|
85
|
+
data: getWithdrawPremiumInstructionDataDecoder().decode(instruction.data),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -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
|
+
import { type Address, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
+
import { type ParsedChangeOracleSourceInstruction, type ParsedCloseMarketInstruction, type ParsedCloseOracleInstruction, type ParsedCreateMarketInstruction, type ParsedCreateOracleInstruction, type ParsedDepositFundsToPositionInstruction, type ParsedDepositPremiumInstruction, type ParsedFinalizeMarketInstruction, type ParsedInitializeConfigInstruction, type ParsedLiquidatePositionInstruction, type ParsedOpenPositionInstruction, type ParsedRegisterMakerInstruction, type ParsedSetOracleConfigInstruction, type ParsedSettlePositionInstruction, type ParsedTopupFeeFundInstruction, type ParsedUpdateConfigInstruction, type ParsedUpdateMakerQuoteSigningInstruction, type ParsedUpdateOraclePriceInstruction, type ParsedWithdrawFromFeeFundInstruction, type ParsedWithdrawPremiumInstruction } from "../instructions";
|
|
10
|
+
export declare const ACTA_CONTRACT_PROGRAM_ADDRESS: Address<"33Ezs5eoa16QyPW8wifnyz2nCyMEcq2crqkVBNjnTE8U">;
|
|
11
|
+
export declare enum ActaContractAccount {
|
|
12
|
+
Config = 0,
|
|
13
|
+
Maker = 1,
|
|
14
|
+
Market = 2,
|
|
15
|
+
Oracle = 3,
|
|
16
|
+
Position = 4
|
|
17
|
+
}
|
|
18
|
+
export declare enum ActaContractInstruction {
|
|
19
|
+
InitializeConfig = 0,
|
|
20
|
+
UpdateConfig = 1,
|
|
21
|
+
RegisterMaker = 2,
|
|
22
|
+
UpdateMakerQuoteSigning = 3,
|
|
23
|
+
DepositPremium = 4,
|
|
24
|
+
WithdrawPremium = 5,
|
|
25
|
+
CreateMarket = 6,
|
|
26
|
+
OpenPosition = 7,
|
|
27
|
+
FinalizeMarket = 8,
|
|
28
|
+
DepositFundsToPosition = 9,
|
|
29
|
+
SettlePosition = 10,
|
|
30
|
+
LiquidatePosition = 11,
|
|
31
|
+
WithdrawFromFeeFund = 12,
|
|
32
|
+
TopupFeeFund = 13,
|
|
33
|
+
CloseMarket = 14,
|
|
34
|
+
CreateOracle = 15,
|
|
35
|
+
UpdateOraclePrice = 16,
|
|
36
|
+
SetOracleConfig = 17,
|
|
37
|
+
ChangeOracleSource = 18,
|
|
38
|
+
CloseOracle = 19
|
|
39
|
+
}
|
|
40
|
+
export declare function identifyActaContractInstruction(instruction: {
|
|
41
|
+
data: ReadonlyUint8Array;
|
|
42
|
+
} | ReadonlyUint8Array): ActaContractInstruction;
|
|
43
|
+
export type ParsedActaContractInstruction<TProgram extends string = "33Ezs5eoa16QyPW8wifnyz2nCyMEcq2crqkVBNjnTE8U"> = ({
|
|
44
|
+
instructionType: ActaContractInstruction.InitializeConfig;
|
|
45
|
+
} & ParsedInitializeConfigInstruction<TProgram>) | ({
|
|
46
|
+
instructionType: ActaContractInstruction.UpdateConfig;
|
|
47
|
+
} & ParsedUpdateConfigInstruction<TProgram>) | ({
|
|
48
|
+
instructionType: ActaContractInstruction.RegisterMaker;
|
|
49
|
+
} & ParsedRegisterMakerInstruction<TProgram>) | ({
|
|
50
|
+
instructionType: ActaContractInstruction.UpdateMakerQuoteSigning;
|
|
51
|
+
} & ParsedUpdateMakerQuoteSigningInstruction<TProgram>) | ({
|
|
52
|
+
instructionType: ActaContractInstruction.DepositPremium;
|
|
53
|
+
} & ParsedDepositPremiumInstruction<TProgram>) | ({
|
|
54
|
+
instructionType: ActaContractInstruction.WithdrawPremium;
|
|
55
|
+
} & ParsedWithdrawPremiumInstruction<TProgram>) | ({
|
|
56
|
+
instructionType: ActaContractInstruction.CreateMarket;
|
|
57
|
+
} & ParsedCreateMarketInstruction<TProgram>) | ({
|
|
58
|
+
instructionType: ActaContractInstruction.OpenPosition;
|
|
59
|
+
} & ParsedOpenPositionInstruction<TProgram>) | ({
|
|
60
|
+
instructionType: ActaContractInstruction.FinalizeMarket;
|
|
61
|
+
} & ParsedFinalizeMarketInstruction<TProgram>) | ({
|
|
62
|
+
instructionType: ActaContractInstruction.DepositFundsToPosition;
|
|
63
|
+
} & ParsedDepositFundsToPositionInstruction<TProgram>) | ({
|
|
64
|
+
instructionType: ActaContractInstruction.SettlePosition;
|
|
65
|
+
} & ParsedSettlePositionInstruction<TProgram>) | ({
|
|
66
|
+
instructionType: ActaContractInstruction.LiquidatePosition;
|
|
67
|
+
} & ParsedLiquidatePositionInstruction<TProgram>) | ({
|
|
68
|
+
instructionType: ActaContractInstruction.WithdrawFromFeeFund;
|
|
69
|
+
} & ParsedWithdrawFromFeeFundInstruction<TProgram>) | ({
|
|
70
|
+
instructionType: ActaContractInstruction.TopupFeeFund;
|
|
71
|
+
} & ParsedTopupFeeFundInstruction<TProgram>) | ({
|
|
72
|
+
instructionType: ActaContractInstruction.CloseMarket;
|
|
73
|
+
} & ParsedCloseMarketInstruction<TProgram>) | ({
|
|
74
|
+
instructionType: ActaContractInstruction.CreateOracle;
|
|
75
|
+
} & ParsedCreateOracleInstruction<TProgram>) | ({
|
|
76
|
+
instructionType: ActaContractInstruction.UpdateOraclePrice;
|
|
77
|
+
} & ParsedUpdateOraclePriceInstruction<TProgram>) | ({
|
|
78
|
+
instructionType: ActaContractInstruction.SetOracleConfig;
|
|
79
|
+
} & ParsedSetOracleConfigInstruction<TProgram>) | ({
|
|
80
|
+
instructionType: ActaContractInstruction.ChangeOracleSource;
|
|
81
|
+
} & ParsedChangeOracleSourceInstruction<TProgram>) | ({
|
|
82
|
+
instructionType: ActaContractInstruction.CloseOracle;
|
|
83
|
+
} & ParsedCloseOracleInstruction<TProgram>);
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
import { containsBytes, getU8Encoder, } from "@solana/kit";
|
|
9
|
+
export const ACTA_CONTRACT_PROGRAM_ADDRESS = "33Ezs5eoa16QyPW8wifnyz2nCyMEcq2crqkVBNjnTE8U";
|
|
10
|
+
export var ActaContractAccount;
|
|
11
|
+
(function (ActaContractAccount) {
|
|
12
|
+
ActaContractAccount[ActaContractAccount["Config"] = 0] = "Config";
|
|
13
|
+
ActaContractAccount[ActaContractAccount["Maker"] = 1] = "Maker";
|
|
14
|
+
ActaContractAccount[ActaContractAccount["Market"] = 2] = "Market";
|
|
15
|
+
ActaContractAccount[ActaContractAccount["Oracle"] = 3] = "Oracle";
|
|
16
|
+
ActaContractAccount[ActaContractAccount["Position"] = 4] = "Position";
|
|
17
|
+
})(ActaContractAccount || (ActaContractAccount = {}));
|
|
18
|
+
export var ActaContractInstruction;
|
|
19
|
+
(function (ActaContractInstruction) {
|
|
20
|
+
ActaContractInstruction[ActaContractInstruction["InitializeConfig"] = 0] = "InitializeConfig";
|
|
21
|
+
ActaContractInstruction[ActaContractInstruction["UpdateConfig"] = 1] = "UpdateConfig";
|
|
22
|
+
ActaContractInstruction[ActaContractInstruction["RegisterMaker"] = 2] = "RegisterMaker";
|
|
23
|
+
ActaContractInstruction[ActaContractInstruction["UpdateMakerQuoteSigning"] = 3] = "UpdateMakerQuoteSigning";
|
|
24
|
+
ActaContractInstruction[ActaContractInstruction["DepositPremium"] = 4] = "DepositPremium";
|
|
25
|
+
ActaContractInstruction[ActaContractInstruction["WithdrawPremium"] = 5] = "WithdrawPremium";
|
|
26
|
+
ActaContractInstruction[ActaContractInstruction["CreateMarket"] = 6] = "CreateMarket";
|
|
27
|
+
ActaContractInstruction[ActaContractInstruction["OpenPosition"] = 7] = "OpenPosition";
|
|
28
|
+
ActaContractInstruction[ActaContractInstruction["FinalizeMarket"] = 8] = "FinalizeMarket";
|
|
29
|
+
ActaContractInstruction[ActaContractInstruction["DepositFundsToPosition"] = 9] = "DepositFundsToPosition";
|
|
30
|
+
ActaContractInstruction[ActaContractInstruction["SettlePosition"] = 10] = "SettlePosition";
|
|
31
|
+
ActaContractInstruction[ActaContractInstruction["LiquidatePosition"] = 11] = "LiquidatePosition";
|
|
32
|
+
ActaContractInstruction[ActaContractInstruction["WithdrawFromFeeFund"] = 12] = "WithdrawFromFeeFund";
|
|
33
|
+
ActaContractInstruction[ActaContractInstruction["TopupFeeFund"] = 13] = "TopupFeeFund";
|
|
34
|
+
ActaContractInstruction[ActaContractInstruction["CloseMarket"] = 14] = "CloseMarket";
|
|
35
|
+
ActaContractInstruction[ActaContractInstruction["CreateOracle"] = 15] = "CreateOracle";
|
|
36
|
+
ActaContractInstruction[ActaContractInstruction["UpdateOraclePrice"] = 16] = "UpdateOraclePrice";
|
|
37
|
+
ActaContractInstruction[ActaContractInstruction["SetOracleConfig"] = 17] = "SetOracleConfig";
|
|
38
|
+
ActaContractInstruction[ActaContractInstruction["ChangeOracleSource"] = 18] = "ChangeOracleSource";
|
|
39
|
+
ActaContractInstruction[ActaContractInstruction["CloseOracle"] = 19] = "CloseOracle";
|
|
40
|
+
})(ActaContractInstruction || (ActaContractInstruction = {}));
|
|
41
|
+
export function identifyActaContractInstruction(instruction) {
|
|
42
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
43
|
+
if (containsBytes(data, getU8Encoder().encode(0), 0)) {
|
|
44
|
+
return ActaContractInstruction.InitializeConfig;
|
|
45
|
+
}
|
|
46
|
+
if (containsBytes(data, getU8Encoder().encode(1), 0)) {
|
|
47
|
+
return ActaContractInstruction.UpdateConfig;
|
|
48
|
+
}
|
|
49
|
+
if (containsBytes(data, getU8Encoder().encode(2), 0)) {
|
|
50
|
+
return ActaContractInstruction.RegisterMaker;
|
|
51
|
+
}
|
|
52
|
+
if (containsBytes(data, getU8Encoder().encode(3), 0)) {
|
|
53
|
+
return ActaContractInstruction.UpdateMakerQuoteSigning;
|
|
54
|
+
}
|
|
55
|
+
if (containsBytes(data, getU8Encoder().encode(4), 0)) {
|
|
56
|
+
return ActaContractInstruction.DepositPremium;
|
|
57
|
+
}
|
|
58
|
+
if (containsBytes(data, getU8Encoder().encode(5), 0)) {
|
|
59
|
+
return ActaContractInstruction.WithdrawPremium;
|
|
60
|
+
}
|
|
61
|
+
if (containsBytes(data, getU8Encoder().encode(6), 0)) {
|
|
62
|
+
return ActaContractInstruction.CreateMarket;
|
|
63
|
+
}
|
|
64
|
+
if (containsBytes(data, getU8Encoder().encode(7), 0)) {
|
|
65
|
+
return ActaContractInstruction.OpenPosition;
|
|
66
|
+
}
|
|
67
|
+
if (containsBytes(data, getU8Encoder().encode(8), 0)) {
|
|
68
|
+
return ActaContractInstruction.FinalizeMarket;
|
|
69
|
+
}
|
|
70
|
+
if (containsBytes(data, getU8Encoder().encode(9), 0)) {
|
|
71
|
+
return ActaContractInstruction.DepositFundsToPosition;
|
|
72
|
+
}
|
|
73
|
+
if (containsBytes(data, getU8Encoder().encode(10), 0)) {
|
|
74
|
+
return ActaContractInstruction.SettlePosition;
|
|
75
|
+
}
|
|
76
|
+
if (containsBytes(data, getU8Encoder().encode(11), 0)) {
|
|
77
|
+
return ActaContractInstruction.LiquidatePosition;
|
|
78
|
+
}
|
|
79
|
+
if (containsBytes(data, getU8Encoder().encode(12), 0)) {
|
|
80
|
+
return ActaContractInstruction.WithdrawFromFeeFund;
|
|
81
|
+
}
|
|
82
|
+
if (containsBytes(data, getU8Encoder().encode(13), 0)) {
|
|
83
|
+
return ActaContractInstruction.TopupFeeFund;
|
|
84
|
+
}
|
|
85
|
+
if (containsBytes(data, getU8Encoder().encode(14), 0)) {
|
|
86
|
+
return ActaContractInstruction.CloseMarket;
|
|
87
|
+
}
|
|
88
|
+
if (containsBytes(data, getU8Encoder().encode(15), 0)) {
|
|
89
|
+
return ActaContractInstruction.CreateOracle;
|
|
90
|
+
}
|
|
91
|
+
if (containsBytes(data, getU8Encoder().encode(16), 0)) {
|
|
92
|
+
return ActaContractInstruction.UpdateOraclePrice;
|
|
93
|
+
}
|
|
94
|
+
if (containsBytes(data, getU8Encoder().encode(17), 0)) {
|
|
95
|
+
return ActaContractInstruction.SetOracleConfig;
|
|
96
|
+
}
|
|
97
|
+
if (containsBytes(data, getU8Encoder().encode(18), 0)) {
|
|
98
|
+
return ActaContractInstruction.ChangeOracleSource;
|
|
99
|
+
}
|
|
100
|
+
if (containsBytes(data, getU8Encoder().encode(19), 0)) {
|
|
101
|
+
return ActaContractInstruction.CloseOracle;
|
|
102
|
+
}
|
|
103
|
+
throw new Error("The provided instruction could not be identified as a actaContract instruction.");
|
|
104
|
+
}
|