aftermath-ts-sdk 2.3.0-dev.719b327 → 2.3.0
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 +28 -75
- package/dist/index.js +24 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1547,20 +1547,16 @@ interface ApiNftAmmWithdrawBody {
|
|
|
1547
1547
|
* that debits the specified wallet's gas pool.
|
|
1548
1548
|
*/
|
|
1549
1549
|
interface PerpetualsSponsorConfig {
|
|
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 (AFX-382).
|
|
1554
|
-
*/
|
|
1550
|
+
/** Wallet address to use for gas pool sponsorship. */
|
|
1555
1551
|
walletAddress: SuiAddress;
|
|
1556
1552
|
/**
|
|
1557
|
-
* Base64
|
|
1558
|
-
* `
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
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.
|
|
1561
1557
|
*/
|
|
1562
1558
|
bytes?: string;
|
|
1563
|
-
/** `walletAddress`'s signature over `bytes
|
|
1559
|
+
/** `walletAddress`'s signature over `bytes`. */
|
|
1564
1560
|
signature?: string;
|
|
1565
1561
|
}
|
|
1566
1562
|
/**
|
|
@@ -6418,13 +6414,6 @@ interface ApiReferralsCreateReferralLinkBody {
|
|
|
6418
6414
|
* The signature of the message signed by the user's wallet. Required for authentication.
|
|
6419
6415
|
*/
|
|
6420
6416
|
signature: string;
|
|
6421
|
-
/**
|
|
6422
|
-
* Desired referral code. Optional: when omitted the service defaults to
|
|
6423
|
-
* `ref_{walletAddress}`. The signed message no longer carries it, so it must
|
|
6424
|
-
* travel in the body (AFX-382). Note the default exceeds the 32-character
|
|
6425
|
-
* limit, so callers should always send an explicit `refCode`.
|
|
6426
|
-
*/
|
|
6427
|
-
refCode?: string;
|
|
6428
6417
|
}
|
|
6429
6418
|
interface ApiReferralsCreateReferralLinkResponse {
|
|
6430
6419
|
/**
|
|
@@ -6457,11 +6446,6 @@ interface ApiReferralsSetReferrerBody {
|
|
|
6457
6446
|
* The signature of the message signed by the referee's wallet. Required for authentication.
|
|
6458
6447
|
*/
|
|
6459
6448
|
signature: string;
|
|
6460
|
-
/**
|
|
6461
|
-
* The referral code to link the referee to. Required: the signed message no
|
|
6462
|
-
* longer carries it, so it must travel in the body (AFX-382).
|
|
6463
|
-
*/
|
|
6464
|
-
refCode: string;
|
|
6465
6449
|
}
|
|
6466
6450
|
interface ApiReferralsSetReferrerResponse {
|
|
6467
6451
|
/**
|
|
@@ -13437,11 +13421,6 @@ interface ApiDcaTransactionForCloseOrderBody {
|
|
|
13437
13421
|
* The user's signature corresponding to `bytes`.
|
|
13438
13422
|
*/
|
|
13439
13423
|
signature: string;
|
|
13440
|
-
/**
|
|
13441
|
-
* The order object IDs to cancel. Required: the signed message no longer
|
|
13442
|
-
* carries them, so they must travel in the body (AFX-382).
|
|
13443
|
-
*/
|
|
13444
|
-
orderObjectIds: string[];
|
|
13445
13424
|
}
|
|
13446
13425
|
/**
|
|
13447
13426
|
* Enumerates reasons that a DCA trade might fail, e.g., the price was out of bounds
|
|
@@ -13766,11 +13745,15 @@ declare class Dca extends Caller {
|
|
|
13766
13745
|
* The user can sign this message (converted to bytes) locally, then submit the signature to
|
|
13767
13746
|
* `closeDcaOrder`.
|
|
13768
13747
|
*
|
|
13769
|
-
* @deprecated af-fe no longer accepts this per-action message. Sign
|
|
13770
|
-
* `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
|
|
13771
|
-
* `closeDcaOrder` body instead (AFX-382).
|
|
13772
13748
|
* @param inputs - An object containing `orderIds`, an array of order object IDs to cancel.
|
|
13773
13749
|
* @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
|
+
* ```
|
|
13774
13757
|
*/
|
|
13775
13758
|
closeDcaOrdersMessageToSign(inputs: {
|
|
13776
13759
|
orderIds: ObjectId[];
|
|
@@ -13890,11 +13873,6 @@ interface ApiLimitOrdersCancelOrderTransactionBody {
|
|
|
13890
13873
|
* The signature over those bytes, verifying user intent.
|
|
13891
13874
|
*/
|
|
13892
13875
|
signature: string;
|
|
13893
|
-
/**
|
|
13894
|
-
* The order object IDs to cancel. Required: the signed message no longer
|
|
13895
|
-
* carries them, so they must travel in the body (AFX-382).
|
|
13896
|
-
*/
|
|
13897
|
-
orderObjectIds: string[];
|
|
13898
13876
|
}
|
|
13899
13877
|
/**
|
|
13900
13878
|
* Enumerates all possible statuses for a limit order on Aftermath.
|
|
@@ -14095,11 +14073,16 @@ declare class LimitOrders extends Caller {
|
|
|
14095
14073
|
* signs this message (converted to bytes), and the resulting signature is passed
|
|
14096
14074
|
* to `cancelLimitOrder`.
|
|
14097
14075
|
*
|
|
14098
|
-
* @deprecated af-fe no longer accepts this per-action message. Sign
|
|
14099
|
-
* `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
|
|
14100
|
-
* `cancelLimitOrder` body instead (AFX-382).
|
|
14101
14076
|
* @param inputs - Object with `orderIds`, an array of order object IDs to cancel.
|
|
14102
14077
|
* @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
|
+
* ```
|
|
14103
14086
|
*/
|
|
14104
14087
|
cancelLimitOrdersMessageToSign(inputs: {
|
|
14105
14088
|
orderIds: ObjectId[];
|
|
@@ -14196,11 +14179,6 @@ declare class Referrals extends Caller {
|
|
|
14196
14179
|
isRefCodeTaken(inputs: ApiReferralsIsRefCodeTakenBody): Promise<ApiReferralsIsRefCodeTakenResponse>;
|
|
14197
14180
|
createReferralLink(inputs: ApiReferralsCreateReferralLinkBody): Promise<ApiReferralsCreateReferralLinkResponse>;
|
|
14198
14181
|
setReferrer(inputs: ApiReferralsSetReferrerBody): Promise<ApiReferralsSetReferrerResponse>;
|
|
14199
|
-
/**
|
|
14200
|
-
* @deprecated af-fe no longer accepts this per-action message. Sign
|
|
14201
|
-
* `UserData.createTermsAndConditionsMessage` and pass `refCode` in the
|
|
14202
|
-
* `createReferralLink` body instead (AFX-382).
|
|
14203
|
-
*/
|
|
14204
14182
|
createReferralLinkMessageToSign(inputs: {
|
|
14205
14183
|
refCode: string;
|
|
14206
14184
|
}): {
|
|
@@ -14208,11 +14186,6 @@ declare class Referrals extends Caller {
|
|
|
14208
14186
|
ref_code: string;
|
|
14209
14187
|
date: number;
|
|
14210
14188
|
};
|
|
14211
|
-
/**
|
|
14212
|
-
* @deprecated af-fe no longer accepts this per-action message. Sign
|
|
14213
|
-
* `UserData.createTermsAndConditionsMessage` and pass `refCode` in the
|
|
14214
|
-
* `setReferrer` body instead (AFX-382).
|
|
14215
|
-
*/
|
|
14216
14189
|
setReferrerMessageToSign(inputs: {
|
|
14217
14190
|
refCode: string;
|
|
14218
14191
|
}): {
|
|
@@ -14340,39 +14313,19 @@ declare class UserData extends Caller {
|
|
|
14340
14313
|
action: string;
|
|
14341
14314
|
};
|
|
14342
14315
|
/**
|
|
14343
|
-
*
|
|
14344
|
-
*
|
|
14345
|
-
* byte, so it must stay exactly this string: no JSON wrapper, action, date,
|
|
14346
|
-
* or trailing whitespace (AFX-382).
|
|
14347
|
-
*/
|
|
14348
|
-
static readonly termsAndConditionsMessage = "Aftermath Terms and Conditions";
|
|
14349
|
-
/**
|
|
14350
|
-
* Returns the canonical Terms and Conditions message to sign. Sign it as a
|
|
14351
|
-
* personal message over its UTF-8 bytes and reuse the signature for the whole
|
|
14352
|
-
* session: it is the one credential af-fe verifies for referrals, rewards,
|
|
14353
|
-
* stop/twap order datas, collateral/order history, the websocket `user`
|
|
14354
|
-
* subscription, and gas-pool sponsorship (AFX-382).
|
|
14316
|
+
* Generates a simple message object that the user should sign to confirm their agreement
|
|
14317
|
+
* with the Terms and Conditions of the service.
|
|
14355
14318
|
*
|
|
14356
|
-
* @returns
|
|
14319
|
+
* @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
|
|
14357
14320
|
*
|
|
14358
14321
|
* @example
|
|
14359
14322
|
* ```typescript
|
|
14360
|
-
* const
|
|
14361
|
-
* const
|
|
14362
|
-
*
|
|
14363
|
-
*
|
|
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.
|
|
14364
14327
|
* ```
|
|
14365
14328
|
*/
|
|
14366
|
-
createTermsAndConditionsMessage(): string;
|
|
14367
|
-
/**
|
|
14368
|
-
* Generates a simple message object that the user should sign to confirm their agreement
|
|
14369
|
-
* with the Terms and Conditions of the service.
|
|
14370
|
-
*
|
|
14371
|
-
* @deprecated af-fe no longer accepts the `{action:...}` wrapper and rejects
|
|
14372
|
-
* it with error 2034. Sign {@link createTermsAndConditionsMessage} instead
|
|
14373
|
-
* (AFX-382).
|
|
14374
|
-
* @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
|
|
14375
|
-
*/
|
|
14376
14329
|
createSignTermsAndConditionsMessageToSign(): {
|
|
14377
14330
|
action: string;
|
|
14378
14331
|
};
|
package/dist/index.js
CHANGED
|
@@ -15198,11 +15198,15 @@ 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 (AFX-382).
|
|
15204
15201
|
* @param inputs - An object containing `orderIds`, an array of order object IDs to cancel.
|
|
15205
15202
|
* @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
|
+
* ```
|
|
15206
15210
|
*/
|
|
15207
15211
|
closeDcaOrdersMessageToSign(inputs) {
|
|
15208
15212
|
return {
|
|
@@ -15386,11 +15390,16 @@ var init_limitOrders = __esm({
|
|
|
15386
15390
|
* signs this message (converted to bytes), and the resulting signature is passed
|
|
15387
15391
|
* to `cancelLimitOrder`.
|
|
15388
15392
|
*
|
|
15389
|
-
* @deprecated af-fe no longer accepts this per-action message. Sign
|
|
15390
|
-
* `UserData.createTermsAndConditionsMessage` and pass `orderObjectIds` in the
|
|
15391
|
-
* `cancelLimitOrder` body instead (AFX-382).
|
|
15392
15393
|
* @param inputs - Object with `orderIds`, an array of order object IDs to cancel.
|
|
15393
15394
|
* @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
|
+
* ```
|
|
15394
15403
|
*/
|
|
15395
15404
|
cancelLimitOrdersMessageToSign(inputs) {
|
|
15396
15405
|
return {
|
|
@@ -15557,11 +15566,6 @@ var init_referrals = __esm({
|
|
|
15557
15566
|
// date: Date.now(),
|
|
15558
15567
|
// };
|
|
15559
15568
|
// }
|
|
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 (AFX-382).
|
|
15564
|
-
*/
|
|
15565
15569
|
createReferralLinkMessageToSign(inputs) {
|
|
15566
15570
|
return {
|
|
15567
15571
|
action: "CREATE_REFERRAL",
|
|
@@ -15569,11 +15573,6 @@ var init_referrals = __esm({
|
|
|
15569
15573
|
date: Math.round(Date.now() / 1e3)
|
|
15570
15574
|
};
|
|
15571
15575
|
}
|
|
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 (AFX-382).
|
|
15576
|
-
*/
|
|
15577
15576
|
setReferrerMessageToSign(inputs) {
|
|
15578
15577
|
return {
|
|
15579
15578
|
action: "LINK_REFERRAL",
|
|
@@ -15650,12 +15649,12 @@ var init_rewards = __esm({
|
|
|
15650
15649
|
});
|
|
15651
15650
|
|
|
15652
15651
|
// src/packages/userData/userData.ts
|
|
15653
|
-
var
|
|
15652
|
+
var UserData;
|
|
15654
15653
|
var init_userData = __esm({
|
|
15655
15654
|
"src/packages/userData/userData.ts"() {
|
|
15656
15655
|
"use strict";
|
|
15657
15656
|
init_caller();
|
|
15658
|
-
|
|
15657
|
+
UserData = class extends Caller {
|
|
15659
15658
|
// =========================================================================
|
|
15660
15659
|
// Constructor
|
|
15661
15660
|
// =========================================================================
|
|
@@ -15737,48 +15736,25 @@ var init_userData = __esm({
|
|
|
15737
15736
|
};
|
|
15738
15737
|
}
|
|
15739
15738
|
/**
|
|
15740
|
-
*
|
|
15741
|
-
*
|
|
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 (AFX-382).
|
|
15739
|
+
* Generates a simple message object that the user should sign to confirm their agreement
|
|
15740
|
+
* with the Terms and Conditions of the service.
|
|
15745
15741
|
*
|
|
15746
|
-
* @returns
|
|
15742
|
+
* @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
|
|
15747
15743
|
*
|
|
15748
15744
|
* @example
|
|
15749
15745
|
* ```typescript
|
|
15750
|
-
* const
|
|
15751
|
-
* const
|
|
15752
|
-
*
|
|
15753
|
-
*
|
|
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.
|
|
15754
15750
|
* ```
|
|
15755
15751
|
*/
|
|
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
|
-
* (AFX-382).
|
|
15766
|
-
* @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
|
|
15767
|
-
*/
|
|
15768
15752
|
createSignTermsAndConditionsMessageToSign() {
|
|
15769
15753
|
return {
|
|
15770
15754
|
action: "SIGN_TERMS_AND_CONDITIONS"
|
|
15771
15755
|
};
|
|
15772
15756
|
}
|
|
15773
15757
|
};
|
|
15774
|
-
/**
|
|
15775
|
-
* The single message every wallet signs once per session to prove ownership.
|
|
15776
|
-
* af-fe decodes the personal-message bytes and compares this text byte for
|
|
15777
|
-
* byte, so it must stay exactly this string: no JSON wrapper, action, date,
|
|
15778
|
-
* or trailing whitespace (AFX-382).
|
|
15779
|
-
*/
|
|
15780
|
-
_UserData.termsAndConditionsMessage = "Aftermath Terms and Conditions";
|
|
15781
|
-
UserData = _UserData;
|
|
15782
15758
|
}
|
|
15783
15759
|
});
|
|
15784
15760
|
|