@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,95 @@
|
|
|
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, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const SETTLE_POSITION_DISCRIMINATOR = 10;
|
|
12
|
+
export function getSettlePositionDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(SETTLE_POSITION_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getSettlePositionInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([["discriminator", getU8Encoder()]]), (value) => ({ ...value, discriminator: SETTLE_POSITION_DISCRIMINATOR }));
|
|
17
|
+
}
|
|
18
|
+
export function getSettlePositionInstructionDataDecoder() {
|
|
19
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
20
|
+
}
|
|
21
|
+
export function getSettlePositionInstructionDataCodec() {
|
|
22
|
+
return combineCodec(getSettlePositionInstructionDataEncoder(), getSettlePositionInstructionDataDecoder());
|
|
23
|
+
}
|
|
24
|
+
export function getSettlePositionInstruction(input, config) {
|
|
25
|
+
// Program address.
|
|
26
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
27
|
+
// Original accounts.
|
|
28
|
+
const originalAccounts = {
|
|
29
|
+
settler: { value: input.settler ?? null, isWritable: true },
|
|
30
|
+
positionPda: { value: input.positionPda ?? null, isWritable: true },
|
|
31
|
+
marketPda: { value: input.marketPda ?? null, isWritable: true },
|
|
32
|
+
posCollateralAta: {
|
|
33
|
+
value: input.posCollateralAta ?? null,
|
|
34
|
+
isWritable: true,
|
|
35
|
+
},
|
|
36
|
+
posSettlementAta: {
|
|
37
|
+
value: input.posSettlementAta ?? null,
|
|
38
|
+
isWritable: true,
|
|
39
|
+
},
|
|
40
|
+
userDestAta: { value: input.userDestAta ?? null, isWritable: true },
|
|
41
|
+
makerDestAta: { value: input.makerDestAta ?? null, isWritable: true },
|
|
42
|
+
underlyingTokenProgram: {
|
|
43
|
+
value: input.underlyingTokenProgram ?? null,
|
|
44
|
+
isWritable: false,
|
|
45
|
+
},
|
|
46
|
+
quoteTokenProgram: {
|
|
47
|
+
value: input.quoteTokenProgram ?? null,
|
|
48
|
+
isWritable: false,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
const accounts = originalAccounts;
|
|
52
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
accounts: [
|
|
55
|
+
getAccountMeta(accounts.settler),
|
|
56
|
+
getAccountMeta(accounts.positionPda),
|
|
57
|
+
getAccountMeta(accounts.marketPda),
|
|
58
|
+
getAccountMeta(accounts.posCollateralAta),
|
|
59
|
+
getAccountMeta(accounts.posSettlementAta),
|
|
60
|
+
getAccountMeta(accounts.userDestAta),
|
|
61
|
+
getAccountMeta(accounts.makerDestAta),
|
|
62
|
+
getAccountMeta(accounts.underlyingTokenProgram),
|
|
63
|
+
getAccountMeta(accounts.quoteTokenProgram),
|
|
64
|
+
],
|
|
65
|
+
data: getSettlePositionInstructionDataEncoder().encode({}),
|
|
66
|
+
programAddress,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export function parseSettlePositionInstruction(instruction) {
|
|
70
|
+
if (instruction.accounts.length < 9) {
|
|
71
|
+
// TODO: Coded error.
|
|
72
|
+
throw new Error("Not enough accounts");
|
|
73
|
+
}
|
|
74
|
+
let accountIndex = 0;
|
|
75
|
+
const getNextAccount = () => {
|
|
76
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
77
|
+
accountIndex += 1;
|
|
78
|
+
return accountMeta;
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
programAddress: instruction.programAddress,
|
|
82
|
+
accounts: {
|
|
83
|
+
settler: getNextAccount(),
|
|
84
|
+
positionPda: getNextAccount(),
|
|
85
|
+
marketPda: getNextAccount(),
|
|
86
|
+
posCollateralAta: getNextAccount(),
|
|
87
|
+
posSettlementAta: getNextAccount(),
|
|
88
|
+
userDestAta: getNextAccount(),
|
|
89
|
+
makerDestAta: getNextAccount(),
|
|
90
|
+
underlyingTokenProgram: getNextAccount(),
|
|
91
|
+
quoteTokenProgram: getNextAccount(),
|
|
92
|
+
},
|
|
93
|
+
data: getSettlePositionInstructionDataDecoder().decode(instruction.data),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
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 TOPUP_FEE_FUND_DISCRIMINATOR = 13;
|
|
11
|
+
export declare function getTopupFeeFundDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type TopupFeeFundInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountConfigPda extends string | AccountMeta<string> = string, TAccountSourceAta extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountProtocolFeeAta 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
|
+
TAccountSourceAta extends string ? WritableAccount<TAccountSourceAta> : TAccountSourceAta,
|
|
16
|
+
TAccountMint extends string ? ReadonlyAccount<TAccountMint> : TAccountMint,
|
|
17
|
+
TAccountProtocolFeeAta extends string ? WritableAccount<TAccountProtocolFeeAta> : TAccountProtocolFeeAta,
|
|
18
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
19
|
+
...TRemainingAccounts
|
|
20
|
+
]>;
|
|
21
|
+
export type TopupFeeFundInstructionData = {
|
|
22
|
+
discriminator: number;
|
|
23
|
+
amount: bigint;
|
|
24
|
+
};
|
|
25
|
+
export type TopupFeeFundInstructionDataArgs = {
|
|
26
|
+
amount: number | bigint;
|
|
27
|
+
};
|
|
28
|
+
export declare function getTopupFeeFundInstructionDataEncoder(): FixedSizeEncoder<TopupFeeFundInstructionDataArgs>;
|
|
29
|
+
export declare function getTopupFeeFundInstructionDataDecoder(): FixedSizeDecoder<TopupFeeFundInstructionData>;
|
|
30
|
+
export declare function getTopupFeeFundInstructionDataCodec(): FixedSizeCodec<TopupFeeFundInstructionDataArgs, TopupFeeFundInstructionData>;
|
|
31
|
+
export type TopupFeeFundInput<TAccountAdmin extends string = string, TAccountConfigPda extends string = string, TAccountSourceAta extends string = string, TAccountMint extends string = string, TAccountProtocolFeeAta extends string = string, TAccountTokenProgram extends string = string> = {
|
|
32
|
+
/** Protocol admin authority */
|
|
33
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
34
|
+
/** Config PDA for admin verification */
|
|
35
|
+
configPda: Address<TAccountConfigPda>;
|
|
36
|
+
/** Source ATA supplying fees */
|
|
37
|
+
sourceAta: Address<TAccountSourceAta>;
|
|
38
|
+
/** Mint for source ATA */
|
|
39
|
+
mint: Address<TAccountMint>;
|
|
40
|
+
/** Protocol fee custody ATA */
|
|
41
|
+
protocolFeeAta: Address<TAccountProtocolFeeAta>;
|
|
42
|
+
/** SPL token program */
|
|
43
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
44
|
+
amount: TopupFeeFundInstructionDataArgs["amount"];
|
|
45
|
+
};
|
|
46
|
+
export declare function getTopupFeeFundInstruction<TAccountAdmin extends string, TAccountConfigPda extends string, TAccountSourceAta extends string, TAccountMint extends string, TAccountProtocolFeeAta extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: TopupFeeFundInput<TAccountAdmin, TAccountConfigPda, TAccountSourceAta, TAccountMint, TAccountProtocolFeeAta, TAccountTokenProgram>, config?: {
|
|
47
|
+
programAddress?: TProgramAddress;
|
|
48
|
+
}): TopupFeeFundInstruction<TProgramAddress, TAccountAdmin, TAccountConfigPda, TAccountSourceAta, TAccountMint, TAccountProtocolFeeAta, TAccountTokenProgram>;
|
|
49
|
+
export type ParsedTopupFeeFundInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
50
|
+
programAddress: Address<TProgram>;
|
|
51
|
+
accounts: {
|
|
52
|
+
/** Protocol admin authority */
|
|
53
|
+
admin: TAccountMetas[0];
|
|
54
|
+
/** Config PDA for admin verification */
|
|
55
|
+
configPda: TAccountMetas[1];
|
|
56
|
+
/** Source ATA supplying fees */
|
|
57
|
+
sourceAta: TAccountMetas[2];
|
|
58
|
+
/** Mint for source ATA */
|
|
59
|
+
mint: TAccountMetas[3];
|
|
60
|
+
/** Protocol fee custody ATA */
|
|
61
|
+
protocolFeeAta: TAccountMetas[4];
|
|
62
|
+
/** SPL token program */
|
|
63
|
+
tokenProgram: TAccountMetas[5];
|
|
64
|
+
};
|
|
65
|
+
data: TopupFeeFundInstructionData;
|
|
66
|
+
};
|
|
67
|
+
export declare function parseTopupFeeFundInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedTopupFeeFundInstruction<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 TOPUP_FEE_FUND_DISCRIMINATOR = 13;
|
|
12
|
+
export function getTopupFeeFundDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(TOPUP_FEE_FUND_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getTopupFeeFundInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["amount", getU64Encoder()],
|
|
19
|
+
]), (value) => ({ ...value, discriminator: TOPUP_FEE_FUND_DISCRIMINATOR }));
|
|
20
|
+
}
|
|
21
|
+
export function getTopupFeeFundInstructionDataDecoder() {
|
|
22
|
+
return getStructDecoder([
|
|
23
|
+
["discriminator", getU8Decoder()],
|
|
24
|
+
["amount", getU64Decoder()],
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
export function getTopupFeeFundInstructionDataCodec() {
|
|
28
|
+
return combineCodec(getTopupFeeFundInstructionDataEncoder(), getTopupFeeFundInstructionDataDecoder());
|
|
29
|
+
}
|
|
30
|
+
export function getTopupFeeFundInstruction(input, config) {
|
|
31
|
+
// Program address.
|
|
32
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
33
|
+
// Original accounts.
|
|
34
|
+
const originalAccounts = {
|
|
35
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
36
|
+
configPda: { value: input.configPda ?? null, isWritable: false },
|
|
37
|
+
sourceAta: { value: input.sourceAta ?? null, isWritable: true },
|
|
38
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
39
|
+
protocolFeeAta: { value: input.protocolFeeAta ?? null, isWritable: true },
|
|
40
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
41
|
+
};
|
|
42
|
+
const accounts = originalAccounts;
|
|
43
|
+
// Original args.
|
|
44
|
+
const args = { ...input };
|
|
45
|
+
// Resolve default values.
|
|
46
|
+
if (!accounts.tokenProgram.value) {
|
|
47
|
+
accounts.tokenProgram.value =
|
|
48
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
49
|
+
}
|
|
50
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
accounts: [
|
|
53
|
+
getAccountMeta(accounts.admin),
|
|
54
|
+
getAccountMeta(accounts.configPda),
|
|
55
|
+
getAccountMeta(accounts.sourceAta),
|
|
56
|
+
getAccountMeta(accounts.mint),
|
|
57
|
+
getAccountMeta(accounts.protocolFeeAta),
|
|
58
|
+
getAccountMeta(accounts.tokenProgram),
|
|
59
|
+
],
|
|
60
|
+
data: getTopupFeeFundInstructionDataEncoder().encode(args),
|
|
61
|
+
programAddress,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export function parseTopupFeeFundInstruction(instruction) {
|
|
65
|
+
if (instruction.accounts.length < 6) {
|
|
66
|
+
// TODO: Coded error.
|
|
67
|
+
throw new Error("Not enough accounts");
|
|
68
|
+
}
|
|
69
|
+
let accountIndex = 0;
|
|
70
|
+
const getNextAccount = () => {
|
|
71
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
72
|
+
accountIndex += 1;
|
|
73
|
+
return accountMeta;
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
programAddress: instruction.programAddress,
|
|
77
|
+
accounts: {
|
|
78
|
+
admin: getNextAccount(),
|
|
79
|
+
configPda: getNextAccount(),
|
|
80
|
+
sourceAta: getNextAccount(),
|
|
81
|
+
mint: getNextAccount(),
|
|
82
|
+
protocolFeeAta: getNextAccount(),
|
|
83
|
+
tokenProgram: getNextAccount(),
|
|
84
|
+
},
|
|
85
|
+
data: getTopupFeeFundInstructionDataDecoder().decode(instruction.data),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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_CONFIG_DISCRIMINATOR = 1;
|
|
11
|
+
export declare function getUpdateConfigDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type UpdateConfigInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountConfigPda extends string | AccountMeta<string> = string, TAccountPremiumMint extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountAdmin extends string ? ReadonlySignerAccount<TAccountAdmin> & AccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
14
|
+
TAccountConfigPda extends string ? WritableAccount<TAccountConfigPda> : TAccountConfigPda,
|
|
15
|
+
TAccountPremiumMint extends string ? ReadonlyAccount<TAccountPremiumMint> : TAccountPremiumMint,
|
|
16
|
+
...TRemainingAccounts
|
|
17
|
+
]>;
|
|
18
|
+
export type UpdateConfigInstructionData = {
|
|
19
|
+
discriminator: number;
|
|
20
|
+
mask: number;
|
|
21
|
+
protocolFeeBpsPremium: number;
|
|
22
|
+
protocolFeeBpsVolume: number;
|
|
23
|
+
};
|
|
24
|
+
export type UpdateConfigInstructionDataArgs = {
|
|
25
|
+
mask: number;
|
|
26
|
+
protocolFeeBpsPremium: number;
|
|
27
|
+
protocolFeeBpsVolume: number;
|
|
28
|
+
};
|
|
29
|
+
export declare function getUpdateConfigInstructionDataEncoder(): FixedSizeEncoder<UpdateConfigInstructionDataArgs>;
|
|
30
|
+
export declare function getUpdateConfigInstructionDataDecoder(): FixedSizeDecoder<UpdateConfigInstructionData>;
|
|
31
|
+
export declare function getUpdateConfigInstructionDataCodec(): FixedSizeCodec<UpdateConfigInstructionDataArgs, UpdateConfigInstructionData>;
|
|
32
|
+
export type UpdateConfigInput<TAccountAdmin extends string = string, TAccountConfigPda extends string = string, TAccountPremiumMint extends string = string> = {
|
|
33
|
+
/** Protocol admin authority */
|
|
34
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
35
|
+
/** Config PDA to update */
|
|
36
|
+
configPda: Address<TAccountConfigPda>;
|
|
37
|
+
/** Premium SPL mint */
|
|
38
|
+
premiumMint: Address<TAccountPremiumMint>;
|
|
39
|
+
mask: UpdateConfigInstructionDataArgs["mask"];
|
|
40
|
+
protocolFeeBpsPremium: UpdateConfigInstructionDataArgs["protocolFeeBpsPremium"];
|
|
41
|
+
protocolFeeBpsVolume: UpdateConfigInstructionDataArgs["protocolFeeBpsVolume"];
|
|
42
|
+
};
|
|
43
|
+
export declare function getUpdateConfigInstruction<TAccountAdmin extends string, TAccountConfigPda extends string, TAccountPremiumMint extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: UpdateConfigInput<TAccountAdmin, TAccountConfigPda, TAccountPremiumMint>, config?: {
|
|
44
|
+
programAddress?: TProgramAddress;
|
|
45
|
+
}): UpdateConfigInstruction<TProgramAddress, TAccountAdmin, TAccountConfigPda, TAccountPremiumMint>;
|
|
46
|
+
export type ParsedUpdateConfigInstruction<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 to update */
|
|
52
|
+
configPda: TAccountMetas[1];
|
|
53
|
+
/** Premium SPL mint */
|
|
54
|
+
premiumMint: TAccountMetas[2];
|
|
55
|
+
};
|
|
56
|
+
data: UpdateConfigInstructionData;
|
|
57
|
+
};
|
|
58
|
+
export declare function parseUpdateConfigInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateConfigInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { combineCodec, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const UPDATE_CONFIG_DISCRIMINATOR = 1;
|
|
12
|
+
export function getUpdateConfigDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(UPDATE_CONFIG_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getUpdateConfigInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["mask", getU8Encoder()],
|
|
19
|
+
["protocolFeeBpsPremium", getU16Encoder()],
|
|
20
|
+
["protocolFeeBpsVolume", getU16Encoder()],
|
|
21
|
+
]), (value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR }));
|
|
22
|
+
}
|
|
23
|
+
export function getUpdateConfigInstructionDataDecoder() {
|
|
24
|
+
return getStructDecoder([
|
|
25
|
+
["discriminator", getU8Decoder()],
|
|
26
|
+
["mask", getU8Decoder()],
|
|
27
|
+
["protocolFeeBpsPremium", getU16Decoder()],
|
|
28
|
+
["protocolFeeBpsVolume", getU16Decoder()],
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
export function getUpdateConfigInstructionDataCodec() {
|
|
32
|
+
return combineCodec(getUpdateConfigInstructionDataEncoder(), getUpdateConfigInstructionDataDecoder());
|
|
33
|
+
}
|
|
34
|
+
export function getUpdateConfigInstruction(input, config) {
|
|
35
|
+
// Program address.
|
|
36
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
37
|
+
// Original accounts.
|
|
38
|
+
const originalAccounts = {
|
|
39
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
40
|
+
configPda: { value: input.configPda ?? null, isWritable: true },
|
|
41
|
+
premiumMint: { value: input.premiumMint ?? null, isWritable: false },
|
|
42
|
+
};
|
|
43
|
+
const accounts = originalAccounts;
|
|
44
|
+
// Original args.
|
|
45
|
+
const args = { ...input };
|
|
46
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
47
|
+
return Object.freeze({
|
|
48
|
+
accounts: [
|
|
49
|
+
getAccountMeta(accounts.admin),
|
|
50
|
+
getAccountMeta(accounts.configPda),
|
|
51
|
+
getAccountMeta(accounts.premiumMint),
|
|
52
|
+
],
|
|
53
|
+
data: getUpdateConfigInstructionDataEncoder().encode(args),
|
|
54
|
+
programAddress,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function parseUpdateConfigInstruction(instruction) {
|
|
58
|
+
if (instruction.accounts.length < 3) {
|
|
59
|
+
// TODO: Coded error.
|
|
60
|
+
throw new Error("Not enough accounts");
|
|
61
|
+
}
|
|
62
|
+
let accountIndex = 0;
|
|
63
|
+
const getNextAccount = () => {
|
|
64
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
65
|
+
accountIndex += 1;
|
|
66
|
+
return accountMeta;
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
programAddress: instruction.programAddress,
|
|
70
|
+
accounts: {
|
|
71
|
+
admin: getNextAccount(),
|
|
72
|
+
configPda: getNextAccount(),
|
|
73
|
+
premiumMint: getNextAccount(),
|
|
74
|
+
},
|
|
75
|
+
data: getUpdateConfigInstructionDataDecoder().decode(instruction.data),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
export declare const UPDATE_MAKER_QUOTE_SIGNING_DISCRIMINATOR = 3;
|
|
11
|
+
export declare function getUpdateMakerQuoteSigningDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type UpdateMakerQuoteSigningInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMakerOwner extends string | AccountMeta<string> = string, TAccountMakerPda extends string | AccountMeta<string> = string, 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
|
+
...TRemainingAccounts
|
|
16
|
+
]>;
|
|
17
|
+
export type UpdateMakerQuoteSigningInstructionData = {
|
|
18
|
+
discriminator: number;
|
|
19
|
+
newQuoteSigning: Address;
|
|
20
|
+
};
|
|
21
|
+
export type UpdateMakerQuoteSigningInstructionDataArgs = {
|
|
22
|
+
newQuoteSigning: Address;
|
|
23
|
+
};
|
|
24
|
+
export declare function getUpdateMakerQuoteSigningInstructionDataEncoder(): FixedSizeEncoder<UpdateMakerQuoteSigningInstructionDataArgs>;
|
|
25
|
+
export declare function getUpdateMakerQuoteSigningInstructionDataDecoder(): FixedSizeDecoder<UpdateMakerQuoteSigningInstructionData>;
|
|
26
|
+
export declare function getUpdateMakerQuoteSigningInstructionDataCodec(): FixedSizeCodec<UpdateMakerQuoteSigningInstructionDataArgs, UpdateMakerQuoteSigningInstructionData>;
|
|
27
|
+
export type UpdateMakerQuoteSigningInput<TAccountMakerOwner extends string = string, TAccountMakerPda extends string = string> = {
|
|
28
|
+
/** Maker owner authority */
|
|
29
|
+
makerOwner: TransactionSigner<TAccountMakerOwner>;
|
|
30
|
+
/** Maker PDA being updated */
|
|
31
|
+
makerPda: Address<TAccountMakerPda>;
|
|
32
|
+
newQuoteSigning: UpdateMakerQuoteSigningInstructionDataArgs["newQuoteSigning"];
|
|
33
|
+
};
|
|
34
|
+
export declare function getUpdateMakerQuoteSigningInstruction<TAccountMakerOwner extends string, TAccountMakerPda extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: UpdateMakerQuoteSigningInput<TAccountMakerOwner, TAccountMakerPda>, config?: {
|
|
35
|
+
programAddress?: TProgramAddress;
|
|
36
|
+
}): UpdateMakerQuoteSigningInstruction<TProgramAddress, TAccountMakerOwner, TAccountMakerPda>;
|
|
37
|
+
export type ParsedUpdateMakerQuoteSigningInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
38
|
+
programAddress: Address<TProgram>;
|
|
39
|
+
accounts: {
|
|
40
|
+
/** Maker owner authority */
|
|
41
|
+
makerOwner: TAccountMetas[0];
|
|
42
|
+
/** Maker PDA being updated */
|
|
43
|
+
makerPda: TAccountMetas[1];
|
|
44
|
+
};
|
|
45
|
+
data: UpdateMakerQuoteSigningInstructionData;
|
|
46
|
+
};
|
|
47
|
+
export declare function parseUpdateMakerQuoteSigningInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateMakerQuoteSigningInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,70 @@
|
|
|
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, getAddressDecoder, getAddressEncoder, getStructDecoder, getStructEncoder, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const UPDATE_MAKER_QUOTE_SIGNING_DISCRIMINATOR = 3;
|
|
12
|
+
export function getUpdateMakerQuoteSigningDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(UPDATE_MAKER_QUOTE_SIGNING_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getUpdateMakerQuoteSigningInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["newQuoteSigning", getAddressEncoder()],
|
|
19
|
+
]), (value) => ({
|
|
20
|
+
...value,
|
|
21
|
+
discriminator: UPDATE_MAKER_QUOTE_SIGNING_DISCRIMINATOR,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
export function getUpdateMakerQuoteSigningInstructionDataDecoder() {
|
|
25
|
+
return getStructDecoder([
|
|
26
|
+
["discriminator", getU8Decoder()],
|
|
27
|
+
["newQuoteSigning", getAddressDecoder()],
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
export function getUpdateMakerQuoteSigningInstructionDataCodec() {
|
|
31
|
+
return combineCodec(getUpdateMakerQuoteSigningInstructionDataEncoder(), getUpdateMakerQuoteSigningInstructionDataDecoder());
|
|
32
|
+
}
|
|
33
|
+
export function getUpdateMakerQuoteSigningInstruction(input, config) {
|
|
34
|
+
// Program address.
|
|
35
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
36
|
+
// Original accounts.
|
|
37
|
+
const originalAccounts = {
|
|
38
|
+
makerOwner: { value: input.makerOwner ?? null, isWritable: false },
|
|
39
|
+
makerPda: { value: input.makerPda ?? null, isWritable: true },
|
|
40
|
+
};
|
|
41
|
+
const accounts = originalAccounts;
|
|
42
|
+
// Original args.
|
|
43
|
+
const args = { ...input };
|
|
44
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
accounts: [
|
|
47
|
+
getAccountMeta(accounts.makerOwner),
|
|
48
|
+
getAccountMeta(accounts.makerPda),
|
|
49
|
+
],
|
|
50
|
+
data: getUpdateMakerQuoteSigningInstructionDataEncoder().encode(args),
|
|
51
|
+
programAddress,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export function parseUpdateMakerQuoteSigningInstruction(instruction) {
|
|
55
|
+
if (instruction.accounts.length < 2) {
|
|
56
|
+
// TODO: Coded error.
|
|
57
|
+
throw new Error("Not enough accounts");
|
|
58
|
+
}
|
|
59
|
+
let accountIndex = 0;
|
|
60
|
+
const getNextAccount = () => {
|
|
61
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
62
|
+
accountIndex += 1;
|
|
63
|
+
return accountMeta;
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
programAddress: instruction.programAddress,
|
|
67
|
+
accounts: { makerOwner: getNextAccount(), makerPda: getNextAccount() },
|
|
68
|
+
data: getUpdateMakerQuoteSigningInstructionDataDecoder().decode(instruction.data),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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_MARKET_ORACLES_DISCRIMINATOR = 18;
|
|
11
|
+
export declare function getUpdateMarketOraclesDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type UpdateMarketOraclesInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountConfigPda extends string | AccountMeta<string> = string, TAccountMarketPda extends string | AccountMeta<string> = string, TAccountOracleUnderlying extends string | AccountMeta<string> = string, TAccountOracleQuote extends string | AccountMeta<string> = string, 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
|
+
TAccountMarketPda extends string ? WritableAccount<TAccountMarketPda> : TAccountMarketPda,
|
|
16
|
+
TAccountOracleUnderlying extends string ? ReadonlyAccount<TAccountOracleUnderlying> : TAccountOracleUnderlying,
|
|
17
|
+
TAccountOracleQuote extends string ? ReadonlyAccount<TAccountOracleQuote> : TAccountOracleQuote,
|
|
18
|
+
...TRemainingAccounts
|
|
19
|
+
]>;
|
|
20
|
+
export type UpdateMarketOraclesInstructionData = {
|
|
21
|
+
discriminator: number;
|
|
22
|
+
underlyingOracleType: number;
|
|
23
|
+
quoteOracleType: number;
|
|
24
|
+
};
|
|
25
|
+
export type UpdateMarketOraclesInstructionDataArgs = {
|
|
26
|
+
underlyingOracleType: number;
|
|
27
|
+
quoteOracleType: number;
|
|
28
|
+
};
|
|
29
|
+
export declare function getUpdateMarketOraclesInstructionDataEncoder(): FixedSizeEncoder<UpdateMarketOraclesInstructionDataArgs>;
|
|
30
|
+
export declare function getUpdateMarketOraclesInstructionDataDecoder(): FixedSizeDecoder<UpdateMarketOraclesInstructionData>;
|
|
31
|
+
export declare function getUpdateMarketOraclesInstructionDataCodec(): FixedSizeCodec<UpdateMarketOraclesInstructionDataArgs, UpdateMarketOraclesInstructionData>;
|
|
32
|
+
export type UpdateMarketOraclesInput<TAccountAdmin extends string = string, TAccountConfigPda extends string = string, TAccountMarketPda extends string = string, TAccountOracleUnderlying extends string = string, TAccountOracleQuote extends string = string> = {
|
|
33
|
+
/** Protocol admin authority */
|
|
34
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
35
|
+
/** Config PDA for admin verification */
|
|
36
|
+
configPda: Address<TAccountConfigPda>;
|
|
37
|
+
/** Market PDA to update */
|
|
38
|
+
marketPda: Address<TAccountMarketPda>;
|
|
39
|
+
/** Underlying oracle PDA */
|
|
40
|
+
oracleUnderlying: Address<TAccountOracleUnderlying>;
|
|
41
|
+
/** Quote oracle PDA */
|
|
42
|
+
oracleQuote: Address<TAccountOracleQuote>;
|
|
43
|
+
underlyingOracleType: UpdateMarketOraclesInstructionDataArgs["underlyingOracleType"];
|
|
44
|
+
quoteOracleType: UpdateMarketOraclesInstructionDataArgs["quoteOracleType"];
|
|
45
|
+
};
|
|
46
|
+
export declare function getUpdateMarketOraclesInstruction<TAccountAdmin extends string, TAccountConfigPda extends string, TAccountMarketPda extends string, TAccountOracleUnderlying extends string, TAccountOracleQuote extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: UpdateMarketOraclesInput<TAccountAdmin, TAccountConfigPda, TAccountMarketPda, TAccountOracleUnderlying, TAccountOracleQuote>, config?: {
|
|
47
|
+
programAddress?: TProgramAddress;
|
|
48
|
+
}): UpdateMarketOraclesInstruction<TProgramAddress, TAccountAdmin, TAccountConfigPda, TAccountMarketPda, TAccountOracleUnderlying, TAccountOracleQuote>;
|
|
49
|
+
export type ParsedUpdateMarketOraclesInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
50
|
+
programAddress: Address<TProgram>;
|
|
51
|
+
accounts: {
|
|
52
|
+
/** Protocol admin authority */
|
|
53
|
+
admin: TAccountMetas[0];
|
|
54
|
+
/** Config PDA for admin verification */
|
|
55
|
+
configPda: TAccountMetas[1];
|
|
56
|
+
/** Market PDA to update */
|
|
57
|
+
marketPda: TAccountMetas[2];
|
|
58
|
+
/** Underlying oracle PDA */
|
|
59
|
+
oracleUnderlying: TAccountMetas[3];
|
|
60
|
+
/** Quote oracle PDA */
|
|
61
|
+
oracleQuote: TAccountMetas[4];
|
|
62
|
+
};
|
|
63
|
+
data: UpdateMarketOraclesInstructionData;
|
|
64
|
+
};
|
|
65
|
+
export declare function parseUpdateMarketOraclesInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateMarketOraclesInstruction<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, getU8Decoder, getU8Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { getAccountMetaFactory } from "../shared";
|
|
11
|
+
export const UPDATE_MARKET_ORACLES_DISCRIMINATOR = 18;
|
|
12
|
+
export function getUpdateMarketOraclesDiscriminatorBytes() {
|
|
13
|
+
return getU8Encoder().encode(UPDATE_MARKET_ORACLES_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getUpdateMarketOraclesInstructionDataEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
["discriminator", getU8Encoder()],
|
|
18
|
+
["underlyingOracleType", getU8Encoder()],
|
|
19
|
+
["quoteOracleType", getU8Encoder()],
|
|
20
|
+
]), (value) => ({
|
|
21
|
+
...value,
|
|
22
|
+
discriminator: UPDATE_MARKET_ORACLES_DISCRIMINATOR,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
export function getUpdateMarketOraclesInstructionDataDecoder() {
|
|
26
|
+
return getStructDecoder([
|
|
27
|
+
["discriminator", getU8Decoder()],
|
|
28
|
+
["underlyingOracleType", getU8Decoder()],
|
|
29
|
+
["quoteOracleType", getU8Decoder()],
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
export function getUpdateMarketOraclesInstructionDataCodec() {
|
|
33
|
+
return combineCodec(getUpdateMarketOraclesInstructionDataEncoder(), getUpdateMarketOraclesInstructionDataDecoder());
|
|
34
|
+
}
|
|
35
|
+
export function getUpdateMarketOraclesInstruction(input, config) {
|
|
36
|
+
// Program address.
|
|
37
|
+
const programAddress = config?.programAddress ?? ACTA_CONTRACT_PROGRAM_ADDRESS;
|
|
38
|
+
// Original accounts.
|
|
39
|
+
const originalAccounts = {
|
|
40
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
41
|
+
configPda: { value: input.configPda ?? null, isWritable: false },
|
|
42
|
+
marketPda: { value: input.marketPda ?? null, isWritable: true },
|
|
43
|
+
oracleUnderlying: {
|
|
44
|
+
value: input.oracleUnderlying ?? null,
|
|
45
|
+
isWritable: false,
|
|
46
|
+
},
|
|
47
|
+
oracleQuote: { value: input.oracleQuote ?? null, isWritable: false },
|
|
48
|
+
};
|
|
49
|
+
const accounts = originalAccounts;
|
|
50
|
+
// Original args.
|
|
51
|
+
const args = { ...input };
|
|
52
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
accounts: [
|
|
55
|
+
getAccountMeta(accounts.admin),
|
|
56
|
+
getAccountMeta(accounts.configPda),
|
|
57
|
+
getAccountMeta(accounts.marketPda),
|
|
58
|
+
getAccountMeta(accounts.oracleUnderlying),
|
|
59
|
+
getAccountMeta(accounts.oracleQuote),
|
|
60
|
+
],
|
|
61
|
+
data: getUpdateMarketOraclesInstructionDataEncoder().encode(args),
|
|
62
|
+
programAddress,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function parseUpdateMarketOraclesInstruction(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
|
+
marketPda: getNextAccount(),
|
|
82
|
+
oracleUnderlying: getNextAccount(),
|
|
83
|
+
oracleQuote: getNextAccount(),
|
|
84
|
+
},
|
|
85
|
+
data: getUpdateMarketOraclesInstructionDataDecoder().decode(instruction.data),
|
|
86
|
+
};
|
|
87
|
+
}
|