aftermath-ts-sdk 1.2.63 → 1.2.64-docs.1

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 (117) hide show
  1. package/README.md +61 -27
  2. package/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
  3. package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
  4. package/dist/general/dynamicGas/dynamicGas.js +34 -0
  5. package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
  6. package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
  7. package/dist/general/prices/prices.d.ts +73 -0
  8. package/dist/general/prices/prices.d.ts.map +1 -1
  9. package/dist/general/prices/prices.js +73 -0
  10. package/dist/general/providers/aftermath.d.ts +106 -25
  11. package/dist/general/providers/aftermath.d.ts.map +1 -1
  12. package/dist/general/providers/aftermath.js +108 -27
  13. package/dist/general/providers/aftermathApi.d.ts +127 -8
  14. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  15. package/dist/general/providers/aftermathApi.js +132 -12
  16. package/dist/general/types/castingTypes.d.ts +0 -7
  17. package/dist/general/types/castingTypes.d.ts.map +1 -1
  18. package/dist/general/types/castingTypes.js +6 -0
  19. package/dist/general/types/generalTypes.d.ts +228 -7
  20. package/dist/general/types/generalTypes.d.ts.map +1 -1
  21. package/dist/general/types/suiTypes.d.ts +0 -16
  22. package/dist/general/types/suiTypes.d.ts.map +1 -1
  23. package/dist/general/types/suiTypes.js +3 -25
  24. package/dist/general/utils/casting.d.ts +159 -3
  25. package/dist/general/utils/casting.d.ts.map +1 -1
  26. package/dist/general/utils/casting.js +162 -16
  27. package/dist/general/utils/fixedUtils.d.ts +89 -2
  28. package/dist/general/utils/fixedUtils.d.ts.map +1 -1
  29. package/dist/general/utils/fixedUtils.js +81 -4
  30. package/dist/general/utils/helpers.d.ts +320 -9
  31. package/dist/general/utils/helpers.d.ts.map +1 -1
  32. package/dist/general/utils/helpers.js +350 -89
  33. package/dist/general/utils/iFixedUtils.d.ts +64 -0
  34. package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
  35. package/dist/general/utils/iFixedUtils.js +64 -0
  36. package/dist/general/wallet/wallet.d.ts +75 -0
  37. package/dist/general/wallet/wallet.d.ts.map +1 -1
  38. package/dist/general/wallet/wallet.js +75 -5
  39. package/dist/packages/auth/auth.d.ts +113 -0
  40. package/dist/packages/auth/auth.d.ts.map +1 -1
  41. package/dist/packages/auth/auth.js +129 -15
  42. package/dist/packages/auth/authTypes.d.ts +66 -0
  43. package/dist/packages/auth/authTypes.d.ts.map +1 -1
  44. package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
  45. package/dist/packages/coin/api/coinApi.js +28 -20
  46. package/dist/packages/coin/coin.d.ts +250 -0
  47. package/dist/packages/coin/coin.d.ts.map +1 -1
  48. package/dist/packages/coin/coin.js +238 -14
  49. package/dist/packages/coin/coinTypes.d.ts +93 -0
  50. package/dist/packages/coin/coinTypes.d.ts.map +1 -1
  51. package/dist/packages/dca/dca.d.ts +124 -35
  52. package/dist/packages/dca/dca.d.ts.map +1 -1
  53. package/dist/packages/dca/dca.js +127 -37
  54. package/dist/packages/dca/dcaTypes.d.ts +213 -28
  55. package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
  56. package/dist/packages/farms/farms.d.ts +184 -1
  57. package/dist/packages/farms/farms.d.ts.map +1 -1
  58. package/dist/packages/farms/farms.js +185 -11
  59. package/dist/packages/farms/farmsStakedPosition.d.ts +140 -6
  60. package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
  61. package/dist/packages/farms/farmsStakedPosition.js +189 -144
  62. package/dist/packages/farms/farmsStakingPool.d.ts +161 -1
  63. package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
  64. package/dist/packages/farms/farmsStakingPool.js +176 -70
  65. package/dist/packages/farms/farmsTypes.d.ts +283 -2
  66. package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
  67. package/dist/packages/farms/farmsTypes.js +18 -0
  68. package/dist/packages/limitOrders/limitOrders.d.ts +108 -21
  69. package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -1
  70. package/dist/packages/limitOrders/limitOrders.js +110 -22
  71. package/dist/packages/limitOrders/limitOrdersTypes.d.ts +142 -0
  72. package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -1
  73. package/dist/packages/multisig/multisig.d.ts +33 -4
  74. package/dist/packages/multisig/multisig.d.ts.map +1 -1
  75. package/dist/packages/multisig/multisig.js +33 -4
  76. package/dist/packages/multisig/multisigTypes.d.ts +17 -0
  77. package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
  78. package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
  79. package/dist/packages/pools/pool.d.ts +327 -85
  80. package/dist/packages/pools/pool.d.ts.map +1 -1
  81. package/dist/packages/pools/pool.js +333 -91
  82. package/dist/packages/pools/pools.d.ts +299 -37
  83. package/dist/packages/pools/pools.d.ts.map +1 -1
  84. package/dist/packages/pools/pools.js +306 -52
  85. package/dist/packages/pools/poolsTypes.d.ts +267 -2
  86. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  87. package/dist/packages/referralVault/referralVault.d.ts +37 -0
  88. package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
  89. package/dist/packages/referralVault/referralVault.js +37 -0
  90. package/dist/packages/router/router.d.ts +213 -17
  91. package/dist/packages/router/router.d.ts.map +1 -1
  92. package/dist/packages/router/router.js +214 -18
  93. package/dist/packages/router/routerTypes.d.ts +198 -14
  94. package/dist/packages/router/routerTypes.d.ts.map +1 -1
  95. package/dist/packages/staking/staking.d.ts +301 -43
  96. package/dist/packages/staking/staking.d.ts.map +1 -1
  97. package/dist/packages/staking/staking.js +308 -51
  98. package/dist/packages/staking/stakingTypes.d.ts +426 -6
  99. package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
  100. package/dist/packages/staking/stakingTypes.js +19 -0
  101. package/dist/packages/sui/sui.d.ts +39 -0
  102. package/dist/packages/sui/sui.d.ts.map +1 -1
  103. package/dist/packages/sui/sui.js +39 -0
  104. package/dist/packages/userData/userData.d.ts +66 -12
  105. package/dist/packages/userData/userData.d.ts.map +1 -1
  106. package/dist/packages/userData/userData.js +66 -12
  107. package/dist/packages/userData/userDataTypes.d.ts +19 -0
  108. package/dist/packages/userData/userDataTypes.d.ts.map +1 -1
  109. package/dist/types.d.ts.map +1 -1
  110. package/dist/types.js +0 -1
  111. package/package.json +1 -1
  112. package/dist/general/historicalData/historicalData.d.ts +0 -15
  113. package/dist/general/historicalData/historicalData.d.ts.map +0 -1
  114. package/dist/general/historicalData/historicalData.js +0 -45
  115. package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
  116. package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
  117. package/dist/general/historicalData/historicalDataTypes.js +0 -2
