@acta-markets/ts-sdk 0.0.21-beta → 0.0.23-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/chain/instructions.position.d.ts +1 -0
  2. package/dist/chain/instructions.position.js +1 -0
  3. package/dist/cjs/chain/instructions.position.js +1 -0
  4. package/dist/cjs/generated/errors/actaContract.js +4 -1
  5. package/dist/cjs/generated/instructions/settlePosition.js +11 -3
  6. package/dist/cjs/idl/acta_contract.json +11 -1
  7. package/dist/cjs/idl/hash.js +1 -1
  8. package/dist/cjs/ws/auth.js +14 -11
  9. package/dist/cjs/ws/client.js +100 -1
  10. package/dist/cjs/ws/client.test.js +1 -1
  11. package/dist/cjs/ws/flows.js +20 -0
  12. package/dist/cjs/ws/index.js +1 -0
  13. package/dist/cjs/ws/referral.js +57 -0
  14. package/dist/cjs/ws/referral.test.js +55 -0
  15. package/dist/generated/errors/actaContract.d.ts +3 -1
  16. package/dist/generated/errors/actaContract.js +3 -0
  17. package/dist/generated/instructions/settlePosition.d.ts +5 -1
  18. package/dist/generated/instructions/settlePosition.js +11 -3
  19. package/dist/idl/acta_contract.json +11 -1
  20. package/dist/idl/hash.d.ts +1 -1
  21. package/dist/idl/hash.js +1 -1
  22. package/dist/ws/auth.d.ts +10 -7
  23. package/dist/ws/auth.js +14 -11
  24. package/dist/ws/client.d.ts +40 -1
  25. package/dist/ws/client.js +101 -2
  26. package/dist/ws/client.test.js +1 -1
  27. package/dist/ws/flows.d.ts +13 -1
  28. package/dist/ws/flows.js +19 -0
  29. package/dist/ws/index.d.ts +1 -0
  30. package/dist/ws/index.js +1 -0
  31. package/dist/ws/referral.d.ts +53 -0
  32. package/dist/ws/referral.js +51 -0
  33. package/dist/ws/referral.test.d.ts +1 -0
  34. package/dist/ws/referral.test.js +53 -0
  35. package/dist/ws/types.d.ts +142 -48
  36. package/package.json +1 -1
@@ -57,6 +57,7 @@ export declare function buildSettlePositionIx(input: {
57
57
  tokenProgram?: Address<string>;
58
58
  underlyingTokenProgram?: Address<string>;
59
59
  quoteTokenProgram?: Address<string>;
60
+ flags?: number;
60
61
  rpc?: Rpc;
61
62
  }): Promise<Instruction>;
62
63
  export declare function buildLiquidatePositionIx(input: {
@@ -175,6 +175,7 @@ export async function buildSettlePositionIx(input) {
175
175
  makerDestAta: toAddress(input.makerDestAta),
176
176
  underlyingTokenProgram,
177
177
  quoteTokenProgram,
178
+ flags: input.flags ?? 0,
178
179
  }, { programAddress: getActaProgramId() });
179
180
  }
180
181
  export async function buildLiquidatePositionIx(input) {
@@ -182,6 +182,7 @@ async function buildSettlePositionIx(input) {
182
182
  makerDestAta: (0, instructions_shared_1.toAddress)(input.makerDestAta),
183
183
  underlyingTokenProgram,
184
184
  quoteTokenProgram,
185
+ flags: input.flags ?? 0,
185
186
  }, { programAddress: (0, index_1.getActaProgramId)() });
186
187
  }
187
188
  async function buildLiquidatePositionIx(input) {
@@ -7,7 +7,7 @@
7
7
  * @see https://github.com/codama-idl/codama
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED = exports.ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = exports.ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = exports.ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = exports.ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY = exports.ACTA_CONTRACT_ERROR__UNAUTHORIZED = exports.ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP = exports.ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID = exports.ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS = exports.ACTA_CONTRACT_ERROR__MINT_MISMATCH = exports.ACTA_CONTRACT_ERROR__MATH_OVERFLOW = exports.ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA = exports.ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH = exports.ACTA_CONTRACT_ERROR__SIGNER_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORDER_ID = exports.ACTA_CONTRACT_ERROR__CANNOT_LIQUIDATE_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_ITM = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN = exports.ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE = exports.ACTA_CONTRACT_ERROR__ORACLE_INACTIVE = exports.ACTA_CONTRACT_ERROR__ORACLE_STALE = exports.ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY = exports.ACTA_CONTRACT_ERROR__MARKET_EXPIRED = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED = exports.ACTA_CONTRACT_ERROR__MARKET_FINALIZED = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED = exports.ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED = exports.ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT = exports.ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_PDA = exports.ACTA_CONTRACT_ERROR__INVALID_OWNER = exports.ACTA_CONTRACT_ERROR__NOT_SIGNED = void 0;
10
+ exports.ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION = exports.ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED = exports.ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = exports.ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = exports.ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = exports.ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY = exports.ACTA_CONTRACT_ERROR__UNAUTHORIZED = exports.ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP = exports.ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID = exports.ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS = exports.ACTA_CONTRACT_ERROR__MINT_MISMATCH = exports.ACTA_CONTRACT_ERROR__MATH_OVERFLOW = exports.ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA = exports.ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH = exports.ACTA_CONTRACT_ERROR__SIGNER_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORDER_ID = exports.ACTA_CONTRACT_ERROR__CANNOT_LIQUIDATE_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_ITM = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN = exports.ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE = exports.ACTA_CONTRACT_ERROR__ORACLE_INACTIVE = exports.ACTA_CONTRACT_ERROR__ORACLE_STALE = exports.ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY = exports.ACTA_CONTRACT_ERROR__MARKET_EXPIRED = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED = exports.ACTA_CONTRACT_ERROR__MARKET_FINALIZED = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED = exports.ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED = exports.ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT = exports.ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_PDA = exports.ACTA_CONTRACT_ERROR__INVALID_OWNER = exports.ACTA_CONTRACT_ERROR__NOT_SIGNED = void 0;
11
11
  exports.getActaContractErrorMessage = getActaContractErrorMessage;
12
12
  exports.isActaContractError = isActaContractError;
13
13
  const kit_1 = require("@solana/kit");
@@ -104,6 +104,8 @@ exports.ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = 0x433; // 1075
104
104
  exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED = 0x434; // 1076
105
105
  /** OracleNotExpiredYet: Oracle has not expired yet (cannot update price before expiry) */
106
106
  exports.ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET = 0x435; // 1077
107
+ /** InvalidUnwrapDestination: Unwrap SOL destination does not match position taker */
108
+ exports.ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION = 0x436; // 1078
107
109
  let actaContractErrorMessages;
108
110
  if (process.env.NODE_ENV !== "production") {
109
111
  actaContractErrorMessages = {
@@ -123,6 +125,7 @@ if (process.env.NODE_ENV !== "production") {
123
125
  [exports.ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID]: `Wrong program ID`,
124
126
  [exports.ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT]: `Ed25519 instruction has wrong signature count`,
125
127
  [exports.ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP]: `Clock timestamp invalid`,
128
+ [exports.ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION]: `Unwrap SOL destination does not match position taker`,
126
129
  [exports.ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED]: `Maker PDA already exists`,
127
130
  [exports.ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER]: `Caller is not the maker owner`,
128
131
  [exports.ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED]: `Maker PDA not found`,
@@ -22,10 +22,16 @@ function getSettlePositionDiscriminatorBytes() {
22
22
  return (0, kit_1.getU8Encoder)().encode(exports.SETTLE_POSITION_DISCRIMINATOR);
23
23
  }
24
24
  function getSettlePositionInstructionDataEncoder() {
25
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([["discriminator", (0, kit_1.getU8Encoder)()]]), (value) => ({ ...value, discriminator: exports.SETTLE_POSITION_DISCRIMINATOR }));
25
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
26
+ ["discriminator", (0, kit_1.getU8Encoder)()],
27
+ ["flags", (0, kit_1.getU8Encoder)()],
28
+ ]), (value) => ({ ...value, discriminator: exports.SETTLE_POSITION_DISCRIMINATOR }));
26
29
  }
27
30
  function getSettlePositionInstructionDataDecoder() {
28
- return (0, kit_1.getStructDecoder)([["discriminator", (0, kit_1.getU8Decoder)()]]);
31
+ return (0, kit_1.getStructDecoder)([
32
+ ["discriminator", (0, kit_1.getU8Decoder)()],
33
+ ["flags", (0, kit_1.getU8Decoder)()],
34
+ ]);
29
35
  }
30
36
  function getSettlePositionInstructionDataCodec() {
31
37
  return (0, kit_1.combineCodec)(getSettlePositionInstructionDataEncoder(), getSettlePositionInstructionDataDecoder());
@@ -58,6 +64,8 @@ function getSettlePositionInstruction(input, config) {
58
64
  },
59
65
  };
60
66
  const accounts = originalAccounts;
67
+ // Original args.
68
+ const args = { ...input };
61
69
  const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
62
70
  return Object.freeze({
63
71
  accounts: [
@@ -71,7 +79,7 @@ function getSettlePositionInstruction(input, config) {
71
79
  getAccountMeta(accounts.underlyingTokenProgram),
72
80
  getAccountMeta(accounts.quoteTokenProgram),
73
81
  ],
74
- data: getSettlePositionInstructionDataEncoder().encode({}),
82
+ data: getSettlePositionInstructionDataEncoder().encode(args),
75
83
  programAddress,
76
84
  });
77
85
  }
@@ -751,7 +751,12 @@
751
751
  ]
752
752
  }
753
753
  ],
754
- "args": [],
754
+ "args": [
755
+ {
756
+ "name": "flags",
757
+ "type": "u8"
758
+ }
759
+ ],
755
760
  "discriminant": {
756
761
  "type": "u8",
757
762
  "value": 10
@@ -2317,6 +2322,11 @@
2317
2322
  "code": 1077,
2318
2323
  "name": "OracleNotExpiredYet",
2319
2324
  "msg": "Oracle has not expired yet (cannot update price before expiry)"
2325
+ },
2326
+ {
2327
+ "code": 1078,
2328
+ "name": "InvalidUnwrapDestination",
2329
+ "msg": "Unwrap SOL destination does not match position taker"
2320
2330
  }
2321
2331
  ]
2322
2332
  }
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ACTA_IDL_SHA256 = void 0;
4
- exports.ACTA_IDL_SHA256 = "2ccf0a77f682ff60b8201e2bca7f4bd026500a2fb9637d46dad7a8de3b2ee313";
4
+ exports.ACTA_IDL_SHA256 = "e2fc8ff5fad4cb5691f27082fae3cc004a9116133c6eb64558905dbb946e3b33";
@@ -7,6 +7,9 @@
7
7
  * - Client signs UTF-8 bytes of that text and responds:
8
8
  * `AuthChallenge { challenge, signature: base58(ed25519(utf8(challenge))), pubkey }`
9
9
  *
10
+ * The same `signMessage` primitive is reused for any UTF-8-bytes signing
11
+ * (e.g. `acta:redeem:v1:{pubkey}:{code}` for invite redemption).
12
+ *
10
13
  * Source of truth (server):
11
14
  * - rust-backend/rfq-server/src/server/ws.rs
12
15
  * - rust-backend/rfq-server/src/session/handler.rs
@@ -52,9 +55,9 @@ class KeypairAuthProvider {
52
55
  async getPublicKey() {
53
56
  return this.address;
54
57
  }
55
- async signChallenge(challenge) {
56
- const challengeBytes = utf8ToBytes(challenge);
57
- const signatureBytes = await (0, keys_1.signBytes)(this.privateKey, challengeBytes);
58
+ async signMessage(message) {
59
+ const messageBytes = utf8ToBytes(message);
60
+ const signatureBytes = await (0, keys_1.signBytes)(this.privateKey, messageBytes);
58
61
  return bytesToBase58(signatureBytes);
59
62
  }
60
63
  }
@@ -76,10 +79,10 @@ class WalletAuthProvider {
76
79
  throw new Error("Wallet not connected (missing public key)");
77
80
  return pk;
78
81
  }
79
- async signChallenge(challenge) {
80
- const challengeBytes = utf8ToBytes(challenge);
82
+ async signMessage(message) {
83
+ const messageBytes = utf8ToBytes(message);
81
84
  // Some wallet APIs expect a mutable `Uint8Array`; codecs return `ReadonlyUint8Array`.
82
- const sig = await this.wallet.signMessage(new Uint8Array(challengeBytes));
85
+ const sig = await this.wallet.signMessage(new Uint8Array(messageBytes));
83
86
  return bytesToBase58(sig);
84
87
  }
85
88
  }
@@ -89,16 +92,16 @@ exports.WalletAuthProvider = WalletAuthProvider;
89
92
  */
90
93
  class CustomAuthProvider {
91
94
  getPublicKeyFn;
92
- signChallengeFn;
93
- constructor(getPublicKey, signChallenge) {
95
+ signMessageFn;
96
+ constructor(getPublicKey, signMessage) {
94
97
  this.getPublicKeyFn = getPublicKey;
95
- this.signChallengeFn = signChallenge;
98
+ this.signMessageFn = signMessage;
96
99
  }
97
100
  async getPublicKey() {
98
101
  return this.getPublicKeyFn();
99
102
  }
100
- async signChallenge(challenge) {
101
- return this.signChallengeFn(challenge);
103
+ async signMessage(message) {
104
+ return this.signMessageFn(message);
102
105
  }
103
106
  }
104
107
  exports.CustomAuthProvider = CustomAuthProvider;
@@ -4,6 +4,7 @@ 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
+ const referral_1 = require("./referral");
7
8
  function toGenericServerError(err) {
8
9
  const message = err instanceof Error ? err.message : String(err);
9
10
  return { type: "generic", data: { code: "client_error", message } };
@@ -406,6 +407,51 @@ class ActaWsClient extends TypedEventEmitter {
406
407
  logout() {
407
408
  this.send({ type: "Logout" });
408
409
  }
410
+ // ========================================================================
411
+ // Referral / invite
412
+ // ========================================================================
413
+ /**
414
+ * Redeem an invite code. Authentication is proven by the session;
415
+ * no additional signature is required. Validation runs client-side —
416
+ * invalid inputs throw `ReferralCodeError` without a round-trip.
417
+ */
418
+ redeemInvite(rawCode) {
419
+ this.ensureAuthenticated();
420
+ const parsed = (0, referral_1.parseReferralCode)(rawCode);
421
+ if (!parsed.ok)
422
+ throw new referral_1.ReferralCodeError(parsed.error);
423
+ const requestId = this.nextRequestId();
424
+ this.send({
425
+ type: "RedeemInvite",
426
+ data: { request_id: requestId, code: parsed.code },
427
+ });
428
+ return requestId;
429
+ }
430
+ /**
431
+ * Claim a vanity referral code (one-shot per taker). Validation
432
+ * runs client-side — invalid inputs throw `ReferralCodeError`.
433
+ */
434
+ async claimReferralCode(rawCode) {
435
+ this.ensureAuthenticated();
436
+ const parsed = (0, referral_1.parseReferralCode)(rawCode);
437
+ if (!parsed.ok)
438
+ throw new referral_1.ReferralCodeError(parsed.error);
439
+ const requestId = this.nextRequestId();
440
+ this.send({
441
+ type: "ClaimReferralCode",
442
+ data: { request_id: requestId, code: parsed.code },
443
+ });
444
+ return requestId;
445
+ }
446
+ getMyReferralInfo() {
447
+ this.ensureAuthenticated();
448
+ const requestId = this.nextRequestId();
449
+ this.send({
450
+ type: "GetMyReferralInfo",
451
+ data: { request_id: requestId },
452
+ });
453
+ return requestId;
454
+ }
409
455
  getOrderStatus(orderIdHex) {
410
456
  this.ensureAuthenticated();
411
457
  const requestId = this.nextRequestId();
@@ -450,6 +496,40 @@ class ActaWsClient extends TypedEventEmitter {
450
496
  });
451
497
  this.submitQuote(quote);
452
498
  }
499
+ /**
500
+ * Replace an in-flight quote on the same RFQ. Server treats this as
501
+ * cancel-old + place-new atomically; maker signs the NEW `order_id`.
502
+ */
503
+ submitReplaceQuote(msg) {
504
+ this.ensureAuthenticated();
505
+ this.send({ type: "ReplaceQuote", data: msg });
506
+ }
507
+ /** Convenience: compute new `order_id`, sign it, and send `ReplaceQuote`. */
508
+ async submitReplaceQuoteSigned(args) {
509
+ (0, wirePolicy_1.assertWsU64Safe)(args.strike, "strike");
510
+ (0, wirePolicy_1.assertWsU64Safe)(args.price, "price");
511
+ (0, wirePolicy_1.assertWsU64Safe)(args.validUntil, "validUntil");
512
+ (0, wirePolicy_1.assertWsU64Safe)(args.nonce, "nonce");
513
+ const msg = await (0, flows_1.buildSignedReplaceQuoteMessage)({
514
+ oldOrderId: args.oldOrderId,
515
+ rfqId: args.rfqId,
516
+ strike: args.strike,
517
+ price: args.price,
518
+ validUntil: args.validUntil,
519
+ nonce: args.nonce,
520
+ orderId: args.orderId,
521
+ makerSigner: args.makerSigner,
522
+ });
523
+ this.submitReplaceQuote(msg);
524
+ }
525
+ /**
526
+ * Send multiple signed quotes in one WS frame. Each entry must already be
527
+ * a fully-built `QuoteMessage` (use `buildSignedQuoteMessage` per quote).
528
+ */
529
+ submitBatchQuotes(quotes) {
530
+ this.ensureAuthenticated();
531
+ this.send({ type: "BatchQuotes", data: { quotes } });
532
+ }
453
533
  cancelQuote(rfqId) {
454
534
  this.ensureAuthenticated();
455
535
  const requestId = this.nextRequestId();
@@ -543,6 +623,13 @@ class ActaWsClient extends TypedEventEmitter {
543
623
  this.send({ type: "RemoveChannels", data: { request_id, channels } });
544
624
  return request_id;
545
625
  }
626
+ /** Query the server's view of this session's subscriptions. Response: `subscriptions` event. */
627
+ getSubscriptions() {
628
+ this.ensureAuthenticated();
629
+ const request_id = this.nextRequestId();
630
+ this.send({ type: "GetSubscriptions", data: { request_id } });
631
+ return request_id;
632
+ }
546
633
  ping() {
547
634
  if (this.ws?.readyState === WS_OPEN) {
548
635
  this.send({ type: "Ping" });
@@ -877,6 +964,18 @@ class ActaWsClient extends TypedEventEmitter {
877
964
  this.emit("subscriptionUpdated", d);
878
965
  }
879
966
  break;
967
+ case "RequireInvite":
968
+ this.emit("requireInvite");
969
+ break;
970
+ case "InviteRedeemed":
971
+ this.emit("inviteRedeemed", message.data);
972
+ break;
973
+ case "ReferralCodeClaimed":
974
+ this.emit("referralCodeClaimed", message.data);
975
+ break;
976
+ case "MyReferralInfo":
977
+ this.emit("myReferralInfo", message.data);
978
+ break;
880
979
  }
881
980
  }
882
981
  /** Taker-only: request current indicative prices for a market + position_type. */
@@ -902,7 +1001,7 @@ class ActaWsClient extends TypedEventEmitter {
902
1001
  try {
903
1002
  const [pubkey, signature] = await Promise.all([
904
1003
  this.authProvider.getPublicKey(),
905
- this.authProvider.signChallenge(challenge),
1004
+ this.authProvider.signMessage(challenge),
906
1005
  ]);
907
1006
  this.send({
908
1007
  type: "AuthChallenge",
@@ -53,7 +53,7 @@ function parseClientMessage(payload) {
53
53
  function makeAuthProvider(pubkey = "pubkey", signature = "signature") {
54
54
  return {
55
55
  getPublicKey: jest.fn().mockResolvedValue(pubkey),
56
- signChallenge: jest.fn().mockResolvedValue(signature),
56
+ signMessage: jest.fn().mockResolvedValue(signature),
57
57
  };
58
58
  }
59
59
  function makeHarness(overrides = {}) {
@@ -6,6 +6,7 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.buildSignedQuoteMessage = buildSignedQuoteMessage;
9
+ exports.buildSignedReplaceQuoteMessage = buildSignedReplaceQuoteMessage;
9
10
  exports.buildSignedQuoteFromRfq = buildSignedQuoteFromRfq;
10
11
  exports.buildAcceptQuoteMessage = buildAcceptQuoteMessage;
11
12
  const orders_1 = require("../chain/orders");
@@ -29,6 +30,25 @@ async function buildSignedQuoteMessage(args) {
29
30
  signature: signatureBase58,
30
31
  };
31
32
  }
33
+ async function buildSignedReplaceQuoteMessage(args) {
34
+ (0, wirePolicy_1.assertWsU64Safe)(args.strike, "strike");
35
+ (0, wirePolicy_1.assertWsU64Safe)(args.price, "price");
36
+ (0, wirePolicy_1.assertWsU64Safe)(args.validUntil, "validUntil");
37
+ (0, wirePolicy_1.assertWsU64Safe)(args.nonce, "nonce");
38
+ (0, orderId_1.assertOrderId32)(args.oldOrderId);
39
+ (0, orderId_1.assertOrderId32)(args.orderId);
40
+ const { signatureBase58 } = await (0, orders_1.signOrderIdBase58)(args.makerSigner, args.orderId);
41
+ return {
42
+ old_order_id: (0, orderId_1.orderIdToHex)(args.oldOrderId),
43
+ rfq_id: args.rfqId,
44
+ strike: args.strike,
45
+ price: args.price,
46
+ valid_until: args.validUntil,
47
+ nonce: args.nonce,
48
+ order_id: (0, orderId_1.orderIdToHex)(args.orderId),
49
+ signature: signatureBase58,
50
+ };
51
+ }
32
52
  function positionTypeToU8(positionType) {
33
53
  switch (positionType) {
34
54
  case "covered_call":
@@ -22,3 +22,4 @@ __exportStar(require("./sponsoredTx"), exports);
22
22
  __exportStar(require("./apy"), exports);
23
23
  __exportStar(require("./discovery"), exports);
24
24
  __exportStar(require("./sizing"), exports);
25
+ __exportStar(require("./referral"), exports);
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ /**
3
+ * Referral / invite redemption helpers.
4
+ *
5
+ * Mirrors the server-side validation defined in
6
+ * rust-backend/acta-types/src/invite.rs (ReferralCode::parse).
7
+ * Client-side validation must stay bit-identical to the server on
8
+ * the same input. A hardcoded fixture table is kept here and on the
9
+ * rust side; if either drifts, the cross-impl test will catch it.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReferralCodeError = exports.REFERRAL_CODE_MAX_LEN = exports.REFERRAL_CODE_MIN_LEN = void 0;
13
+ exports.normalizeReferralCode = normalizeReferralCode;
14
+ exports.parseReferralCode = parseReferralCode;
15
+ exports.REFERRAL_CODE_MIN_LEN = 4;
16
+ exports.REFERRAL_CODE_MAX_LEN = 16;
17
+ class ReferralCodeError extends Error {
18
+ detail;
19
+ constructor(detail) {
20
+ super(detail.kind === "length"
21
+ ? `code length must be between ${detail.min} and ${detail.max}`
22
+ : "code must contain only ASCII letters and digits");
23
+ this.detail = detail;
24
+ this.name = "ReferralCodeError";
25
+ }
26
+ }
27
+ exports.ReferralCodeError = ReferralCodeError;
28
+ /**
29
+ * Trim + ASCII uppercase. No length or charset check. Useful for
30
+ * showing a live preview as the user types.
31
+ */
32
+ function normalizeReferralCode(input) {
33
+ return input.trim().toUpperCase();
34
+ }
35
+ /**
36
+ * Parse + validate + normalize a user-supplied referral code.
37
+ * Mirrors `ReferralCode::parse` on the server. A successful result
38
+ * carries the canonical branded `ReferralCode`.
39
+ */
40
+ function parseReferralCode(input) {
41
+ const normalized = normalizeReferralCode(input);
42
+ if (normalized.length < exports.REFERRAL_CODE_MIN_LEN ||
43
+ normalized.length > exports.REFERRAL_CODE_MAX_LEN) {
44
+ return {
45
+ ok: false,
46
+ error: {
47
+ kind: "length",
48
+ min: exports.REFERRAL_CODE_MIN_LEN,
49
+ max: exports.REFERRAL_CODE_MAX_LEN,
50
+ },
51
+ };
52
+ }
53
+ if (!/^[A-Z0-9]+$/.test(normalized)) {
54
+ return { ok: false, error: { kind: "charset" } };
55
+ }
56
+ return { ok: true, code: normalized };
57
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const referral_1 = require("./referral");
4
+ // =============================================================================
5
+ // Cross-impl fixture.
6
+ //
7
+ // Bit-for-bit identical to the fixture in
8
+ // rust-backend/acta-types/src/invite.rs::tests
9
+ // If either side changes, update both.
10
+ // =============================================================================
11
+ const ACCEPT_FIXTURES = [
12
+ ["NIKITA", "NIKITA"],
13
+ ["nikita", "NIKITA"],
14
+ [" abc1 ", "ABC1"],
15
+ ["ABCD", "ABCD"],
16
+ ["1234567890ABCDEF", "1234567890ABCDEF"],
17
+ ];
18
+ describe("parseReferralCode", () => {
19
+ test.each(ACCEPT_FIXTURES)("accepts %j → %j", (input, expected) => {
20
+ const res = (0, referral_1.parseReferralCode)(input);
21
+ expect(res.ok).toBe(true);
22
+ if (res.ok)
23
+ expect(res.code).toBe(expected);
24
+ });
25
+ test("rejects too short", () => {
26
+ const res = (0, referral_1.parseReferralCode)("abc");
27
+ expect(res.ok).toBe(false);
28
+ if (!res.ok)
29
+ expect(res.error.kind).toBe("length");
30
+ });
31
+ test("rejects too long", () => {
32
+ const res = (0, referral_1.parseReferralCode)("A".repeat(17));
33
+ expect(res.ok).toBe(false);
34
+ if (!res.ok)
35
+ expect(res.error.kind).toBe("length");
36
+ });
37
+ test("rejects non-ascii", () => {
38
+ const res = (0, referral_1.parseReferralCode)("абвгд");
39
+ expect(res.ok).toBe(false);
40
+ // Cyrillic passes length but fails charset.
41
+ if (!res.ok)
42
+ expect(res.error.kind).toBe("charset");
43
+ });
44
+ test("rejects punctuation", () => {
45
+ const res = (0, referral_1.parseReferralCode)("ABC-12");
46
+ expect(res.ok).toBe(false);
47
+ if (!res.ok)
48
+ expect(res.error.kind).toBe("charset");
49
+ });
50
+ });
51
+ describe("normalizeReferralCode", () => {
52
+ test("trims and uppercases", () => {
53
+ expect((0, referral_1.normalizeReferralCode)(" nikita ")).toBe("NIKITA");
54
+ });
55
+ });
@@ -98,7 +98,9 @@ export declare const ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = 1075;
98
98
  export declare const ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED = 1076;
99
99
  /** OracleNotExpiredYet: Oracle has not expired yet (cannot update price before expiry) */
100
100
  export declare const ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET = 1077;
101
- export type ActaContractError = typeof ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED | typeof ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED | typeof ACTA_CONTRACT_ERROR__CANNOT_LIQUIDATE_FUNDED | typeof ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE | typeof ACTA_CONTRACT_ERROR__INVALID_ORDER_ID | typeof ACTA_CONTRACT_ERROR__INVALID_OWNER | typeof ACTA_CONTRACT_ERROR__INVALID_PDA | typeof ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID | typeof ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP | typeof ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED | typeof ACTA_CONTRACT_ERROR__MARKET_EXPIRED | typeof ACTA_CONTRACT_ERROR__MARKET_FINALIZED | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED | typeof ACTA_CONTRACT_ERROR__MATH_OVERFLOW | typeof ACTA_CONTRACT_ERROR__MINT_MISMATCH | typeof ACTA_CONTRACT_ERROR__NOT_SIGNED | typeof ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED | typeof ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY | typeof ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH | typeof ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS | typeof ACTA_CONTRACT_ERROR__ORACLE_INACTIVE | typeof ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE | typeof ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET | typeof ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED | typeof ACTA_CONTRACT_ERROR__ORACLE_STALE | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_ITM | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNER_MISMATCH | typeof ACTA_CONTRACT_ERROR__UNAUTHORIZED;
101
+ /** InvalidUnwrapDestination: Unwrap SOL destination does not match position taker */
102
+ export declare const ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION = 1078;
103
+ export type ActaContractError = typeof ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED | typeof ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED | typeof ACTA_CONTRACT_ERROR__CANNOT_LIQUIDATE_FUNDED | typeof ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE | typeof ACTA_CONTRACT_ERROR__INVALID_ORDER_ID | typeof ACTA_CONTRACT_ERROR__INVALID_OWNER | typeof ACTA_CONTRACT_ERROR__INVALID_PDA | typeof ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID | typeof ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP | typeof ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION | typeof ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED | typeof ACTA_CONTRACT_ERROR__MARKET_EXPIRED | typeof ACTA_CONTRACT_ERROR__MARKET_FINALIZED | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED | typeof ACTA_CONTRACT_ERROR__MATH_OVERFLOW | typeof ACTA_CONTRACT_ERROR__MINT_MISMATCH | typeof ACTA_CONTRACT_ERROR__NOT_SIGNED | typeof ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED | typeof ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY | typeof ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH | typeof ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS | typeof ACTA_CONTRACT_ERROR__ORACLE_INACTIVE | typeof ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE | typeof ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET | typeof ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED | typeof ACTA_CONTRACT_ERROR__ORACLE_STALE | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_ITM | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNER_MISMATCH | typeof ACTA_CONTRACT_ERROR__UNAUTHORIZED;
102
104
  export declare function getActaContractErrorMessage(code: ActaContractError): string;
103
105
  export declare function isActaContractError<TProgramErrorCode extends ActaContractError>(error: unknown, transactionMessage: {
104
106
  instructions: Record<number, {
@@ -99,6 +99,8 @@ export const ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = 0x433; // 1075
99
99
  export const ACTA_CONTRACT_ERROR__MARKET_NOT_EXPIRED = 0x434; // 1076
100
100
  /** OracleNotExpiredYet: Oracle has not expired yet (cannot update price before expiry) */
101
101
  export const ACTA_CONTRACT_ERROR__ORACLE_NOT_EXPIRED_YET = 0x435; // 1077
102
+ /** InvalidUnwrapDestination: Unwrap SOL destination does not match position taker */
103
+ export const ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION = 0x436; // 1078
102
104
  let actaContractErrorMessages;
103
105
  if (process.env.NODE_ENV !== "production") {
104
106
  actaContractErrorMessages = {
@@ -118,6 +120,7 @@ if (process.env.NODE_ENV !== "production") {
118
120
  [ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID]: `Wrong program ID`,
119
121
  [ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT]: `Ed25519 instruction has wrong signature count`,
120
122
  [ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP]: `Clock timestamp invalid`,
123
+ [ACTA_CONTRACT_ERROR__INVALID_UNWRAP_DESTINATION]: `Unwrap SOL destination does not match position taker`,
121
124
  [ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED]: `Maker PDA already exists`,
122
125
  [ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER]: `Caller is not the maker owner`,
123
126
  [ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED]: `Maker PDA not found`,
@@ -23,8 +23,11 @@ export type SettlePositionInstruction<TProgram extends string = typeof ACTA_CONT
23
23
  ]>;
24
24
  export type SettlePositionInstructionData = {
25
25
  discriminator: number;
26
+ flags: number;
27
+ };
28
+ export type SettlePositionInstructionDataArgs = {
29
+ flags: number;
26
30
  };
27
- export type SettlePositionInstructionDataArgs = {};
28
31
  export declare function getSettlePositionInstructionDataEncoder(): FixedSizeEncoder<SettlePositionInstructionDataArgs>;
29
32
  export declare function getSettlePositionInstructionDataDecoder(): FixedSizeDecoder<SettlePositionInstructionData>;
30
33
  export declare function getSettlePositionInstructionDataCodec(): FixedSizeCodec<SettlePositionInstructionDataArgs, SettlePositionInstructionData>;
@@ -47,6 +50,7 @@ export type SettlePositionInput<TAccountSettler extends string = string, TAccoun
47
50
  underlyingTokenProgram: Address<TAccountUnderlyingTokenProgram>;
48
51
  /** Token program for quote mint */
49
52
  quoteTokenProgram: Address<TAccountQuoteTokenProgram>;
53
+ flags: SettlePositionInstructionDataArgs["flags"];
50
54
  };
51
55
  export declare function getSettlePositionInstruction<TAccountSettler extends string, TAccountPositionPda extends string, TAccountMarketPda extends string, TAccountPosCollateralAta extends string, TAccountPosSettlementAta extends string, TAccountUserDestAta extends string, TAccountMakerDestAta extends string, TAccountUnderlyingTokenProgram extends string, TAccountQuoteTokenProgram extends string, TProgramAddress extends Address = typeof ACTA_CONTRACT_PROGRAM_ADDRESS>(input: SettlePositionInput<TAccountSettler, TAccountPositionPda, TAccountMarketPda, TAccountPosCollateralAta, TAccountPosSettlementAta, TAccountUserDestAta, TAccountMakerDestAta, TAccountUnderlyingTokenProgram, TAccountQuoteTokenProgram>, config?: {
52
56
  programAddress?: TProgramAddress;
@@ -13,10 +13,16 @@ export function getSettlePositionDiscriminatorBytes() {
13
13
  return getU8Encoder().encode(SETTLE_POSITION_DISCRIMINATOR);
14
14
  }
15
15
  export function getSettlePositionInstructionDataEncoder() {
16
- return transformEncoder(getStructEncoder([["discriminator", getU8Encoder()]]), (value) => ({ ...value, discriminator: SETTLE_POSITION_DISCRIMINATOR }));
16
+ return transformEncoder(getStructEncoder([
17
+ ["discriminator", getU8Encoder()],
18
+ ["flags", getU8Encoder()],
19
+ ]), (value) => ({ ...value, discriminator: SETTLE_POSITION_DISCRIMINATOR }));
17
20
  }
18
21
  export function getSettlePositionInstructionDataDecoder() {
19
- return getStructDecoder([["discriminator", getU8Decoder()]]);
22
+ return getStructDecoder([
23
+ ["discriminator", getU8Decoder()],
24
+ ["flags", getU8Decoder()],
25
+ ]);
20
26
  }
21
27
  export function getSettlePositionInstructionDataCodec() {
22
28
  return combineCodec(getSettlePositionInstructionDataEncoder(), getSettlePositionInstructionDataDecoder());
@@ -49,6 +55,8 @@ export function getSettlePositionInstruction(input, config) {
49
55
  },
50
56
  };
51
57
  const accounts = originalAccounts;
58
+ // Original args.
59
+ const args = { ...input };
52
60
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
53
61
  return Object.freeze({
54
62
  accounts: [
@@ -62,7 +70,7 @@ export function getSettlePositionInstruction(input, config) {
62
70
  getAccountMeta(accounts.underlyingTokenProgram),
63
71
  getAccountMeta(accounts.quoteTokenProgram),
64
72
  ],
65
- data: getSettlePositionInstructionDataEncoder().encode({}),
73
+ data: getSettlePositionInstructionDataEncoder().encode(args),
66
74
  programAddress,
67
75
  });
68
76
  }
@@ -751,7 +751,12 @@
751
751
  ]
752
752
  }
753
753
  ],
754
- "args": [],
754
+ "args": [
755
+ {
756
+ "name": "flags",
757
+ "type": "u8"
758
+ }
759
+ ],
755
760
  "discriminant": {
756
761
  "type": "u8",
757
762
  "value": 10
@@ -2317,6 +2322,11 @@
2317
2322
  "code": 1077,
2318
2323
  "name": "OracleNotExpiredYet",
2319
2324
  "msg": "Oracle has not expired yet (cannot update price before expiry)"
2325
+ },
2326
+ {
2327
+ "code": 1078,
2328
+ "name": "InvalidUnwrapDestination",
2329
+ "msg": "Unwrap SOL destination does not match position taker"
2320
2330
  }
2321
2331
  ]
2322
2332
  }
@@ -1 +1 @@
1
- export declare const ACTA_IDL_SHA256 = "2ccf0a77f682ff60b8201e2bca7f4bd026500a2fb9637d46dad7a8de3b2ee313";
1
+ export declare const ACTA_IDL_SHA256 = "e2fc8ff5fad4cb5691f27082fae3cc004a9116133c6eb64558905dbb946e3b33";
package/dist/idl/hash.js CHANGED
@@ -1 +1 @@
1
- export const ACTA_IDL_SHA256 = "2ccf0a77f682ff60b8201e2bca7f4bd026500a2fb9637d46dad7a8de3b2ee313";
1
+ export const ACTA_IDL_SHA256 = "e2fc8ff5fad4cb5691f27082fae3cc004a9116133c6eb64558905dbb946e3b33";