@acta-markets/ts-sdk 0.0.18-beta → 0.0.20-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/dist/chain/instructions.market.d.ts +0 -1
- package/dist/chain/instructions.market.js +1 -6
- package/dist/chain/instructions.oracle.d.ts +0 -3
- package/dist/chain/instructions.oracle.js +1 -5
- package/dist/chain/instructions.position.js +8 -16
- package/dist/chain/instructions.shared.d.ts +0 -1
- package/dist/chain/instructions.shared.js +0 -1
- package/dist/cjs/chain/instructions.market.js +0 -5
- package/dist/cjs/chain/instructions.oracle.js +0 -4
- package/dist/cjs/chain/instructions.position.js +8 -16
- package/dist/cjs/chain/instructions.shared.js +1 -2
- package/dist/cjs/generated/instructions/closeOracle.js +2 -13
- package/dist/cjs/generated/instructions/createMarket.js +1 -10
- package/dist/cjs/generated/instructions/createOracle.js +1 -4
- package/dist/cjs/generated/instructions/depositFundsToPosition.js +5 -11
- package/dist/cjs/generated/instructions/finalizeMarket.js +1 -9
- package/dist/cjs/generated/instructions/updateOraclePrice.js +2 -13
- package/dist/cjs/idl/acta_contract.json +5 -61
- package/dist/cjs/idl/hash.js +1 -1
- package/dist/cjs/ws/apy.js +4 -10
- package/dist/cjs/ws/apy.test.js +37 -1
- package/dist/cjs/ws/client.handshake.integration.test.js +2 -1
- package/dist/cjs/ws/client.js +32 -14
- package/dist/cjs/ws/client.test.js +5 -1
- package/dist/generated/instructions/closeOracle.d.ts +5 -10
- package/dist/generated/instructions/closeOracle.js +2 -13
- package/dist/generated/instructions/createMarket.d.ts +11 -21
- package/dist/generated/instructions/createMarket.js +1 -10
- package/dist/generated/instructions/createOracle.d.ts +7 -12
- package/dist/generated/instructions/createOracle.js +1 -4
- package/dist/generated/instructions/depositFundsToPosition.d.ts +9 -14
- package/dist/generated/instructions/depositFundsToPosition.js +5 -11
- package/dist/generated/instructions/finalizeMarket.d.ts +4 -9
- package/dist/generated/instructions/finalizeMarket.js +1 -9
- package/dist/generated/instructions/updateOraclePrice.d.ts +5 -10
- package/dist/generated/instructions/updateOraclePrice.js +2 -13
- package/dist/idl/acta_contract.json +5 -61
- package/dist/idl/hash.d.ts +1 -1
- package/dist/idl/hash.js +1 -1
- package/dist/ws/apy.d.ts +1 -1
- package/dist/ws/apy.js +4 -10
- package/dist/ws/apy.test.js +37 -1
- package/dist/ws/client.d.ts +16 -4
- package/dist/ws/client.handshake.integration.test.js +2 -1
- package/dist/ws/client.js +32 -14
- package/dist/ws/client.test.js +5 -1
- package/dist/ws/types.d.ts +20 -0
- package/package.json +1 -1
package/dist/cjs/ws/apy.js
CHANGED
|
@@ -58,17 +58,11 @@ function computeApyFromAmounts(args) {
|
|
|
58
58
|
if (!Number.isFinite(premPU) || premPU < 0)
|
|
59
59
|
throw new Error("invalid premiumPerUnderlying");
|
|
60
60
|
const premiumNotional = qty * premPU;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
collateralPerUnderlying = args.spotPrice ?? NaN;
|
|
67
|
-
}
|
|
61
|
+
// Collateral always valued at spot so APR is monotonic across strikes.
|
|
62
|
+
// On-chain collateral requirements are unchanged — display metric only.
|
|
63
|
+
const collateralPerUnderlying = args.spotPrice ?? NaN;
|
|
68
64
|
if (!Number.isFinite(collateralPerUnderlying) || collateralPerUnderlying <= 0) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
? "spotPrice is required for covered_call yield"
|
|
71
|
-
: "invalid strikePrice");
|
|
65
|
+
throw new Error("spotPrice is required for yield calculation");
|
|
72
66
|
}
|
|
73
67
|
const collateralNotional = qty * collateralPerUnderlying;
|
|
74
68
|
const termYield = termYieldFromNotionals({ premiumNotional, collateralNotional });
|
package/dist/cjs/ws/apy.test.js
CHANGED
|
@@ -7,7 +7,7 @@ describe("ws apy helpers", () => {
|
|
|
7
7
|
positionType: "covered_call",
|
|
8
8
|
underlyingAmount: 10,
|
|
9
9
|
spotPrice: 150,
|
|
10
|
-
strikePrice: 150, // not used for
|
|
10
|
+
strikePrice: 150, // not used for collateral, kept for API compat
|
|
11
11
|
premiumPerUnderlying: 1.5,
|
|
12
12
|
secondsToExpiry: 7 * 24 * 60 * 60,
|
|
13
13
|
});
|
|
@@ -22,8 +22,44 @@ describe("ws apy helpers", () => {
|
|
|
22
22
|
underlyingAmount: 10,
|
|
23
23
|
grossPremiumPerUnit1e9: 1_500_000_000, // 1.5
|
|
24
24
|
strike1e9: 150_000_000_000, // 150
|
|
25
|
+
spotPrice1e9: 150_000_000_000, // 150 (ATM)
|
|
25
26
|
secondsToExpiry: 7 * 24 * 60 * 60,
|
|
26
27
|
});
|
|
27
28
|
expect(res.premiumNotional).toBeCloseTo(15, 10);
|
|
28
29
|
});
|
|
30
|
+
it("put APR uses spot as collateral (not strike)", () => {
|
|
31
|
+
const spot = 150;
|
|
32
|
+
const strike = 120; // OTM put
|
|
33
|
+
const res = (0, apy_1.computeApyFromAmounts)({
|
|
34
|
+
positionType: "cash_secured_put",
|
|
35
|
+
underlyingAmount: 1,
|
|
36
|
+
spotPrice: spot,
|
|
37
|
+
strikePrice: strike,
|
|
38
|
+
premiumPerUnderlying: 1.5,
|
|
39
|
+
secondsToExpiry: 30 * 24 * 60 * 60,
|
|
40
|
+
});
|
|
41
|
+
// collateral should be spot-based, not strike-based
|
|
42
|
+
expect(res.collateralNotional).toBeCloseTo(spot, 10);
|
|
43
|
+
});
|
|
44
|
+
it("put APR is monotonically decreasing for OTM strikes", () => {
|
|
45
|
+
const spot1e9 = 150_000_000_000; // 150
|
|
46
|
+
const strikes = [140, 130, 120, 110].map(s => s * 1_000_000_000);
|
|
47
|
+
// Premiums decrease with OTM (roughly realistic)
|
|
48
|
+
const premiums = [5, 2.5, 1, 0.3].map(p => p * 1_000_000_000);
|
|
49
|
+
const aprs = strikes.map((strike, i) => {
|
|
50
|
+
const res = (0, apy_1.computeApyFromScaledPrices)({
|
|
51
|
+
positionType: "cash_secured_put",
|
|
52
|
+
underlyingAmount: 1,
|
|
53
|
+
grossPremiumPerUnit1e9: premiums[i],
|
|
54
|
+
strike1e9: strike,
|
|
55
|
+
spotPrice1e9: spot1e9,
|
|
56
|
+
secondsToExpiry: 30 * 24 * 60 * 60,
|
|
57
|
+
});
|
|
58
|
+
return res.apr;
|
|
59
|
+
});
|
|
60
|
+
// Each APR should be less than the previous
|
|
61
|
+
for (let i = 1; i < aprs.length; i++) {
|
|
62
|
+
expect(aprs[i]).toBeLessThan(aprs[i - 1]);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
29
65
|
});
|
|
@@ -55,7 +55,8 @@ describeIfWsUrl("ws handshake integration (real backend)", () => {
|
|
|
55
55
|
});
|
|
56
56
|
client.on("error", (err) => {
|
|
57
57
|
if (!welcomeReceived) {
|
|
58
|
-
|
|
58
|
+
const msg = err.type === "generic" ? err.data.message : err.type;
|
|
59
|
+
finish(new Error(msg));
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
client.on("disconnected", (code, reason) => {
|
package/dist/cjs/ws/client.js
CHANGED
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.ActaWsClient = void 0;
|
|
5
5
|
const flows_1 = require("./flows");
|
|
6
6
|
const wirePolicy_1 = require("./wirePolicy");
|
|
7
|
+
function toGenericServerError(err) {
|
|
8
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
9
|
+
return { type: "generic", data: { code: "client_error", message } };
|
|
10
|
+
}
|
|
7
11
|
function formatServerError(error) {
|
|
8
12
|
if (error.type === "generic") {
|
|
9
13
|
return `${error.data.code}: ${error.data.message}`;
|
|
@@ -160,7 +164,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
160
164
|
if (this.ws?.readyState === WS_OPEN) {
|
|
161
165
|
if (this.welcomeReceived && !this.startAuthSent) {
|
|
162
166
|
void this.beginAuthHandshake().catch((err) => {
|
|
163
|
-
this.emit("error", err);
|
|
167
|
+
this.emit("error", toGenericServerError(err));
|
|
164
168
|
this.setConnectionState("error");
|
|
165
169
|
});
|
|
166
170
|
}
|
|
@@ -393,6 +397,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
393
397
|
}
|
|
394
398
|
subscribe(channels, markets) {
|
|
395
399
|
this.ensureAuthenticated();
|
|
400
|
+
const request_id = this.nextRequestId();
|
|
396
401
|
for (const c of channels)
|
|
397
402
|
this.subscribedChannels.add(c);
|
|
398
403
|
if (markets) {
|
|
@@ -402,18 +407,21 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
402
407
|
this.send({
|
|
403
408
|
type: "Subscribe",
|
|
404
409
|
data: this.hasMarketScope
|
|
405
|
-
? { channels, markets: Array.from(this.subscribedMarkets) }
|
|
406
|
-
: { channels },
|
|
410
|
+
? { request_id, channels, markets: Array.from(this.subscribedMarkets) }
|
|
411
|
+
: { request_id, channels },
|
|
407
412
|
});
|
|
413
|
+
return request_id;
|
|
408
414
|
}
|
|
409
415
|
unsubscribe(channels) {
|
|
410
416
|
this.ensureAuthenticated();
|
|
417
|
+
const request_id = this.nextRequestId();
|
|
411
418
|
for (const c of channels)
|
|
412
419
|
this.subscribedChannels.delete(c);
|
|
413
420
|
this.send({
|
|
414
421
|
type: "Unsubscribe",
|
|
415
|
-
data: { channels },
|
|
422
|
+
data: { request_id, channels },
|
|
416
423
|
});
|
|
424
|
+
return request_id;
|
|
417
425
|
}
|
|
418
426
|
ping() {
|
|
419
427
|
if (this.ws?.readyState === WS_OPEN) {
|
|
@@ -468,7 +476,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
468
476
|
};
|
|
469
477
|
ws.onerror = (ev) => {
|
|
470
478
|
this.log("WebSocket error:", ev);
|
|
471
|
-
this.emit("error",
|
|
479
|
+
this.emit("error", toGenericServerError("WebSocket error"));
|
|
472
480
|
if (this.shouldReconnect) {
|
|
473
481
|
this.cleanup();
|
|
474
482
|
this.scheduleReconnect();
|
|
@@ -485,7 +493,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
485
493
|
this.flushPendingMessages();
|
|
486
494
|
if (this.authRequested && this.authProvider && !this.startAuthSent) {
|
|
487
495
|
void this.beginAuthHandshake().catch((err) => {
|
|
488
|
-
this.emit("error", err);
|
|
496
|
+
this.emit("error", toGenericServerError(err));
|
|
489
497
|
this.setConnectionState("error");
|
|
490
498
|
});
|
|
491
499
|
}
|
|
@@ -711,7 +719,16 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
711
719
|
case "Pong":
|
|
712
720
|
break;
|
|
713
721
|
case "Error":
|
|
714
|
-
this.emit("error",
|
|
722
|
+
this.emit("error", message.data);
|
|
723
|
+
break;
|
|
724
|
+
case "RequestError":
|
|
725
|
+
this.emit("requestError", message.data);
|
|
726
|
+
break;
|
|
727
|
+
case "SubscribeAck":
|
|
728
|
+
this.emit("subscribeAck", message.data);
|
|
729
|
+
break;
|
|
730
|
+
case "UnsubscribeAck":
|
|
731
|
+
this.emit("unsubscribeAck", message.data);
|
|
715
732
|
break;
|
|
716
733
|
}
|
|
717
734
|
}
|
|
@@ -732,7 +749,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
732
749
|
async handleAuthRequest(challenge) {
|
|
733
750
|
this.setConnectionState("authenticating");
|
|
734
751
|
if (!this.authProvider) {
|
|
735
|
-
this.emit("error",
|
|
752
|
+
this.emit("error", toGenericServerError("No auth provider configured"));
|
|
736
753
|
return;
|
|
737
754
|
}
|
|
738
755
|
try {
|
|
@@ -746,7 +763,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
746
763
|
});
|
|
747
764
|
}
|
|
748
765
|
catch (err) {
|
|
749
|
-
this.emit("error", err);
|
|
766
|
+
this.emit("error", toGenericServerError(err));
|
|
750
767
|
this.setConnectionState("error");
|
|
751
768
|
}
|
|
752
769
|
}
|
|
@@ -797,9 +814,10 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
797
814
|
this.emit("authenticated", sessionId, expiresAt);
|
|
798
815
|
if (this.subscribedChannels.size > 0) {
|
|
799
816
|
const channels = Array.from(this.subscribedChannels);
|
|
817
|
+
const request_id = this.nextRequestId();
|
|
800
818
|
const data = this.hasMarketScope
|
|
801
|
-
? { channels, markets: Array.from(this.subscribedMarkets) }
|
|
802
|
-
: { channels };
|
|
819
|
+
? { request_id, channels, markets: Array.from(this.subscribedMarkets) }
|
|
820
|
+
: { request_id, channels };
|
|
803
821
|
this.send({ type: "Subscribe", data });
|
|
804
822
|
}
|
|
805
823
|
}
|
|
@@ -813,14 +831,14 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
813
831
|
this.lastAuthSessionId = null;
|
|
814
832
|
this.startAuthSent = false;
|
|
815
833
|
void this.sendStartAuth().catch((err) => {
|
|
816
|
-
this.emit("error", err);
|
|
834
|
+
this.emit("error", toGenericServerError(err));
|
|
817
835
|
this.setConnectionState("error");
|
|
818
836
|
});
|
|
819
837
|
return;
|
|
820
838
|
}
|
|
821
839
|
this.setConnectionState("error");
|
|
822
840
|
const details = message ? `${reason}: ${message}` : reason;
|
|
823
|
-
this.emit("error",
|
|
841
|
+
this.emit("error", toGenericServerError(`Authentication failed: ${details}`));
|
|
824
842
|
}
|
|
825
843
|
handleSnapshot(snapshot) {
|
|
826
844
|
this.state.markets.clear();
|
|
@@ -959,7 +977,7 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
959
977
|
this.log("Pending queue full, dropping newest message:", message.type);
|
|
960
978
|
return false;
|
|
961
979
|
case "throw":
|
|
962
|
-
this.emit("error",
|
|
980
|
+
this.emit("error", toGenericServerError(`Pending queue overflow (maxPendingMessages=${maxPending}) for message type=${message.type}`));
|
|
963
981
|
return false;
|
|
964
982
|
}
|
|
965
983
|
}
|
|
@@ -420,7 +420,11 @@ describe("ActaWsClient", () => {
|
|
|
420
420
|
client.getMarkets();
|
|
421
421
|
client.getTokens();
|
|
422
422
|
expect(errors).toHaveLength(1);
|
|
423
|
-
|
|
423
|
+
const err0 = errors[0];
|
|
424
|
+
expect(err0.type).toBe("generic");
|
|
425
|
+
if (err0.type === "generic") {
|
|
426
|
+
expect(err0.data.message).toContain("Pending queue overflow");
|
|
427
|
+
}
|
|
424
428
|
ws.triggerMessage(WELCOME_MESSAGE);
|
|
425
429
|
const flushedTypes = ws.sent
|
|
426
430
|
.slice(1)
|
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
|
-
import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type
|
|
8
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from "@solana/kit";
|
|
9
9
|
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
10
|
export declare const CLOSE_ORACLE_DISCRIMINATOR = 19;
|
|
11
11
|
export declare function getCloseOracleDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type CloseOracleInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountOraclePda extends string | AccountMeta<string> = string,
|
|
12
|
+
export type CloseOracleInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountOraclePda extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
13
|
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
14
14
|
TAccountOraclePda extends string ? WritableAccount<TAccountOraclePda> : TAccountOraclePda,
|
|
15
|
-
TAccountClockSysvar extends string ? ReadonlyAccount<TAccountClockSysvar> : TAccountClockSysvar,
|
|
16
15
|
...TRemainingAccounts
|
|
17
16
|
]>;
|
|
18
17
|
export type CloseOracleInstructionData = {
|
|
@@ -22,17 +21,15 @@ export type CloseOracleInstructionDataArgs = {};
|
|
|
22
21
|
export declare function getCloseOracleInstructionDataEncoder(): FixedSizeEncoder<CloseOracleInstructionDataArgs>;
|
|
23
22
|
export declare function getCloseOracleInstructionDataDecoder(): FixedSizeDecoder<CloseOracleInstructionData>;
|
|
24
23
|
export declare function getCloseOracleInstructionDataCodec(): FixedSizeCodec<CloseOracleInstructionDataArgs, CloseOracleInstructionData>;
|
|
25
|
-
export type CloseOracleInput<TAccountSigner extends string = string, TAccountOraclePda extends string = string
|
|
24
|
+
export type CloseOracleInput<TAccountSigner extends string = string, TAccountOraclePda extends string = string> = {
|
|
26
25
|
/** Protocol admin authority */
|
|
27
26
|
signer: TransactionSigner<TAccountSigner>;
|
|
28
27
|
/** Oracle PDA to close */
|
|
29
28
|
oraclePda: Address<TAccountOraclePda>;
|
|
30
|
-
/** Clock sysvar account */
|
|
31
|
-
clockSysvar?: Address<TAccountClockSysvar>;
|
|
32
29
|
};
|
|
33
|
-
export declare function getCloseOracleInstruction<TAccountSigner extends string, TAccountOraclePda extends string,
|
|
30
|
+
export declare function getCloseOracleInstruction<TAccountSigner extends string, TAccountOraclePda extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: CloseOracleInput<TAccountSigner, TAccountOraclePda>, config?: {
|
|
34
31
|
programAddress?: TProgramAddress;
|
|
35
|
-
}): CloseOracleInstruction<TProgramAddress, TAccountSigner, TAccountOraclePda
|
|
32
|
+
}): CloseOracleInstruction<TProgramAddress, TAccountSigner, TAccountOraclePda>;
|
|
36
33
|
export type ParsedCloseOracleInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
37
34
|
programAddress: Address<TProgram>;
|
|
38
35
|
accounts: {
|
|
@@ -40,8 +37,6 @@ export type ParsedCloseOracleInstruction<TProgram extends string = typeof ACTA_C
|
|
|
40
37
|
signer: TAccountMetas[0];
|
|
41
38
|
/** Oracle PDA to close */
|
|
42
39
|
oraclePda: TAccountMetas[1];
|
|
43
|
-
/** Clock sysvar account */
|
|
44
|
-
clockSysvar: TAccountMetas[2];
|
|
45
40
|
};
|
|
46
41
|
data: CloseOracleInstructionData;
|
|
47
42
|
};
|
|
@@ -28,27 +28,20 @@ export function getCloseOracleInstruction(input, config) {
|
|
|
28
28
|
const originalAccounts = {
|
|
29
29
|
signer: { value: input.signer ?? null, isWritable: true },
|
|
30
30
|
oraclePda: { value: input.oraclePda ?? null, isWritable: true },
|
|
31
|
-
clockSysvar: { value: input.clockSysvar ?? null, isWritable: false },
|
|
32
31
|
};
|
|
33
32
|
const accounts = originalAccounts;
|
|
34
|
-
// Resolve default values.
|
|
35
|
-
if (!accounts.clockSysvar.value) {
|
|
36
|
-
accounts.clockSysvar.value =
|
|
37
|
-
"SysvarC1ock11111111111111111111111111111111";
|
|
38
|
-
}
|
|
39
33
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
40
34
|
return Object.freeze({
|
|
41
35
|
accounts: [
|
|
42
36
|
getAccountMeta(accounts.signer),
|
|
43
37
|
getAccountMeta(accounts.oraclePda),
|
|
44
|
-
getAccountMeta(accounts.clockSysvar),
|
|
45
38
|
],
|
|
46
39
|
data: getCloseOracleInstructionDataEncoder().encode({}),
|
|
47
40
|
programAddress,
|
|
48
41
|
});
|
|
49
42
|
}
|
|
50
43
|
export function parseCloseOracleInstruction(instruction) {
|
|
51
|
-
if (instruction.accounts.length <
|
|
44
|
+
if (instruction.accounts.length < 2) {
|
|
52
45
|
// TODO: Coded error.
|
|
53
46
|
throw new Error("Not enough accounts");
|
|
54
47
|
}
|
|
@@ -60,11 +53,7 @@ export function parseCloseOracleInstruction(instruction) {
|
|
|
60
53
|
};
|
|
61
54
|
return {
|
|
62
55
|
programAddress: instruction.programAddress,
|
|
63
|
-
accounts: {
|
|
64
|
-
signer: getNextAccount(),
|
|
65
|
-
oraclePda: getNextAccount(),
|
|
66
|
-
clockSysvar: getNextAccount(),
|
|
67
|
-
},
|
|
56
|
+
accounts: { signer: getNextAccount(), oraclePda: getNextAccount() },
|
|
68
57
|
data: getCloseOracleInstructionDataDecoder().decode(instruction.data),
|
|
69
58
|
};
|
|
70
59
|
}
|
|
@@ -9,14 +9,12 @@ import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeC
|
|
|
9
9
|
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
10
|
export declare const CREATE_MARKET_DISCRIMINATOR = 6;
|
|
11
11
|
export declare function getCreateMarketDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type CreateMarketInstruction<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, TAccountUnderlyingMint extends string | AccountMeta<string> = string, TAccountQuoteMint extends string | AccountMeta<string> = string,
|
|
12
|
+
export type CreateMarketInstruction<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, TAccountUnderlyingMint extends string | AccountMeta<string> = string, TAccountQuoteMint extends string | AccountMeta<string> = string, TAccountOracleUnderlying extends string | AccountMeta<string> = string, TAccountOracleQuote extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
13
|
TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & AccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
14
14
|
TAccountConfigPda extends string ? ReadonlyAccount<TAccountConfigPda> : TAccountConfigPda,
|
|
15
15
|
TAccountMarketPda extends string ? WritableAccount<TAccountMarketPda> : TAccountMarketPda,
|
|
16
16
|
TAccountUnderlyingMint extends string ? ReadonlyAccount<TAccountUnderlyingMint> : TAccountUnderlyingMint,
|
|
17
17
|
TAccountQuoteMint extends string ? ReadonlyAccount<TAccountQuoteMint> : TAccountQuoteMint,
|
|
18
|
-
TAccountUnderlyingMintAcc extends string ? ReadonlyAccount<TAccountUnderlyingMintAcc> : TAccountUnderlyingMintAcc,
|
|
19
|
-
TAccountQuoteMintAcc extends string ? ReadonlyAccount<TAccountQuoteMintAcc> : TAccountQuoteMintAcc,
|
|
20
18
|
TAccountOracleUnderlying extends string ? WritableAccount<TAccountOracleUnderlying> : TAccountOracleUnderlying,
|
|
21
19
|
TAccountOracleQuote extends string ? WritableAccount<TAccountOracleQuote> : TAccountOracleQuote,
|
|
22
20
|
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
@@ -34,21 +32,17 @@ export type CreateMarketInstructionDataArgs = {
|
|
|
34
32
|
export declare function getCreateMarketInstructionDataEncoder(): FixedSizeEncoder<CreateMarketInstructionDataArgs>;
|
|
35
33
|
export declare function getCreateMarketInstructionDataDecoder(): FixedSizeDecoder<CreateMarketInstructionData>;
|
|
36
34
|
export declare function getCreateMarketInstructionDataCodec(): FixedSizeCodec<CreateMarketInstructionDataArgs, CreateMarketInstructionData>;
|
|
37
|
-
export type CreateMarketInput<TAccountAdmin extends string = string, TAccountConfigPda extends string = string, TAccountMarketPda extends string = string, TAccountUnderlyingMint extends string = string, TAccountQuoteMint extends string = string,
|
|
35
|
+
export type CreateMarketInput<TAccountAdmin extends string = string, TAccountConfigPda extends string = string, TAccountMarketPda extends string = string, TAccountUnderlyingMint extends string = string, TAccountQuoteMint extends string = string, TAccountOracleUnderlying extends string = string, TAccountOracleQuote extends string = string, TAccountSystemProgram extends string = string> = {
|
|
38
36
|
/** Protocol admin authority */
|
|
39
37
|
admin: TransactionSigner<TAccountAdmin>;
|
|
40
38
|
/** Config PDA for admin verification */
|
|
41
39
|
configPda: Address<TAccountConfigPda>;
|
|
42
40
|
/** Market PDA to create */
|
|
43
41
|
marketPda: Address<TAccountMarketPda>;
|
|
44
|
-
/** Underlying SPL mint */
|
|
42
|
+
/** Underlying SPL mint (used for PDA seed and decimals) */
|
|
45
43
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
46
|
-
/** Quote SPL mint */
|
|
44
|
+
/** Quote SPL mint (used for PDA seed and decimals) */
|
|
47
45
|
quoteMint: Address<TAccountQuoteMint>;
|
|
48
|
-
/** Underlying mint account (for decimals) */
|
|
49
|
-
underlyingMintAcc: Address<TAccountUnderlyingMintAcc>;
|
|
50
|
-
/** Quote mint account (for decimals) */
|
|
51
|
-
quoteMintAcc: Address<TAccountQuoteMintAcc>;
|
|
52
46
|
/** Underlying oracle PDA */
|
|
53
47
|
oracleUnderlying: Address<TAccountOracleUnderlying>;
|
|
54
48
|
/** Quote oracle PDA */
|
|
@@ -58,9 +52,9 @@ export type CreateMarketInput<TAccountAdmin extends string = string, TAccountCon
|
|
|
58
52
|
expiryTs: CreateMarketInstructionDataArgs["expiryTs"];
|
|
59
53
|
isPut: CreateMarketInstructionDataArgs["isPut"];
|
|
60
54
|
};
|
|
61
|
-
export declare function getCreateMarketInstruction<TAccountAdmin extends string, TAccountConfigPda extends string, TAccountMarketPda extends string, TAccountUnderlyingMint extends string, TAccountQuoteMint extends string,
|
|
55
|
+
export declare function getCreateMarketInstruction<TAccountAdmin extends string, TAccountConfigPda extends string, TAccountMarketPda extends string, TAccountUnderlyingMint extends string, TAccountQuoteMint extends string, TAccountOracleUnderlying extends string, TAccountOracleQuote extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: CreateMarketInput<TAccountAdmin, TAccountConfigPda, TAccountMarketPda, TAccountUnderlyingMint, TAccountQuoteMint, TAccountOracleUnderlying, TAccountOracleQuote, TAccountSystemProgram>, config?: {
|
|
62
56
|
programAddress?: TProgramAddress;
|
|
63
|
-
}): CreateMarketInstruction<TProgramAddress, TAccountAdmin, TAccountConfigPda, TAccountMarketPda, TAccountUnderlyingMint, TAccountQuoteMint,
|
|
57
|
+
}): CreateMarketInstruction<TProgramAddress, TAccountAdmin, TAccountConfigPda, TAccountMarketPda, TAccountUnderlyingMint, TAccountQuoteMint, TAccountOracleUnderlying, TAccountOracleQuote, TAccountSystemProgram>;
|
|
64
58
|
export type ParsedCreateMarketInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
65
59
|
programAddress: Address<TProgram>;
|
|
66
60
|
accounts: {
|
|
@@ -70,20 +64,16 @@ export type ParsedCreateMarketInstruction<TProgram extends string = typeof ACTA_
|
|
|
70
64
|
configPda: TAccountMetas[1];
|
|
71
65
|
/** Market PDA to create */
|
|
72
66
|
marketPda: TAccountMetas[2];
|
|
73
|
-
/** Underlying SPL mint */
|
|
67
|
+
/** Underlying SPL mint (used for PDA seed and decimals) */
|
|
74
68
|
underlyingMint: TAccountMetas[3];
|
|
75
|
-
/** Quote SPL mint */
|
|
69
|
+
/** Quote SPL mint (used for PDA seed and decimals) */
|
|
76
70
|
quoteMint: TAccountMetas[4];
|
|
77
|
-
/** Underlying mint account (for decimals) */
|
|
78
|
-
underlyingMintAcc: TAccountMetas[5];
|
|
79
|
-
/** Quote mint account (for decimals) */
|
|
80
|
-
quoteMintAcc: TAccountMetas[6];
|
|
81
71
|
/** Underlying oracle PDA */
|
|
82
|
-
oracleUnderlying: TAccountMetas[
|
|
72
|
+
oracleUnderlying: TAccountMetas[5];
|
|
83
73
|
/** Quote oracle PDA */
|
|
84
|
-
oracleQuote: TAccountMetas[
|
|
74
|
+
oracleQuote: TAccountMetas[6];
|
|
85
75
|
/** System program */
|
|
86
|
-
systemProgram: TAccountMetas[
|
|
76
|
+
systemProgram: TAccountMetas[7];
|
|
87
77
|
};
|
|
88
78
|
data: CreateMarketInstructionData;
|
|
89
79
|
};
|
|
@@ -39,11 +39,6 @@ export function getCreateMarketInstruction(input, config) {
|
|
|
39
39
|
marketPda: { value: input.marketPda ?? null, isWritable: true },
|
|
40
40
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
41
41
|
quoteMint: { value: input.quoteMint ?? null, isWritable: false },
|
|
42
|
-
underlyingMintAcc: {
|
|
43
|
-
value: input.underlyingMintAcc ?? null,
|
|
44
|
-
isWritable: false,
|
|
45
|
-
},
|
|
46
|
-
quoteMintAcc: { value: input.quoteMintAcc ?? null, isWritable: false },
|
|
47
42
|
oracleUnderlying: {
|
|
48
43
|
value: input.oracleUnderlying ?? null,
|
|
49
44
|
isWritable: true,
|
|
@@ -67,8 +62,6 @@ export function getCreateMarketInstruction(input, config) {
|
|
|
67
62
|
getAccountMeta(accounts.marketPda),
|
|
68
63
|
getAccountMeta(accounts.underlyingMint),
|
|
69
64
|
getAccountMeta(accounts.quoteMint),
|
|
70
|
-
getAccountMeta(accounts.underlyingMintAcc),
|
|
71
|
-
getAccountMeta(accounts.quoteMintAcc),
|
|
72
65
|
getAccountMeta(accounts.oracleUnderlying),
|
|
73
66
|
getAccountMeta(accounts.oracleQuote),
|
|
74
67
|
getAccountMeta(accounts.systemProgram),
|
|
@@ -78,7 +71,7 @@ export function getCreateMarketInstruction(input, config) {
|
|
|
78
71
|
});
|
|
79
72
|
}
|
|
80
73
|
export function parseCreateMarketInstruction(instruction) {
|
|
81
|
-
if (instruction.accounts.length <
|
|
74
|
+
if (instruction.accounts.length < 8) {
|
|
82
75
|
// TODO: Coded error.
|
|
83
76
|
throw new Error("Not enough accounts");
|
|
84
77
|
}
|
|
@@ -96,8 +89,6 @@ export function parseCreateMarketInstruction(instruction) {
|
|
|
96
89
|
marketPda: getNextAccount(),
|
|
97
90
|
underlyingMint: getNextAccount(),
|
|
98
91
|
quoteMint: getNextAccount(),
|
|
99
|
-
underlyingMintAcc: getNextAccount(),
|
|
100
|
-
quoteMintAcc: getNextAccount(),
|
|
101
92
|
oracleUnderlying: getNextAccount(),
|
|
102
93
|
oracleQuote: getNextAccount(),
|
|
103
94
|
systemProgram: getNextAccount(),
|
|
@@ -9,11 +9,10 @@ import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeC
|
|
|
9
9
|
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
10
|
export declare const CREATE_ORACLE_DISCRIMINATOR = 15;
|
|
11
11
|
export declare function getCreateOracleDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type CreateOracleInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountOraclePda extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string,
|
|
12
|
+
export type CreateOracleInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountOraclePda extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
13
|
TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & AccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
14
14
|
TAccountOraclePda extends string ? WritableAccount<TAccountOraclePda> : TAccountOraclePda,
|
|
15
15
|
TAccountMint extends string ? ReadonlyAccount<TAccountMint> : TAccountMint,
|
|
16
|
-
TAccountMintAcc extends string ? ReadonlyAccount<TAccountMintAcc> : TAccountMintAcc,
|
|
17
16
|
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
18
17
|
...TRemainingAccounts
|
|
19
18
|
]>;
|
|
@@ -33,15 +32,13 @@ export type CreateOracleInstructionDataArgs = {
|
|
|
33
32
|
export declare function getCreateOracleInstructionDataEncoder(): FixedSizeEncoder<CreateOracleInstructionDataArgs>;
|
|
34
33
|
export declare function getCreateOracleInstructionDataDecoder(): FixedSizeDecoder<CreateOracleInstructionData>;
|
|
35
34
|
export declare function getCreateOracleInstructionDataCodec(): FixedSizeCodec<CreateOracleInstructionDataArgs, CreateOracleInstructionData>;
|
|
36
|
-
export type CreateOracleInput<TAccountAdmin extends string = string, TAccountOraclePda extends string = string, TAccountMint extends string = string,
|
|
35
|
+
export type CreateOracleInput<TAccountAdmin extends string = string, TAccountOraclePda extends string = string, TAccountMint extends string = string, TAccountSystemProgram extends string = string> = {
|
|
37
36
|
/** Protocol admin authority that pays rent */
|
|
38
37
|
admin: TransactionSigner<TAccountAdmin>;
|
|
39
38
|
/** Oracle PDA to create */
|
|
40
39
|
oraclePda: Address<TAccountOraclePda>;
|
|
41
|
-
/** SPL mint this oracle prices */
|
|
40
|
+
/** SPL mint this oracle prices (also used for decimals + token program owner) */
|
|
42
41
|
mint: Address<TAccountMint>;
|
|
43
|
-
/** Mint account (for decimals + token program owner) */
|
|
44
|
-
mintAcc: Address<TAccountMintAcc>;
|
|
45
42
|
/** System program */
|
|
46
43
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
47
44
|
oracleType: CreateOracleInstructionDataArgs["oracleType"];
|
|
@@ -49,9 +46,9 @@ export type CreateOracleInput<TAccountAdmin extends string = string, TAccountOra
|
|
|
49
46
|
authority: CreateOracleInstructionDataArgs["authority"];
|
|
50
47
|
feedId: CreateOracleInstructionDataArgs["feedId"];
|
|
51
48
|
};
|
|
52
|
-
export declare function getCreateOracleInstruction<TAccountAdmin extends string, TAccountOraclePda extends string, TAccountMint extends string,
|
|
49
|
+
export declare function getCreateOracleInstruction<TAccountAdmin extends string, TAccountOraclePda extends string, TAccountMint extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: CreateOracleInput<TAccountAdmin, TAccountOraclePda, TAccountMint, TAccountSystemProgram>, config?: {
|
|
53
50
|
programAddress?: TProgramAddress;
|
|
54
|
-
}): CreateOracleInstruction<TProgramAddress, TAccountAdmin, TAccountOraclePda, TAccountMint,
|
|
51
|
+
}): CreateOracleInstruction<TProgramAddress, TAccountAdmin, TAccountOraclePda, TAccountMint, TAccountSystemProgram>;
|
|
55
52
|
export type ParsedCreateOracleInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
56
53
|
programAddress: Address<TProgram>;
|
|
57
54
|
accounts: {
|
|
@@ -59,12 +56,10 @@ export type ParsedCreateOracleInstruction<TProgram extends string = typeof ACTA_
|
|
|
59
56
|
admin: TAccountMetas[0];
|
|
60
57
|
/** Oracle PDA to create */
|
|
61
58
|
oraclePda: TAccountMetas[1];
|
|
62
|
-
/** SPL mint this oracle prices */
|
|
59
|
+
/** SPL mint this oracle prices (also used for decimals + token program owner) */
|
|
63
60
|
mint: TAccountMetas[2];
|
|
64
|
-
/** Mint account (for decimals + token program owner) */
|
|
65
|
-
mintAcc: TAccountMetas[3];
|
|
66
61
|
/** System program */
|
|
67
|
-
systemProgram: TAccountMetas[
|
|
62
|
+
systemProgram: TAccountMetas[3];
|
|
68
63
|
};
|
|
69
64
|
data: CreateOracleInstructionData;
|
|
70
65
|
};
|
|
@@ -41,7 +41,6 @@ export function getCreateOracleInstruction(input, config) {
|
|
|
41
41
|
admin: { value: input.admin ?? null, isWritable: true },
|
|
42
42
|
oraclePda: { value: input.oraclePda ?? null, isWritable: true },
|
|
43
43
|
mint: { value: input.mint ?? null, isWritable: false },
|
|
44
|
-
mintAcc: { value: input.mintAcc ?? null, isWritable: false },
|
|
45
44
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
46
45
|
};
|
|
47
46
|
const accounts = originalAccounts;
|
|
@@ -58,7 +57,6 @@ export function getCreateOracleInstruction(input, config) {
|
|
|
58
57
|
getAccountMeta(accounts.admin),
|
|
59
58
|
getAccountMeta(accounts.oraclePda),
|
|
60
59
|
getAccountMeta(accounts.mint),
|
|
61
|
-
getAccountMeta(accounts.mintAcc),
|
|
62
60
|
getAccountMeta(accounts.systemProgram),
|
|
63
61
|
],
|
|
64
62
|
data: getCreateOracleInstructionDataEncoder().encode(args),
|
|
@@ -66,7 +64,7 @@ export function getCreateOracleInstruction(input, config) {
|
|
|
66
64
|
});
|
|
67
65
|
}
|
|
68
66
|
export function parseCreateOracleInstruction(instruction) {
|
|
69
|
-
if (instruction.accounts.length <
|
|
67
|
+
if (instruction.accounts.length < 4) {
|
|
70
68
|
// TODO: Coded error.
|
|
71
69
|
throw new Error("Not enough accounts");
|
|
72
70
|
}
|
|
@@ -82,7 +80,6 @@ export function parseCreateOracleInstruction(instruction) {
|
|
|
82
80
|
admin: getNextAccount(),
|
|
83
81
|
oraclePda: getNextAccount(),
|
|
84
82
|
mint: getNextAccount(),
|
|
85
|
-
mintAcc: getNextAccount(),
|
|
86
83
|
systemProgram: getNextAccount(),
|
|
87
84
|
},
|
|
88
85
|
data: getCreateOracleInstructionDataDecoder().decode(instruction.data),
|
|
@@ -9,15 +9,14 @@ import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeC
|
|
|
9
9
|
import { ACTA_CONTRACT_PROGRAM_ADDRESS } from "../programs";
|
|
10
10
|
export declare const DEPOSIT_FUNDS_TO_POSITION_DISCRIMINATOR = 9;
|
|
11
11
|
export declare function getDepositFundsToPositionDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type DepositFundsToPositionInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMakerOwner extends string | AccountMeta<string> = string, TAccountMakerPda extends string | AccountMeta<string> = string, TAccountPositionPda extends string | AccountMeta<string> = string, TAccountMarketPda extends string | AccountMeta<string> = string, TAccountMakerFundingAta extends string | AccountMeta<string> = string, TAccountPosSettlementAta extends string | AccountMeta<string> = string,
|
|
12
|
+
export type DepositFundsToPositionInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMakerOwner extends string | AccountMeta<string> = string, TAccountMakerPda extends string | AccountMeta<string> = string, TAccountPositionPda extends string | AccountMeta<string> = string, TAccountMarketPda extends string | AccountMeta<string> = string, TAccountMakerFundingAta extends string | AccountMeta<string> = string, TAccountPosSettlementAta extends string | AccountMeta<string> = string, TAccountSettlementTokenProgram extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
13
|
TAccountMakerOwner extends string ? ReadonlySignerAccount<TAccountMakerOwner> & AccountSignerMeta<TAccountMakerOwner> : TAccountMakerOwner,
|
|
14
14
|
TAccountMakerPda extends string ? ReadonlyAccount<TAccountMakerPda> : TAccountMakerPda,
|
|
15
15
|
TAccountPositionPda extends string ? WritableAccount<TAccountPositionPda> : TAccountPositionPda,
|
|
16
16
|
TAccountMarketPda extends string ? ReadonlyAccount<TAccountMarketPda> : TAccountMarketPda,
|
|
17
17
|
TAccountMakerFundingAta extends string ? WritableAccount<TAccountMakerFundingAta> : TAccountMakerFundingAta,
|
|
18
18
|
TAccountPosSettlementAta extends string ? WritableAccount<TAccountPosSettlementAta> : TAccountPosSettlementAta,
|
|
19
|
-
|
|
20
|
-
TAccountQuoteTokenProgram extends string ? ReadonlyAccount<TAccountQuoteTokenProgram> : TAccountQuoteTokenProgram,
|
|
19
|
+
TAccountSettlementTokenProgram extends string ? ReadonlyAccount<TAccountSettlementTokenProgram> : TAccountSettlementTokenProgram,
|
|
21
20
|
...TRemainingAccounts
|
|
22
21
|
]>;
|
|
23
22
|
export type DepositFundsToPositionInstructionData = {
|
|
@@ -27,7 +26,7 @@ export type DepositFundsToPositionInstructionDataArgs = {};
|
|
|
27
26
|
export declare function getDepositFundsToPositionInstructionDataEncoder(): FixedSizeEncoder<DepositFundsToPositionInstructionDataArgs>;
|
|
28
27
|
export declare function getDepositFundsToPositionInstructionDataDecoder(): FixedSizeDecoder<DepositFundsToPositionInstructionData>;
|
|
29
28
|
export declare function getDepositFundsToPositionInstructionDataCodec(): FixedSizeCodec<DepositFundsToPositionInstructionDataArgs, DepositFundsToPositionInstructionData>;
|
|
30
|
-
export type DepositFundsToPositionInput<TAccountMakerOwner extends string = string, TAccountMakerPda extends string = string, TAccountPositionPda extends string = string, TAccountMarketPda extends string = string, TAccountMakerFundingAta extends string = string, TAccountPosSettlementAta extends string = string,
|
|
29
|
+
export type DepositFundsToPositionInput<TAccountMakerOwner extends string = string, TAccountMakerPda extends string = string, TAccountPositionPda extends string = string, TAccountMarketPda extends string = string, TAccountMakerFundingAta extends string = string, TAccountPosSettlementAta extends string = string, TAccountSettlementTokenProgram extends string = string> = {
|
|
31
30
|
/** Maker owner authority */
|
|
32
31
|
makerOwner: TransactionSigner<TAccountMakerOwner>;
|
|
33
32
|
/** Maker PDA for ownership check */
|
|
@@ -40,14 +39,12 @@ export type DepositFundsToPositionInput<TAccountMakerOwner extends string = stri
|
|
|
40
39
|
makerFundingAta: Address<TAccountMakerFundingAta>;
|
|
41
40
|
/** Position settlement ATA */
|
|
42
41
|
posSettlementAta: Address<TAccountPosSettlementAta>;
|
|
43
|
-
/** Token program for
|
|
44
|
-
|
|
45
|
-
/** Token program for quote mint */
|
|
46
|
-
quoteTokenProgram: Address<TAccountQuoteTokenProgram>;
|
|
42
|
+
/** Token program for the settlement mint */
|
|
43
|
+
settlementTokenProgram: Address<TAccountSettlementTokenProgram>;
|
|
47
44
|
};
|
|
48
|
-
export declare function getDepositFundsToPositionInstruction<TAccountMakerOwner extends string, TAccountMakerPda extends string, TAccountPositionPda extends string, TAccountMarketPda extends string, TAccountMakerFundingAta extends string, TAccountPosSettlementAta extends string,
|
|
45
|
+
export declare function getDepositFundsToPositionInstruction<TAccountMakerOwner extends string, TAccountMakerPda extends string, TAccountPositionPda extends string, TAccountMarketPda extends string, TAccountMakerFundingAta extends string, TAccountPosSettlementAta extends string, TAccountSettlementTokenProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: DepositFundsToPositionInput<TAccountMakerOwner, TAccountMakerPda, TAccountPositionPda, TAccountMarketPda, TAccountMakerFundingAta, TAccountPosSettlementAta, TAccountSettlementTokenProgram>, config?: {
|
|
49
46
|
programAddress?: TProgramAddress;
|
|
50
|
-
}): DepositFundsToPositionInstruction<TProgramAddress, TAccountMakerOwner, TAccountMakerPda, TAccountPositionPda, TAccountMarketPda, TAccountMakerFundingAta, TAccountPosSettlementAta,
|
|
47
|
+
}): DepositFundsToPositionInstruction<TProgramAddress, TAccountMakerOwner, TAccountMakerPda, TAccountPositionPda, TAccountMarketPda, TAccountMakerFundingAta, TAccountPosSettlementAta, TAccountSettlementTokenProgram>;
|
|
51
48
|
export type ParsedDepositFundsToPositionInstruction<TProgram extends string = typeof ACTA_CONTRACT_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
52
49
|
programAddress: Address<TProgram>;
|
|
53
50
|
accounts: {
|
|
@@ -63,10 +60,8 @@ export type ParsedDepositFundsToPositionInstruction<TProgram extends string = ty
|
|
|
63
60
|
makerFundingAta: TAccountMetas[4];
|
|
64
61
|
/** Position settlement ATA */
|
|
65
62
|
posSettlementAta: TAccountMetas[5];
|
|
66
|
-
/** Token program for
|
|
67
|
-
|
|
68
|
-
/** Token program for quote mint */
|
|
69
|
-
quoteTokenProgram: TAccountMetas[7];
|
|
63
|
+
/** Token program for the settlement mint */
|
|
64
|
+
settlementTokenProgram: TAccountMetas[6];
|
|
70
65
|
};
|
|
71
66
|
data: DepositFundsToPositionInstructionData;
|
|
72
67
|
};
|