@@ -2,8 +2,20 @@ import { SuiSystemStateSummary } from "@mysten/sui/client";
2
2
  import { Caller } from "../../general/utils/caller";
3
3
  import { CallerConfig } from "../../types";
4
4
  import { AftermathApi } from "../../general/providers";
5
+ /**
6
+ * The `Sui` class provides utilities to fetch core Sui chain information,
7
+ * such as the system state. It also exposes a set of constant addresses
8
+ * related to the Sui network package IDs.
9
+ */
5
10
  export declare class Sui extends Caller {
6
11
  private readonly Provider?;
12
+ /**
13
+ * Static constants containing important addresses on the Sui network:
14
+ * - `zero`: The zero address (commonly used as a null placeholder).
15
+ * - `suiPackageId`: The package ID for the Sui system package.
16
+ * - `suiSystemStateId`: The object ID for the Sui system state.
17
+ * - `suiClockId`: The object ID for the Sui on-chain clock.
18
+ */
7
19
  static readonly constants: {
8
20
  addresses: {
9
21
  zero: string;
@@ -12,8 +24,35 @@ export declare class Sui extends Caller {
12
24
  suiClockId: string;
13
25
  };
14
26
  };
27
+ /**
28
+ * Creates a new instance of the `Sui` class for fetching chain-level info.
29
+ *
30
+ * @param config - Optional configuration, including the Sui network and an access token.
31
+ * @param Provider - An optional `AftermathApi` instance for advanced transaction building or data fetching.
32
+ */
15
33
  constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
34
+ /**
35
+ * Fetches the Sui system state summary object, which contains details
36
+ * about the current epoch, validator set, and other protocol-level data.
37
+ *
38
+ * @returns A promise that resolves to a `SuiSystemStateSummary` instance.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const afSdk = new Aftermath("MAINNET");
43
+ * await afSdk.init(); // initialize provider
44
+ *
45
+ * const sui = afSdk.Sui();
46
+ *
47
+ * const systemState = await sui.getSystemState();
48
+ * console.log(systemState.epoch, systemState.validators);
49
+ * ```
50
+ */
16
51
  getSystemState(): Promise<SuiSystemStateSummary>;
52
+ /**
53
+ * Internal helper to return the configured `Sui` provider. Throws an error if
54
+ * no `AftermathApi` provider is defined.
55
+ */
17
56
  private useProvider;
18
57
  }
19
58
  //# sourceMappingURL=sui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../src/packages/sui/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,GAAI,SAAQ,MAAM;IAuB7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAlB3B,gBAAuB,SAAS;;;;;;;MAU9B;gBAOD,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,0BAAc;IAS5B,cAAc,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAQ7D,OAAO,CAAC,WAAW,CAIjB;CACF"}
1
+ {"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../src/packages/sui/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;GAIG;AACH,qBAAa,GAAI,SAAQ,MAAM;IAoC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IA/B3B;;;;;;OAMG;IACH,gBAAuB,SAAS;;;;;;;MAU9B;IAMF;;;;;OAKG;gBAEF,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,0BAAc;IASzC;;;;;;;;;;;;;;;;OAgBG;IACU,cAAc,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAQ7D;;;OAGG;IACH,OAAO,CAAC,WAAW,CAIjB;CACF"}
@@ -11,16 +11,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Sui = void 0;
13
13
  const caller_1 = require("../../general/utils/caller");
14
+ /**
15
+ * The `Sui` class provides utilities to fetch core Sui chain information,
16
+ * such as the system state. It also exposes a set of constant addresses
17
+ * related to the Sui network package IDs.
18
+ */
14
19
  class Sui extends caller_1.Caller {
15
20
  // =========================================================================
16
21
  // Constructor
17
22
  // =========================================================================
23
+ /**
24
+ * Creates a new instance of the `Sui` class for fetching chain-level info.
25
+ *
26
+ * @param config - Optional configuration, including the Sui network and an access token.
27
+ * @param Provider - An optional `AftermathApi` instance for advanced transaction building or data fetching.
28
+ */
18
29
  constructor(config, Provider) {
19
30
  super(config, "sui");
20
31
  this.Provider = Provider;
21
32
  // =========================================================================
22
33
  // Private Helpers
23
34
  // =========================================================================
35
+ /**
36
+ * Internal helper to return the configured `Sui` provider. Throws an error if
37
+ * no `AftermathApi` provider is defined.
38
+ */
24
39
  this.useProvider = () => {
25
40
  var _a;
26
41
  const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Sui();
@@ -32,6 +47,23 @@ class Sui extends caller_1.Caller {
32
47
  // =========================================================================
33
48
  // Chain Info
34
49
  // =========================================================================
50
+ /**
51
+ * Fetches the Sui system state summary object, which contains details
52
+ * about the current epoch, validator set, and other protocol-level data.
53
+ *
54
+ * @returns A promise that resolves to a `SuiSystemStateSummary` instance.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const afSdk = new Aftermath("MAINNET");
59
+ * await afSdk.init(); // initialize provider
60
+ *
61
+ * const sui = afSdk.Sui();
62
+ *
63
+ * const systemState = await sui.getSystemState();
64
+ * console.log(systemState.epoch, systemState.validators);
65
+ * ```
66
+ */
35
67
  getSystemState() {
36
68
  return __awaiter(this, void 0, void 0, function* () {
37
69
  return this.useProvider().fetchSystemState();
@@ -42,6 +74,13 @@ exports.Sui = Sui;
42
74
  // =========================================================================
43
75
  // Constants
44
76
  // =========================================================================
77
+ /**
78
+ * Static constants containing important addresses on the Sui network:
79
+ * - `zero`: The zero address (commonly used as a null placeholder).
80
+ * - `suiPackageId`: The package ID for the Sui system package.
81
+ * - `suiSystemStateId`: The object ID for the Sui system state.
82
+ * - `suiClockId`: The object ID for the Sui on-chain clock.
83
+ */
45
84
  Sui.constants = {
46
85
  addresses: {
47
86
  zero: "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -1,32 +1,86 @@
1
1
  import { Caller } from "../../general/utils/caller";
2
2
  import { CallerConfig } from "../../types";
3
3
  import { ApiUserDataCreateUserBody, ApiUserDataPublicKeyBody } from "./userDataTypes";
4
+ /**
5
+ * The `UserData` class provides functionality for managing user-specific
6
+ * information in the Aftermath system. It enables creating and retrieving
7
+ * user public keys, as well as generating messages for signing.
8
+ */
4
9
  export declare class UserData extends Caller {
10
+ /**
11
+ * Creates a new instance of the `UserData` class for interacting with user data endpoints.
12
+ *
13
+ * @param config - Optional configuration for the `Caller`, including network and access token.
14
+ */
5
15
  constructor(config?: CallerConfig);
6
16
  /**
7
- * Fetches the API for users public key.
8
- * @async
9
- * @param { SuiAddress } inputs - An object containing the walletAddress.
10
- * @returns { Promise<string | undefined> } A promise that resolves users public key.
17
+ * Retrieves the stored user public key (if any) for a given wallet address.
18
+ *
19
+ * @param inputs - An object implementing `ApiUserDataPublicKeyBody`, containing the user's wallet address.
20
+ * @returns A promise that resolves to a string representation of the user's public key, or `undefined` if none is found.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const afSdk = new Aftermath("MAINNET");
25
+ * await afSdk.init(); // initialize provider
26
+ *
27
+ * const userData = afSdk.UserData();
28
+ *
29
+ * const pubkey = await userData.getUserPublicKey({
30
+ * walletAddress: "0x<address>"
31
+ * });
32
+ * console.log(pubkey); // "0x<hex_public_key>" or undefined
33
+ * ```
11
34
  */
12
35
  getUserPublicKey(inputs: ApiUserDataPublicKeyBody): Promise<string | undefined>;
13
36
  /**
14
- * Fetches the API to create users public key.
15
- * @async
16
- * @param { ApiUserDataCreateUserBody } inputs - The inputs for creating users public key on BE side.
17
- * @returns { Promise<boolean> } A promise that resolves to result if user pk has been created.
37
+ * Creates (or updates) the stored public key for a user on the backend, linking
38
+ * it to their wallet address.
39
+ *
40
+ * @param inputs - Details required to create or update the user's public key, including signature data.
41
+ * @returns A promise that resolves to `true` if the public key was successfully created/updated, otherwise `false` or an error.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const created = await userData.createUserPublicKey({
46
+ * walletAddress: "0x<address>",
47
+ * bytes: "0x<message_as_bytes>",
48
+ * signature: "0x<signature>"
49
+ * });
50
+ * console.log("Was public key created?", created);
51
+ * ```
18
52
  */
19
53
  createUserPublicKey(inputs: ApiUserDataCreateUserBody): Promise<boolean>;
20
54
  /**
21
- * Fetches the API for user create message to sign.
22
- * @returns { string } message to sign with action related to the service you interact with.
55
+ * Generates a simple message object that the user should sign to prove their
56
+ * intention to create or link an account in the Aftermath system.
57
+ *
58
+ * @returns An object with an `action` property, used as the data to sign.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const userData = new UserData();
63
+ * const msgToSign = userData.createUserAccountMessageToSign();
64
+ * console.log(msgToSign.action); // "CREATE_USER_ACCOUNT"
65
+ * // The user can then sign msgToSign with their private key.
66
+ * ```
23
67
  */
24
68
  createUserAccountMessageToSign(): {
25
69
  action: string;
26
70
  };
27
71
  /**
28
- * Fetches the API for creating sign and terms message to sign.
29
- * @returns { string } message to sign with action related to the service you interact with.
72
+ * Generates a simple message object that the user should sign to confirm their agreement
73
+ * with the Terms and Conditions of the service.
74
+ *
75
+ * @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const userData = new UserData();
80
+ * const termsMsg = userData.createSignTermsAndConditionsMessageToSign();
81
+ * console.log(termsMsg.action); // "SIGN_TERMS_AND_CONDITIONS"
82
+ * // The user can sign this to show acceptance of the T&C.
83
+ * ```
30
84
  */
31
85
  createSignTermsAndConditionsMessageToSign(): {
32
86
  action: string;
@@ -1 +1 @@
1
- {"version":3,"file":"userData.d.ts","sourceRoot":"","sources":["../../../src/packages/userData/userData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,QAAS,SAAQ,MAAM;gBAKvB,MAAM,CAAC,EAAE,YAAY;IAOjC;;;;;OAKG;IAEU,gBAAgB,CAC5B,MAAM,EAAE,wBAAwB,GAC9B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAO9B;;;;;OAKG;IAEU,mBAAmB,CAC/B,MAAM,EAAE,yBAAyB,GAC/B,OAAO,CAAC,OAAO,CAAC;IAOnB;;;OAGG;IAEI,8BAA8B;;;IAMrC;;;OAGG;IAEI,yCAAyC,IAAI;QACnD,MAAM,EAAE,MAAM,CAAC;KACf;CAKD"}
1
+ {"version":3,"file":"userData.d.ts","sourceRoot":"","sources":["../../../src/packages/userData/userData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,MAAM;IAKnC;;;;OAIG;gBACS,MAAM,CAAC,EAAE,YAAY;IAQjC;;;;;;;;;;;;;;;;;;OAkBG;IACU,gBAAgB,CAC5B,MAAM,EAAE,wBAAwB,GAC9B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAO9B;;;;;;;;;;;;;;;;OAgBG;IACU,mBAAmB,CAC/B,MAAM,EAAE,yBAAyB,GAC/B,OAAO,CAAC,OAAO,CAAC;IAOnB;;;;;;;;;;;;;OAaG;IACI,8BAA8B;;;IAMrC;;;;;;;;;;;;;OAaG;IACI,yCAAyC,IAAI;QACnD,MAAM,EAAE,MAAM,CAAC;KACf;CAKD"}
@@ -11,10 +11,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UserData = void 0;
13
13
  const caller_1 = require("../../general/utils/caller");
14
+ /**
15
+ * The `UserData` class provides functionality for managing user-specific
16
+ * information in the Aftermath system. It enables creating and retrieving
17
+ * user public keys, as well as generating messages for signing.
18
+ */
14
19
  class UserData extends caller_1.Caller {
15
20
  // =========================================================================
16
21
  // Constructor
17
22
  // =========================================================================
23
+ /**
24
+ * Creates a new instance of the `UserData` class for interacting with user data endpoints.
25
+ *
26
+ * @param config - Optional configuration for the `Caller`, including network and access token.
27
+ */
18
28
  constructor(config) {
19
29
  super(config, "user-data");
20
30
  }
@@ -22,10 +32,23 @@ class UserData extends caller_1.Caller {
22
32
  // API
23
33
  // =========================================================================
24
34
  /**
25
- * Fetches the API for users public key.
26
- * @async
27
- * @param { SuiAddress } inputs - An object containing the walletAddress.
28
- * @returns { Promise<string | undefined> } A promise that resolves users public key.
35
+ * Retrieves the stored user public key (if any) for a given wallet address.
36
+ *
37
+ * @param inputs - An object implementing `ApiUserDataPublicKeyBody`, containing the user's wallet address.
38
+ * @returns A promise that resolves to a string representation of the user's public key, or `undefined` if none is found.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const afSdk = new Aftermath("MAINNET");
43
+ * await afSdk.init(); // initialize provider
44
+ *
45
+ * const userData = afSdk.UserData();
46
+ *
47
+ * const pubkey = await userData.getUserPublicKey({
48
+ * walletAddress: "0x<address>"
49
+ * });
50
+ * console.log(pubkey); // "0x<hex_public_key>" or undefined
51
+ * ```
29
52
  */
30
53
  getUserPublicKey(inputs) {
31
54
  return __awaiter(this, void 0, void 0, function* () {
@@ -33,10 +56,21 @@ class UserData extends caller_1.Caller {
33
56
  });
34
57
  }
35
58
  /**
36
- * Fetches the API to create users public key.
37
- * @async
38
- * @param { ApiUserDataCreateUserBody } inputs - The inputs for creating users public key on BE side.
39
- * @returns { Promise<boolean> } A promise that resolves to result if user pk has been created.
59
+ * Creates (or updates) the stored public key for a user on the backend, linking
60
+ * it to their wallet address.
61
+ *
62
+ * @param inputs - Details required to create or update the user's public key, including signature data.
63
+ * @returns A promise that resolves to `true` if the public key was successfully created/updated, otherwise `false` or an error.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const created = await userData.createUserPublicKey({
68
+ * walletAddress: "0x<address>",
69
+ * bytes: "0x<message_as_bytes>",
70
+ * signature: "0x<signature>"
71
+ * });
72
+ * console.log("Was public key created?", created);
73
+ * ```
40
74
  */
41
75
  createUserPublicKey(inputs) {
42
76
  return __awaiter(this, void 0, void 0, function* () {
@@ -44,8 +78,18 @@ class UserData extends caller_1.Caller {
44
78
  });
45
79
  }
46
80
  /**
47
- * Fetches the API for user create message to sign.
48
- * @returns { string } message to sign with action related to the service you interact with.
81
+ * Generates a simple message object that the user should sign to prove their
82
+ * intention to create or link an account in the Aftermath system.
83
+ *
84
+ * @returns An object with an `action` property, used as the data to sign.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const userData = new UserData();
89
+ * const msgToSign = userData.createUserAccountMessageToSign();
90
+ * console.log(msgToSign.action); // "CREATE_USER_ACCOUNT"
91
+ * // The user can then sign msgToSign with their private key.
92
+ * ```
49
93
  */
50
94
  createUserAccountMessageToSign() {
51
95
  return {
@@ -53,8 +97,18 @@ class UserData extends caller_1.Caller {
53
97
  };
54
98
  }
55
99
  /**
56
- * Fetches the API for creating sign and terms message to sign.
57
- * @returns { string } message to sign with action related to the service you interact with.
100
+ * Generates a simple message object that the user should sign to confirm their agreement
101
+ * with the Terms and Conditions of the service.
102
+ *
103
+ * @returns An object with an `action` property set to "SIGN_TERMS_AND_CONDITIONS".
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const userData = new UserData();
108
+ * const termsMsg = userData.createSignTermsAndConditionsMessageToSign();
109
+ * console.log(termsMsg.action); // "SIGN_TERMS_AND_CONDITIONS"
110
+ * // The user can sign this to show acceptance of the T&C.
111
+ * ```
58
112
  */
59
113
  createSignTermsAndConditionsMessageToSign() {
60
114
  return {
@@ -1,10 +1,29 @@
1
1
  import { SuiAddress } from "../../types";
2
+ /**
3
+ * Request body for creating or registering a user’s public key in Aftermath’s backend.
4
+ * It typically includes proof of ownership by having the user sign a specific message.
5
+ */
2
6
  export interface ApiUserDataCreateUserBody {
7
+ /**
8
+ * The user's Sui wallet address (e.g., "0x<address>").
9
+ */
3
10
  walletAddress: SuiAddress;
11
+ /**
12
+ * The message bytes (in hex string form) that the user signed.
13
+ */
4
14
  bytes: string;
15
+ /**
16
+ * The signature (in hex string form) created by signing `bytes`.
17
+ */
5
18
  signature: string;
6
19
  }
20
+ /**
21
+ * Request body for fetching a user’s public key by their wallet address.
22
+ */
7
23
  export interface ApiUserDataPublicKeyBody {
24
+ /**
25
+ * The user's Sui wallet address.
26
+ */
8
27
  walletAddress: SuiAddress;
9
28
  }
10
29
  //# sourceMappingURL=userDataTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userDataTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/userData/userDataTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,UAAU,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACxC,aAAa,EAAE,UAAU,CAAC;CAC1B"}
1
+ {"version":3,"file":"userDataTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/userData/userDataTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mDAAmD,CAAC;AAClE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAE1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mDAAmD,CAAC;AAClE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,iBAAiB,CAAC"}
package/dist/types.js CHANGED
@@ -23,7 +23,6 @@ __exportStar(require("./packages/coin/coinTypes"), exports);
23
23
  __exportStar(require("./packages/router/routerTypes"), exports);
24
24
  __exportStar(require("./packages/nftAmm/nftAmmTypes"), exports);
25
25
  __exportStar(require("./packages/auth/authTypes"), exports);
26
- // export * from "./packages/referralVault/referralVaultTypes";
27
26
  __exportStar(require("./packages/farms/farmsTypes"), exports);
28
27
  __exportStar(require("./packages/perpetuals/perpetualsTypes"), exports);
29
28
  __exportStar(require("./packages/oracle/oracleTypes"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aftermath-ts-sdk",
3
- "version": "1.2.63",
3
+ "version": "1.2.64-docs.1",
4
4
  "description": "Aftermath TypeScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,15 +0,0 @@
1
- import { CoinSymbol, CoinType } from "../../packages/coin/coinTypes";
2
- import { Caller } from "../utils/caller";
3
- import { CallerConfig } from "../types";
4
- import { CoinHistoricalData } from "./historicalDataTypes";
5
- import { CoinGeckoCoinData, CoinGeckoCoinSymbolData } from "../prices/coinGeckoTypes";
6
- export declare class HistoricalData extends Caller {
7
- constructor(config?: CallerConfig);
8
- getSupportedCoins(): Promise<CoinType[]>;
9
- getAllSuiCoinData(): Promise<Record<CoinType, CoinGeckoCoinData>>;
10
- getAllCoinData(): Promise<Record<CoinSymbol, CoinGeckoCoinSymbolData>>;
11
- getCoinHistoricalData(inputs: {
12
- coin: CoinType;
13
- }): Promise<CoinHistoricalData>;
14
- }
15
- //# sourceMappingURL=historicalData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"historicalData.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAO,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,cAAe,SAAQ,MAAM;gBAK7B,MAAM,CAAC,EAAE,YAAY;IAQpB,iBAAiB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIxC,iBAAiB,IAAI,OAAO,CACxC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CACnC;IAIY,cAAc,IAAI,OAAO,CACrC,MAAM,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAC3C;IAIY,qBAAqB,CAAC,MAAM,EAAE;QAC1C,IAAI,EAAE,QAAQ,CAAC;KACf,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAG/B"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HistoricalData = void 0;
13
- const caller_1 = require("../utils/caller");
14
- class HistoricalData extends caller_1.Caller {
15
- // =========================================================================
16
- // Constructor
17
- // =========================================================================
18
- constructor(config) {
19
- super(config, "historical-data");
20
- }
21
- // =========================================================================
22
- // Historical Data
23
- // =========================================================================
24
- getSupportedCoins() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- return this.fetchApi("supported-coins");
27
- });
28
- }
29
- getAllSuiCoinData() {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- return this.fetchApi("coins-data");
32
- });
33
- }
34
- getAllCoinData() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- return this.fetchApi("coin-symbols-data");
37
- });
38
- }
39
- getCoinHistoricalData(inputs) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- return this.fetchApi(inputs.coin);
42
- });
43
- }
44
- }
45
- exports.HistoricalData = HistoricalData;
@@ -1,10 +0,0 @@
1
- import { OpUnitType, QUnitType } from "dayjs";
2
- export type CoinHistoricalDataPoint = [timestamp: number, value: number];
3
- export interface CoinHistoricalData {
4
- prices: CoinHistoricalDataPoint[];
5
- marketCaps: CoinHistoricalDataPoint[];
6
- volumes24Hours: CoinHistoricalDataPoint[];
7
- time: number;
8
- timeUnit: QUnitType | OpUnitType;
9
- }
10
- //# sourceMappingURL=historicalDataTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"historicalDataTypes.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM9C,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAEzE,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,UAAU,EAAE,uBAAuB,EAAE,CAAC;IACtC,cAAc,EAAE,uBAAuB,EAAE,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });