aftermath-ts-sdk 1.1.66 → 1.1.67

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.
@@ -1,5 +1,5 @@
1
1
  import { TransactionArgument, Transaction, TransactionObjectArgument, Argument } from "@mysten/sui/transactions";
2
- import { Balance, CoinTransactionObjectArgumentV1, CoinType, ObjectId, SerializedTransaction, ServiceCoinData, SuiAddress, TransactionDigest, TransactionsWithCursor } from "../../types";
2
+ import { Balance, CoinTransactionObjectArgumentV0, CoinType, ObjectId, SerializedTransaction, ServiceCoinData, SuiAddress, TransactionDigest, TransactionsWithCursor } from "../../types";
3
3
  import { AftermathApi } from "../providers/aftermathApi";
4
4
  import { SuiTransactionBlockResponseQuery } from "@mysten/sui/client";
5
5
  import { TransactionBlock } from "@mysten/sui.js/transactions";
@@ -14,14 +14,14 @@ export declare class TransactionsApiHelpers {
14
14
  fetchSetGasBudgetForTx: (inputs: {
15
15
  tx: Transaction;
16
16
  }) => Promise<Transaction>;
17
- fetchSetGasBudgetForTxV1: (inputs: {
17
+ fetchSetGasBudgetForTxV0: (inputs: {
18
18
  tx: TransactionBlock;
19
19
  }) => Promise<TransactionBlock>;
20
20
  fetchSetGasBudgetAndSerializeTx: (inputs: {
21
21
  tx: Transaction | Promise<Transaction>;
22
22
  isSponsoredTx?: boolean;
23
23
  }) => Promise<SerializedTransaction>;
24
- fetchSetGasBudgetAndSerializeTxV1: (inputs: {
24
+ fetchSetGasBudgetAndSerializeTxV0: (inputs: {
25
25
  tx: TransactionBlock | Promise<TransactionBlock>;
26
26
  isSponsoredTx?: boolean;
27
27
  }) => Promise<SerializedTransaction>;
@@ -38,14 +38,14 @@ export declare class TransactionsApiHelpers {
38
38
  static serviceCoinDataFromCoinTxArg: (inputs: {
39
39
  coinTxArg: TransactionObjectArgument | Argument | ObjectId;
40
40
  }) => ServiceCoinData;
41
- static serviceCoinDataFromCoinTxArgV1: (inputs: {
42
- coinTxArg: CoinTransactionObjectArgumentV1 | ObjectId;
41
+ static serviceCoinDataFromCoinTxArgV0: (inputs: {
42
+ coinTxArg: CoinTransactionObjectArgumentV0 | ObjectId;
43
43
  }) => ServiceCoinData;
44
44
  static coinTxArgFromServiceCoinData: (inputs: {
45
45
  serviceCoinData: ServiceCoinData;
46
46
  }) => TransactionObjectArgument;
47
- static coinTxArgFromServiceCoinDataV1: (inputs: {
47
+ static coinTxArgFromServiceCoinDataV0: (inputs: {
48
48
  serviceCoinData: ServiceCoinData;
49
- }) => CoinTransactionObjectArgumentV1;
49
+ }) => CoinTransactionObjectArgumentV0;
50
50
  }
51
51
  //# sourceMappingURL=transactionsApiHelpers.d.ts.map
@@ -58,13 +58,13 @@ class TransactionsApiHelpers {
58
58
  tx.setGasPrice(referenceGasPrice);
59
59
  return tx;
60
60
  });
61
- this.fetchSetGasBudgetForTxV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
61
+ this.fetchSetGasBudgetForTxV0 = (inputs) => __awaiter(this, void 0, void 0, function* () {
62
62
  var _b;
63
63
  const { tx } = inputs;
64
64
  const [txResponse, referenceGasPrice] = yield Promise.all([
65
- (_b = this.Provider.providerV1) === null || _b === void 0 ? void 0 : _b.dryRunTransactionBlock({
65
+ (_b = this.Provider.providerV0) === null || _b === void 0 ? void 0 : _b.dryRunTransactionBlock({
66
66
  transactionBlock: yield tx.build({
67
- client: this.Provider.providerV1,
67
+ client: this.Provider.providerV0,
68
68
  }),
69
69
  }),
70
70
  this.Provider.provider.getReferenceGasPrice(),
@@ -89,11 +89,11 @@ class TransactionsApiHelpers {
89
89
  return (yield tx).serialize();
90
90
  return (yield this.fetchSetGasBudgetForTx({ tx: yield tx })).serialize();
91
91
  });
92
- this.fetchSetGasBudgetAndSerializeTxV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
92
+ this.fetchSetGasBudgetAndSerializeTxV0 = (inputs) => __awaiter(this, void 0, void 0, function* () {
93
93
  const { tx, isSponsoredTx } = inputs;
94
94
  if (isSponsoredTx)
95
95
  return (yield tx).serialize();
96
- return (yield this.fetchSetGasBudgetForTxV1({ tx: yield tx })).serialize();
96
+ return (yield this.fetchSetGasBudgetForTxV0({ tx: yield tx })).serialize();
97
97
  });
98
98
  }
99
99
  static splitCoinTx(inputs) {
@@ -148,7 +148,7 @@ TransactionsApiHelpers.serviceCoinDataFromCoinTxArg = (inputs) => {
148
148
  // Input
149
149
  return { [coinTxArg.$kind]: coinTxArg.Input };
150
150
  };
151
- TransactionsApiHelpers.serviceCoinDataFromCoinTxArgV1 = (inputs) => {
151
+ TransactionsApiHelpers.serviceCoinDataFromCoinTxArgV0 = (inputs) => {
152
152
  const { coinTxArg } = inputs;
153
153
  if (typeof coinTxArg === "string")
154
154
  return { Coin: utils_1.Helpers.addLeadingZeroesToType(coinTxArg) };
@@ -183,7 +183,7 @@ TransactionsApiHelpers.coinTxArgFromServiceCoinData = (inputs) => {
183
183
  Result: Object.values(serviceCoinData)[0],
184
184
  };
185
185
  };
186
- TransactionsApiHelpers.coinTxArgFromServiceCoinDataV1 = (inputs) => {
186
+ TransactionsApiHelpers.coinTxArgFromServiceCoinDataV0 = (inputs) => {
187
187
  const { serviceCoinData } = inputs;
188
188
  const key = Object.keys(serviceCoinData)[0];
189
189
  // TODO: handle all cases
@@ -24,7 +24,7 @@ import { OracleApi } from "../../packages/oracle/api/oracleApi";
24
24
  import { FarmsApi } from "../../packages/farms/api/farmsApi";
25
25
  import { IndexerCaller } from "../utils";
26
26
  import { SuiClient } from "@mysten/sui/client";
27
- import { SuiClient as SuiClientV1 } from "@mysten/sui.js/client";
27
+ import { SuiClient as SuiClientV0 } from "@mysten/sui.js/client";
28
28
  import { DynamicGasApi } from "../dynamicGas/dynamicGasApi";
29
29
  import { LeveragedStakingApi } from "../../packages/leveragedStaking/api/leveragedStakingApi";
30
30
  import { NftsApi } from "../nfts/nftsApi";
@@ -37,7 +37,7 @@ export declare class AftermathApi {
37
37
  readonly addresses: ConfigAddresses;
38
38
  readonly indexerCaller: IndexerCaller;
39
39
  private readonly config?;
40
- readonly providerV1?: SuiClientV1 | undefined;
40
+ readonly providerV0?: SuiClientV0 | undefined;
41
41
  private cache;
42
42
  static helpers: {
43
43
  dynamicFields: typeof DynamicFieldsApiHelpers;
@@ -61,7 +61,7 @@ export declare class AftermathApi {
61
61
  coinGeckoApiKey?: string | undefined;
62
62
  coinApiIdsToCoinTypes?: Record<string, string[]> | undefined;
63
63
  } | undefined;
64
- } | undefined, providerV1?: SuiClientV1 | undefined);
64
+ } | undefined, providerV0?: SuiClientV0 | undefined);
65
65
  DynamicFields: () => DynamicFieldsApiHelpers;
66
66
  Events: () => EventsApiHelpers;
67
67
  Inspections: () => InspectionsApiHelpers;
@@ -51,13 +51,13 @@ class AftermathApi {
51
51
  * @param indexerCaller - The IndexerCaller instance to use for querying the blockchain.
52
52
  * @param coinGeckoApiKey - (Optional) The API key to use for querying CoinGecko for token prices.
53
53
  */
54
- constructor(provider, addresses, indexerCaller, config, providerV1) {
54
+ constructor(provider, addresses, indexerCaller, config, providerV0) {
55
55
  var _a, _b, _c, _d;
56
56
  this.provider = provider;
57
57
  this.addresses = addresses;
58
58
  this.indexerCaller = indexerCaller;
59
59
  this.config = config;
60
- this.providerV1 = providerV1;
60
+ this.providerV0 = providerV0;
61
61
  // =========================================================================
62
62
  // Class Object Creation
63
63
  // =========================================================================
@@ -15,7 +15,7 @@ export declare class Caller {
15
15
  protected fetchApiTransaction<BodyType = undefined>(url: Url, body?: BodyType, signal?: AbortSignal, options?: {
16
16
  disableBigIntJsonParsing?: boolean;
17
17
  }): Promise<Transaction>;
18
- protected fetchApiTransactionV1<BodyType = undefined>(url: Url, body?: BodyType, signal?: AbortSignal, options?: {
18
+ protected fetchApiTransactionV0<BodyType = undefined>(url: Url, body?: BodyType, signal?: AbortSignal, options?: {
19
19
  disableBigIntJsonParsing?: boolean;
20
20
  }): Promise<TransactionBlock>;
21
21
  protected fetchApiEvents<EventType, BodyType = ApiEventsBody>(url: Url, body: BodyType, signal?: AbortSignal, options?: {
@@ -93,7 +93,7 @@ class Caller {
93
93
  return transactions_1.Transaction.from(yield this.fetchApi(url, body, signal, options));
94
94
  });
95
95
  }
96
- fetchApiTransactionV1(url, body, signal, options) {
96
+ fetchApiTransactionV0(url, body, signal, options) {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
98
  return transactions_2.TransactionBlock.from(yield this.fetchApi(url, body, signal, options));
99
99
  });
@@ -38,7 +38,7 @@ export type ServiceCoinData = {
38
38
  } | {
39
39
  NestedResult: [number, number];
40
40
  };
41
- export type CoinTransactionObjectArgumentV1 = {
41
+ export type CoinTransactionObjectArgumentV0 = {
42
42
  kind: "Input";
43
43
  index: number;
44
44
  } | {
@@ -3,7 +3,7 @@ import { Balance, CoinType, ExternalFee, RouterCompleteTradeRoute, Slippage, Use
3
3
  import { TransactionObjectArgument, Transaction } from "@mysten/sui/transactions";
4
4
  import { IndexerSwapVolumeResponse } from "../../../general/types/castingTypes";
5
5
  import { TransactionBlock } from "@mysten/sui.js/transactions";
6
- import { TransactionObjectArgument as TransactionObjectArgumentV1 } from "@mysten/sui.js/transactions";
6
+ import { TransactionObjectArgument as TransactionObjectArgumentV0 } from "@mysten/sui.js/transactions";
7
7
  /**
8
8
  * RouterApi class provides methods for interacting with the Aftermath Router API.
9
9
  * @class
@@ -112,17 +112,17 @@ export declare class RouterApi {
112
112
  tx: Transaction;
113
113
  coinOut: TransactionObjectArgument;
114
114
  }>;
115
- fetchTxForCompleteTradeRouteV1: (inputs: {
115
+ fetchTxForCompleteTradeRouteV0: (inputs: {
116
116
  completeRoute: RouterCompleteTradeRoute;
117
117
  slippage: Slippage;
118
118
  tx?: TransactionBlock;
119
- coinIn?: TransactionObjectArgumentV1;
119
+ coinIn?: TransactionObjectArgumentV0;
120
120
  walletAddress?: SuiAddress;
121
121
  isSponsoredTx?: boolean;
122
122
  transferCoinOut?: boolean;
123
123
  }) => Promise<{
124
124
  tx: TransactionBlock;
125
- coinOut: TransactionObjectArgumentV1;
125
+ coinOut: TransactionObjectArgumentV0;
126
126
  }>;
127
127
  /**
128
128
  * Fetches trade events for a given user.
@@ -132,7 +132,7 @@ export declare class RouterApi {
132
132
  fetchTradeEvents(inputs: UserEventsInputs): Promise<import("../../..").EventsWithCursor<RouterTradeEvent>>;
133
133
  private fetchAddNetTradeFeePercentageToCompleteTradeRoute;
134
134
  private static transferTxMetadata;
135
- private static transferTxMetadataV1;
135
+ private static transferTxMetadataV0;
136
136
  private routerTradeEventType;
137
137
  }
138
138
  //# sourceMappingURL=routerApi.d.ts.map
@@ -268,7 +268,7 @@ class RouterApi {
268
268
  coinOut,
269
269
  };
270
270
  });
271
- this.fetchTxForCompleteTradeRouteV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
271
+ this.fetchTxForCompleteTradeRouteV0 = (inputs) => __awaiter(this, void 0, void 0, function* () {
272
272
  var _d;
273
273
  const { completeRoute, walletAddress, coinIn, isSponsoredTx, slippage, transferCoinOut, } = inputs;
274
274
  const externalFee = inputs.completeRoute.externalFee;
@@ -288,7 +288,7 @@ class RouterApi {
288
288
  throw new Error("no walletAddress provided");
289
289
  })());
290
290
  const txBytes = yield initTx.build({
291
- client: this.Provider.providerV1,
291
+ client: this.Provider.providerV0,
292
292
  onlyTransactionKind: true,
293
293
  });
294
294
  const b64TxBytes = Buffer.from(txBytes).toString("base64");
@@ -296,7 +296,7 @@ class RouterApi {
296
296
  slippage,
297
297
  referrer,
298
298
  paths: __1.Casting.router.routerServicePathsFromCompleteTradeRoute(completeRoute),
299
- input_coin: __1.Helpers.transactions.serviceCoinDataFromCoinTxArgV1({
299
+ input_coin: __1.Helpers.transactions.serviceCoinDataFromCoinTxArgV0({
300
300
  coinTxArg,
301
301
  }),
302
302
  tx_kind: b64TxBytes,
@@ -307,11 +307,11 @@ class RouterApi {
307
307
  : undefined,
308
308
  }, undefined, undefined, undefined, true);
309
309
  const tx = transactions_2.TransactionBlock.fromKind(tx_kind);
310
- RouterApi.transferTxMetadataV1({
310
+ RouterApi.transferTxMetadataV0({
311
311
  initTx,
312
312
  newTx: tx,
313
313
  });
314
- const coinOut = __1.Helpers.transactions.coinTxArgFromServiceCoinDataV1({
314
+ const coinOut = __1.Helpers.transactions.coinTxArgFromServiceCoinDataV0({
315
315
  serviceCoinData: output_coin,
316
316
  });
317
317
  if (transferCoinOut && walletAddress) {
@@ -437,7 +437,7 @@ RouterApi.transferTxMetadata = (inputs) => {
437
437
  if (gasData.price && typeof gasData.price !== "string")
438
438
  newTx.setGasPrice(gasData.price);
439
439
  };
440
- RouterApi.transferTxMetadataV1 = (inputs) => {
440
+ RouterApi.transferTxMetadataV0 = (inputs) => {
441
441
  const { initTx, newTx } = inputs;
442
442
  const sender = initTx.blockData.sender;
443
443
  if (sender)
@@ -1,4 +1,4 @@
1
- import { ApiRouterTransactionForCompleteTradeRouteBody, RouterCompleteTradeRoute, SuiNetwork, ApiRouterTradeEventsBody, RouterTradeEvent, Balance, ApiRouterPartialCompleteTradeRouteBody, ApiRouterAddTransactionForCompleteTradeRouteBody, ApiRouterAddTransactionForCompleteTradeRouteV1Body } from "../../types";
1
+ import { ApiRouterTransactionForCompleteTradeRouteBody, RouterCompleteTradeRoute, SuiNetwork, ApiRouterTradeEventsBody, RouterTradeEvent, Balance, ApiRouterPartialCompleteTradeRouteBody, ApiRouterAddTransactionForCompleteTradeRouteBody, ApiRouterAddTransactionForCompleteTradeRouteV0Body } from "../../types";
2
2
  import { Caller } from "../../general/utils/caller";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
  import { TransactionBlock } from "@mysten/sui.js/transactions";
@@ -64,14 +64,14 @@ export declare class Router extends Caller {
64
64
  coinOutAmount: Balance;
65
65
  }, abortSignal?: AbortSignal): Promise<RouterCompleteTradeRoute>;
66
66
  getTransactionForCompleteTradeRoute(inputs: ApiRouterTransactionForCompleteTradeRouteBody): Promise<Transaction>;
67
- getTransactionForCompleteTradeRouteV1(inputs: ApiRouterTransactionForCompleteTradeRouteBody): Promise<TransactionBlock>;
67
+ getTransactionForCompleteTradeRouteV0(inputs: ApiRouterTransactionForCompleteTradeRouteBody): Promise<TransactionBlock>;
68
68
  addTransactionForCompleteTradeRoute(inputs: Omit<ApiRouterAddTransactionForCompleteTradeRouteBody, "serializedTx"> & {
69
69
  tx: Transaction;
70
70
  }): Promise<{
71
71
  tx: Transaction;
72
72
  coinOutId: import("@mysten/sui/transactions").TransactionObjectArgument | undefined;
73
73
  }>;
74
- addTransactionForCompleteTradeRouteV1(inputs: Omit<ApiRouterAddTransactionForCompleteTradeRouteV1Body, "serializedTx"> & {
74
+ addTransactionForCompleteTradeRouteV0(inputs: Omit<ApiRouterAddTransactionForCompleteTradeRouteV0Body, "serializedTx"> & {
75
75
  tx: TransactionBlock;
76
76
  }): Promise<{
77
77
  tx: TransactionBlock;
@@ -104,9 +104,9 @@ class Router extends caller_1.Caller {
104
104
  return this.fetchApiTransaction("transactions/trade", inputs);
105
105
  });
106
106
  }
107
- getTransactionForCompleteTradeRouteV1(inputs) {
107
+ getTransactionForCompleteTradeRouteV0(inputs) {
108
108
  return __awaiter(this, void 0, void 0, function* () {
109
- return this.fetchApiTransactionV1("transactions/trade-v1", inputs);
109
+ return this.fetchApiTransactionV0("transactions/trade-v0", inputs);
110
110
  });
111
111
  }
112
112
  addTransactionForCompleteTradeRoute(inputs) {
@@ -119,10 +119,10 @@ class Router extends caller_1.Caller {
119
119
  };
120
120
  });
121
121
  }
122
- addTransactionForCompleteTradeRouteV1(inputs) {
122
+ addTransactionForCompleteTradeRouteV0(inputs) {
123
123
  return __awaiter(this, void 0, void 0, function* () {
124
124
  const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
125
- const { tx: newTx, coinOutId } = yield this.fetchApi("transactions/add-trade-v1", Object.assign(Object.assign({}, otherInputs), { serializedTx: tx.serialize() }));
125
+ const { tx: newTx, coinOutId } = yield this.fetchApi("transactions/add-trade-v0", Object.assign(Object.assign({}, otherInputs), { serializedTx: tx.serialize() }));
126
126
  return {
127
127
  tx: transactions_2.TransactionBlock.from(newTx),
128
128
  coinOutId,
@@ -1,7 +1,7 @@
1
1
  import { AnyObjectType, Balance, Percentage, Event, Slippage, ApiEventsBody, ObjectId, SuiAddress, TxBytes, BigIntAsString, SerializedTransaction, ExternalFee } from "../../general/types/generalTypes";
2
2
  import { CoinType, ServiceCoinData } from "../coin/coinTypes";
3
3
  import { TransactionObjectArgument } from "@mysten/sui/transactions";
4
- import { TransactionObjectArgument as TransactionObjectArgumentV1 } from "@mysten/sui.js/transactions";
4
+ import { TransactionObjectArgument as TransactionObjectArgumentV0 } from "@mysten/sui.js/transactions";
5
5
  export type UniqueId = string;
6
6
  /**
7
7
  * Fee info for third party packages wanting to fee route transactions
@@ -98,17 +98,17 @@ export type ApiRouterAddTransactionForCompleteTradeRouteBody = ApiRouterTransact
98
98
  serializedTx: SerializedTransaction;
99
99
  coinInId?: TransactionObjectArgument;
100
100
  };
101
- export type ApiRouterAddTransactionForCompleteTradeRouteV1Body = ApiRouterTransactionForCompleteTradeRouteBody & {
101
+ export type ApiRouterAddTransactionForCompleteTradeRouteV0Body = ApiRouterTransactionForCompleteTradeRouteBody & {
102
102
  serializedTx: SerializedTransaction;
103
- coinInId?: TransactionObjectArgumentV1;
103
+ coinInId?: TransactionObjectArgumentV0;
104
104
  };
105
105
  export interface ApiRouterAddTransactionForCompleteTradeRouteResponse {
106
106
  tx: SerializedTransaction;
107
107
  coinOutId: TransactionObjectArgument | undefined;
108
108
  }
109
- export interface ApiRouterAddTransactionForCompleteTradeRouteV1Response {
109
+ export interface ApiRouterAddTransactionForCompleteTradeRouteV0Response {
110
110
  tx: SerializedTransaction;
111
- coinOutId: TransactionObjectArgumentV1 | undefined;
111
+ coinOutId: TransactionObjectArgumentV0 | undefined;
112
112
  }
113
113
  export type ApiRouterTradeEventsBody = ApiEventsBody & {
114
114
  walletAddress: SuiAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aftermath-ts-sdk",
3
- "version": "1.1.66",
3
+ "version": "1.1.67",
4
4
  "description": "Aftermath TypeScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",