aftermath-ts-sdk 2.3.0-dev.ae28999 → 2.3.0-dev.c42d7d2

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/index.d.ts CHANGED
@@ -1547,16 +1547,20 @@ interface ApiNftAmmWithdrawBody {
1547
1547
  * that debits the specified wallet's gas pool.
1548
1548
  */
1549
1549
  interface PerpetualsSponsorConfig {
1550
- /** Wallet address to use for gas pool sponsorship. */
1550
+ /**
1551
+ * Wallet address to use for gas pool sponsorship. Must be the connected
1552
+ * wallet: af-fe now verifies the sponsor and refuses a request naming any
1553
+ * other address with error 2034 before it reaches the pool.
1554
+ */
1551
1555
  walletAddress: SuiAddress;
1552
1556
  /**
1553
- * Base64 of the JSON `{"action":"SPONSOR_GAS","date":<unix seconds>}` signed
1554
- * by `walletAddress`. Proves who is asking, not what for; the gas pool won't
1555
- * hand out a sponsorship without it. Reusable for a day either side of
1556
- * `date`, so sign once, cache it, and send it with every sponsored tx.
1557
+ * Base64 UTF-8 bytes of the Terms and Conditions message (see
1558
+ * `UserData.createTermsAndConditionsMessage`), signed once by `walletAddress`
1559
+ * and cached for the session. Sending this cached signature is all the gas
1560
+ * pool needs; it replaces the old per-tx `SPONSOR_GAS` payload.
1557
1561
  */
1558
1562
  bytes?: string;
1559
- /** `walletAddress`'s signature over `bytes`. */
1563
+ /** `walletAddress`'s signature over `bytes` (the cached T&C signature). */
1560
1564
  signature?: string;
1561
1565
  }
1562
1566
  /**
@@ -6414,6 +6418,11 @@ interface ApiReferralsCreateReferralLinkBody {
6414
6418
  * The signature of the message signed by the user's wallet. Required for authentication.
6415
6419
  */
6416
6420
  signature: string;
6421
+ /**
6422
+ * The referral code to create. The signed message no longer carries it, so
6423
+ * it travels in the body.
6424
+ */
6425
+ refCode: string;
6417
6426
  }
6418
6427
  interface ApiReferralsCreateReferralLinkResponse {
6419
6428
  /**
@@ -6446,6 +6455,11 @@ interface ApiReferralsSetReferrerBody {
6446
6455
  * The signature of the message signed by the referee's wallet. Required for authentication.
6447
6456
  */
6448
6457
  signature: string;
6458
+ /**
6459
+ * The referral code to link the referee to. Required: the signed message no
6460
+ * longer carries it, so it must travel in the body.
6461
+ */
6462
+ refCode: string;
6449
6463
  }
6450
6464
  interface ApiReferralsSetReferrerResponse {
6451
6465
  /**
@@ -13421,6 +13435,11 @@ interface ApiDcaTransactionForCloseOrderBody {
13421
13435
  * The user's signature corresponding to `bytes`.
13422
13436
  */
13423
13437
  signature: string;
13438
+ /**
13439
+ * The order object IDs to cancel. Required: the signed message no longer
13440
+ * carries them, so they must travel in the body.
13441
+ */
13442
+ orderObjectIds: string[];
13424
13443
  }
13425
13444
  /**
13426
13445
  * Enumerates reasons that a DCA trade might fail, e.g., the price was out of bounds
@@ -13745,15 +13764,11 @@ declare class Dca extends Caller {
13745
13764
  * The user can sign this message (converted to bytes) locally, then submit the signature to
13746
13765
  * `closeDcaOrder`.
13747
13766
  *
13767
+ * @deprecated af-fe no longer accepts this per-action message. Sign
13768
+ * `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
13769
+ * `closeDcaOrder` body instead.
13748
13770
  * @param inputs - An object containing `orderIds`, an array of order object IDs to cancel.
13749
13771
  * @returns An object with `action: "CANCEL_DCA_ORDERS"` and the `order_object_ids`.
13750
- *
13751
- * @example
13752
- * ```typescript
13753
- * const msg = dca.closeDcaOrdersMessageToSign({ orderIds: ["0x<order1>", "0x<order2>"] });
13754
- * console.log(msg);
13755
- * // sign this as JSON or string-encode, then pass to closeDcaOrder
13756
- * ```
13757
13772
  */
13758
13773
  closeDcaOrdersMessageToSign(inputs: {
13759
13774
  orderIds: ObjectId[];
@@ -13873,6 +13888,11 @@ interface ApiLimitOrdersCancelOrderTransactionBody {
13873
13888
  * The signature over those bytes, verifying user intent.
13874
13889
  */
13875
13890
  signature: string;
13891
+ /**
13892
+ * The order object IDs to cancel. Required: the signed message no longer
13893
+ * carries them, so they must travel in the body.
13894
+ */
13895
+ orderObjectIds: string[];
13876
13896
  }
13877
13897
  /**
13878
13898
  * Enumerates all possible statuses for a limit order on Aftermath.
@@ -14073,16 +14093,11 @@ declare class LimitOrders extends Caller {
14073
14093
  * signs this message (converted to bytes), and the resulting signature is passed
14074
14094
  * to `cancelLimitOrder`.
14075
14095
  *
14096
+ * @deprecated af-fe no longer accepts this per-action message. Sign
14097
+ * `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
14098
+ * `cancelLimitOrder` body instead.
14076
14099
  * @param inputs - Object with `orderIds`, an array of order object IDs to cancel.
14077
14100
  * @returns A JSON structure with the action and order IDs to be canceled.
14078
- *
14079
- * @example
14080
- * ```typescript
14081
- * const msg = limitOrders.cancelLimitOrdersMessageToSign({
14082
- * orderIds: ["0x<order1>", "0x<order2>"]
14083
- * });
14084
- * // user signs this JSON
14085
- * ```
14086
14101
  */
14087
14102
  cancelLimitOrdersMessageToSign(inputs: {
14088
14103
  orderIds: ObjectId[];
@@ -14179,6 +14194,11 @@ declare class Referrals extends Caller {
14179
14194
  isRefCodeTaken(inputs: ApiReferralsIsRefCodeTakenBody): Promise<ApiReferralsIsRefCodeTakenResponse>;
14180
14195
  createReferralLink(inputs: ApiReferralsCreateReferralLinkBody): Promise<ApiReferralsCreateReferralLinkResponse>;
14181
14196
  setReferrer(inputs: ApiReferralsSetReferrerBody): Promise<ApiReferralsSetReferrerResponse>;
14197
+ /**
14198
+ * @deprecated af-fe no longer accepts this per-action message. Sign
14199
+ * `UserData.createTermsAndConditionsMessage` and pass `refCode` in the
14200
+ * `createReferralLink` body instead.
14201
+ */
14182
14202
  createReferralLinkMessageToSign(inputs: {
14183
14203
  refCode: string;
14184
14204
  }): {
@@ -14186,6 +14206,11 @@ declare class Referrals extends Caller {
14186
14206
  ref_code: string;
14187
14207
  date: number;
14188
14208
  };
14209
+ /**
14210
+ * @deprecated af-fe no longer accepts this per-action message. Sign
14211
+ * `UserData.createTermsAndConditionsMessage` and pass `refCode` in the
14212
+ * `setReferrer` body instead.
14213
+ */
14189
14214
  setReferrerMessageToSign(inputs: {
14190
14215
  refCode: string;
14191
14216
  }): {
@@ -14313,19 +14338,38 @@ declare class UserData extends Caller {
14313
14338
  action: string;
14314
14339
  };
14315
14340
  /**
14316
- * Generates a simple message object that the user should sign to confirm their agreement
14317
- * with the Terms and Conditions of the service.
14341
+ * The single message every wallet signs once per session to prove ownership.
14342
+ * af-fe decodes the personal-message bytes and compares this text byte for
14343
+ * byte, so it must stay exactly this string: no JSON wrapper, action, date,
14344
+ * or trailing whitespace.
14345
+ */
14346
+ static readonly termsAndConditionsMessage = "Aftermath Terms and Conditions";
14347
+ /**
14348
+ * Returns the canonical Terms and Conditions message to sign. Sign it as a
14349
+ * personal message over its UTF-8 bytes and reuse the signature for the whole
14350
+ * session: it is the one credential af-fe verifies for referrals, rewards,
14351
+ * stop/twap order datas, collateral/order history, the websocket `user`
14352
+ * subscription, and gas-pool sponsorship.
14318
14353
  *
14319
- * @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
14354
+ * @returns The exact string to sign.
14320
14355
  *
14321
14356
  * @example
14322
14357
  * ```typescript
14323
- * const userData = new UserData();
14324
- * const termsMsg = userData.createSignTermsAndConditionsMessageToSign();
14325
- * console.log(termsMsg.action); // "SIGN_TERMS_AND_CONDITIONS"
14326
- * // The user can sign this to show acceptance of the T&C.
14358
+ * const message = new UserData().createTermsAndConditionsMessage();
14359
+ * const { bytes, signature } = await signPersonalMessage(
14360
+ * new TextEncoder().encode(message)
14361
+ * );
14327
14362
  * ```
14328
14363
  */
14364
+ createTermsAndConditionsMessage(): string;
14365
+ /**
14366
+ * Generates a simple message object that the user should sign to confirm their agreement
14367
+ * with the Terms and Conditions of the service.
14368
+ *
14369
+ * @deprecated af-fe no longer accepts the `{action:...}` wrapper and rejects
14370
+ * it with error 2034. Sign {@link createTermsAndConditionsMessage} instead.
14371
+ * @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
14372
+ */
14329
14373
  createSignTermsAndConditionsMessageToSign(): {
14330
14374
  action: string;
14331
14375
  };
package/dist/index.js CHANGED
@@ -15198,15 +15198,11 @@ var init_dca = __esm({
15198
15198
  * The user can sign this message (converted to bytes) locally, then submit the signature to
15199
15199
  * `closeDcaOrder`.
15200
15200
  *
15201
+ * @deprecated af-fe no longer accepts this per-action message. Sign
15202
+ * `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
15203
+ * `closeDcaOrder` body instead.
15201
15204
  * @param inputs - An object containing `orderIds`, an array of order object IDs to cancel.
15202
15205
  * @returns An object with `action: "CANCEL_DCA_ORDERS"` and the `order_object_ids`.
15203
- *
15204
- * @example
15205
- * ```typescript
15206
- * const msg = dca.closeDcaOrdersMessageToSign({ orderIds: ["0x<order1>", "0x<order2>"] });
15207
- * console.log(msg);
15208
- * // sign this as JSON or string-encode, then pass to closeDcaOrder
15209
- * ```
15210
15206
  */
15211
15207
  closeDcaOrdersMessageToSign(inputs) {
15212
15208
  return {
@@ -15390,16 +15386,11 @@ var init_limitOrders = __esm({
15390
15386
  * signs this message (converted to bytes), and the resulting signature is passed
15391
15387
  * to `cancelLimitOrder`.
15392
15388
  *
15389
+ * @deprecated af-fe no longer accepts this per-action message. Sign
15390
+ * `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
15391
+ * `cancelLimitOrder` body instead.
15393
15392
  * @param inputs - Object with `orderIds`, an array of order object IDs to cancel.
15394
15393
  * @returns A JSON structure with the action and order IDs to be canceled.
15395
- *
15396
- * @example
15397
- * ```typescript
15398
- * const msg = limitOrders.cancelLimitOrdersMessageToSign({
15399
- * orderIds: ["0x<order1>", "0x<order2>"]
15400
- * });
15401
- * // user signs this JSON
15402
- * ```
15403
15394
  */
15404
15395
  cancelLimitOrdersMessageToSign(inputs) {
15405
15396
  return {
@@ -15566,6 +15557,11 @@ var init_referrals = __esm({
15566
15557
  // date: Date.now(),
15567
15558
  // };
15568
15559
  // }
15560
+ /**
15561
+ * @deprecated af-fe no longer accepts this per-action message. Sign
15562
+ * `UserData.createTermsAndConditionsMessage` and pass `refCode` in the
15563
+ * `createReferralLink` body instead.
15564
+ */
15569
15565
  createReferralLinkMessageToSign(inputs) {
15570
15566
  return {
15571
15567
  action: "CREATE_REFERRAL",
@@ -15573,6 +15569,11 @@ var init_referrals = __esm({
15573
15569
  date: Math.round(Date.now() / 1e3)
15574
15570
  };
15575
15571
  }
15572
+ /**
15573
+ * @deprecated af-fe no longer accepts this per-action message. Sign
15574
+ * `UserData.createTermsAndConditionsMessage` and pass `refCode` in the
15575
+ * `setReferrer` body instead.
15576
+ */
15576
15577
  setReferrerMessageToSign(inputs) {
15577
15578
  return {
15578
15579
  action: "LINK_REFERRAL",
@@ -15649,12 +15650,12 @@ var init_rewards = __esm({
15649
15650
  });
15650
15651
 
15651
15652
  // src/packages/userData/userData.ts
15652
- var UserData;
15653
+ var _UserData, UserData;
15653
15654
  var init_userData = __esm({
15654
15655
  "src/packages/userData/userData.ts"() {
15655
15656
  "use strict";
15656
15657
  init_caller();
15657
- UserData = class extends Caller {
15658
+ _UserData = class _UserData extends Caller {
15658
15659
  // =========================================================================
15659
15660
  // Constructor
15660
15661
  // =========================================================================
@@ -15736,25 +15737,47 @@ var init_userData = __esm({
15736
15737
  };
15737
15738
  }
15738
15739
  /**
15739
- * Generates a simple message object that the user should sign to confirm their agreement
15740
- * with the Terms and Conditions of the service.
15740
+ * Returns the canonical Terms and Conditions message to sign. Sign it as a
15741
+ * personal message over its UTF-8 bytes and reuse the signature for the whole
15742
+ * session: it is the one credential af-fe verifies for referrals, rewards,
15743
+ * stop/twap order datas, collateral/order history, the websocket `user`
15744
+ * subscription, and gas-pool sponsorship.
15741
15745
  *
15742
- * @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
15746
+ * @returns The exact string to sign.
15743
15747
  *
15744
15748
  * @example
15745
15749
  * ```typescript
15746
- * const userData = new UserData();
15747
- * const termsMsg = userData.createSignTermsAndConditionsMessageToSign();
15748
- * console.log(termsMsg.action); // "SIGN_TERMS_AND_CONDITIONS"
15749
- * // The user can sign this to show acceptance of the T&C.
15750
+ * const message = new UserData().createTermsAndConditionsMessage();
15751
+ * const { bytes, signature } = await signPersonalMessage(
15752
+ * new TextEncoder().encode(message)
15753
+ * );
15750
15754
  * ```
15751
15755
  */
15756
+ createTermsAndConditionsMessage() {
15757
+ return _UserData.termsAndConditionsMessage;
15758
+ }
15759
+ /**
15760
+ * Generates a simple message object that the user should sign to confirm their agreement
15761
+ * with the Terms and Conditions of the service.
15762
+ *
15763
+ * @deprecated af-fe no longer accepts the `{action:...}` wrapper and rejects
15764
+ * it with error 2034. Sign {@link createTermsAndConditionsMessage} instead.
15765
+ * @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
15766
+ */
15752
15767
  createSignTermsAndConditionsMessageToSign() {
15753
15768
  return {
15754
15769
  action: "SIGN_TERMS_AND_CONDITIONS"
15755
15770
  };
15756
15771
  }
15757
15772
  };
15773
+ /**
15774
+ * The single message every wallet signs once per session to prove ownership.
15775
+ * af-fe decodes the personal-message bytes and compares this text byte for
15776
+ * byte, so it must stay exactly this string: no JSON wrapper, action, date,
15777
+ * or trailing whitespace.
15778
+ */
15779
+ _UserData.termsAndConditionsMessage = "Aftermath Terms and Conditions";
15780
+ UserData = _UserData;
15758
15781
  }
15759
15782
  });
15760
15783