@7kprotocol/sdk-ts 3.5.2-beta.3 → 3.5.2-beta.4

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 (57) hide show
  1. package/lib/cjs/features/metaAg/common.js +3 -2
  2. package/lib/cjs/features/metaAg/error.js +35 -0
  3. package/lib/cjs/features/metaAg/index.js +9 -9
  4. package/lib/cjs/features/metaAg/providers/astro.js +2 -2
  5. package/lib/cjs/features/metaAg/providers/bluefin7k.js +3 -3
  6. package/lib/cjs/features/metaAg/providers/bluefin7kLegacy.js +2 -2
  7. package/lib/cjs/features/metaAg/providers/bluefinx.js +5 -5
  8. package/lib/cjs/features/metaAg/providers/cetus.js +3 -3
  9. package/lib/cjs/features/metaAg/providers/flowx.js +2 -2
  10. package/lib/cjs/features/metaAg/providers/okx.js +10 -10
  11. package/lib/cjs/types/features/metaAg/common.d.ts.map +1 -1
  12. package/lib/cjs/types/features/metaAg/error.d.ts +60 -0
  13. package/lib/cjs/types/features/metaAg/error.d.ts.map +1 -0
  14. package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
  15. package/lib/cjs/types/features/metaAg/providers/astro.d.ts.map +1 -1
  16. package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts.map +1 -1
  17. package/lib/cjs/types/features/metaAg/providers/bluefin7kLegacy.d.ts.map +1 -1
  18. package/lib/cjs/types/features/metaAg/providers/bluefinx.d.ts.map +1 -1
  19. package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +1 -1
  20. package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +1 -1
  21. package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +1 -1
  22. package/lib/cjs/types/okx.js +1 -1
  23. package/lib/cjs/types/types/okx.d.ts +61 -48
  24. package/lib/cjs/types/types/okx.d.ts.map +1 -1
  25. package/lib/cjs/utils/sui.js +1 -0
  26. package/lib/esm/features/metaAg/common.js +3 -2
  27. package/lib/esm/features/metaAg/error.js +33 -0
  28. package/lib/esm/features/metaAg/index.js +9 -9
  29. package/lib/esm/features/metaAg/providers/astro.js +2 -2
  30. package/lib/esm/features/metaAg/providers/bluefin7k.js +4 -4
  31. package/lib/esm/features/metaAg/providers/bluefin7kLegacy.js +2 -2
  32. package/lib/esm/features/metaAg/providers/bluefinx.js +5 -5
  33. package/lib/esm/features/metaAg/providers/cetus.js +3 -3
  34. package/lib/esm/features/metaAg/providers/flowx.js +2 -2
  35. package/lib/esm/features/metaAg/providers/okx.js +10 -10
  36. package/lib/esm/types/features/metaAg/common.d.ts.map +1 -1
  37. package/lib/esm/types/features/metaAg/error.d.ts +60 -0
  38. package/lib/esm/types/features/metaAg/error.d.ts.map +1 -0
  39. package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
  40. package/lib/esm/types/features/metaAg/providers/astro.d.ts.map +1 -1
  41. package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts.map +1 -1
  42. package/lib/esm/types/features/metaAg/providers/bluefin7kLegacy.d.ts.map +1 -1
  43. package/lib/esm/types/features/metaAg/providers/bluefinx.d.ts.map +1 -1
  44. package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +1 -1
  45. package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +1 -1
  46. package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +1 -1
  47. package/lib/esm/types/okx.js +1 -1
  48. package/lib/esm/types/types/okx.d.ts +61 -48
  49. package/lib/esm/types/types/okx.d.ts.map +1 -1
  50. package/lib/esm/utils/sui.js +1 -0
  51. package/package.json +1 -1
  52. package/lib/cjs/types/utils/condition.d.ts +0 -2
  53. package/lib/cjs/types/utils/condition.d.ts.map +0 -1
  54. package/lib/cjs/utils/condition.js +0 -8
  55. package/lib/esm/types/utils/condition.d.ts +0 -2
  56. package/lib/esm/types/utils/condition.d.ts.map +0 -1
  57. package/lib/esm/utils/condition.js +0 -5
@@ -4,6 +4,7 @@ exports.timeout = exports.metaSettle = exports.simulateAggregator = exports.simu
4
4
  const transactions_1 = require("@mysten/sui/transactions");
5
5
  const _7k_1 = require("../../constants/_7k");
6
6
  const buildTx_1 = require("../swap/buildTx");
7
+ const error_1 = require("./error");
7
8
  const DEFAULT_GAS_USED = {
8
9
  computationCost: "0",
9
10
  nonRefundableStorageFee: "0",
@@ -25,7 +26,7 @@ const simulateSwapTx = async (tx, inspector, simulation) => {
25
26
  transactionBlock: tx,
26
27
  }), simulation.timeout ?? 2000);
27
28
  if (res.effects.status.status === "failure") {
28
- throw new Error(res.error ?? "Simulation failed");
29
+ throw new error_1.MetaAgError(res.error ?? "Simulation failed", error_1.MetaAgErrorCode.SIMULATION_FAILED, { error: res.error });
29
30
  }
30
31
  const amountOut = extractAmountOutWrapper(res.events);
31
32
  return {
@@ -107,7 +108,7 @@ const timeout = async (fn, timeout, msg) => {
107
108
  if (timeout <= 0)
108
109
  return fn();
109
110
  return new Promise((resolve, reject) => {
110
- const timer = setTimeout(() => reject(new Error(`Timeout ${msg ?? "operation"}`)), timeout);
111
+ const timer = setTimeout(() => reject(new error_1.MetaAgError(`Timeout ${msg ?? "operation"}`, error_1.MetaAgErrorCode.TIMEOUT, { timeout })), timeout);
111
112
  fn()
112
113
  .then(resolve)
113
114
  .catch(reject)
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetaAgError = exports.MetaAgErrorCode = void 0;
4
+ var MetaAgErrorCode;
5
+ (function (MetaAgErrorCode) {
6
+ MetaAgErrorCode[MetaAgErrorCode["UNKNOWN"] = 1000] = "UNKNOWN";
7
+ MetaAgErrorCode[MetaAgErrorCode["TIMEOUT"] = 1001] = "TIMEOUT";
8
+ MetaAgErrorCode[MetaAgErrorCode["PROVIDER_NOT_FOUND"] = 1002] = "PROVIDER_NOT_FOUND";
9
+ MetaAgErrorCode[MetaAgErrorCode["PROVIDER_NOT_SUPPORTED"] = 1003] = "PROVIDER_NOT_SUPPORTED";
10
+ MetaAgErrorCode[MetaAgErrorCode["INVALID_QUOTE"] = 1004] = "INVALID_QUOTE";
11
+ MetaAgErrorCode[MetaAgErrorCode["QUOTE_NOT_FOUND"] = 1005] = "QUOTE_NOT_FOUND";
12
+ MetaAgErrorCode[MetaAgErrorCode["INVALID_SIGNER_ADDRESS"] = 1006] = "INVALID_SIGNER_ADDRESS";
13
+ MetaAgErrorCode[MetaAgErrorCode["PROVIDER_NOT_SUPPORT_SWAP"] = 1007] = "PROVIDER_NOT_SUPPORT_SWAP";
14
+ MetaAgErrorCode[MetaAgErrorCode["SIMULATION_FAILED"] = 1008] = "SIMULATION_FAILED";
15
+ // OKX error
16
+ MetaAgErrorCode[MetaAgErrorCode["OKX_FINALIZE_COMMAND_NOT_FOUND"] = 1100] = "OKX_FINALIZE_COMMAND_NOT_FOUND";
17
+ // BluefinX error
18
+ MetaAgErrorCode[MetaAgErrorCode["BLUEFINX_TRANSACTION_NOT_FOUND"] = 1200] = "BLUEFINX_TRANSACTION_NOT_FOUND";
19
+ MetaAgErrorCode[MetaAgErrorCode["BLUEFINX_TRANSACTION_NOT_APPROVED"] = 1201] = "BLUEFINX_TRANSACTION_NOT_APPROVED";
20
+ MetaAgErrorCode[MetaAgErrorCode["BLUEFINX_TRANSACTION_DIGEST_NOT_FOUND"] = 1202] = "BLUEFINX_TRANSACTION_DIGEST_NOT_FOUND";
21
+ })(MetaAgErrorCode || (exports.MetaAgErrorCode = MetaAgErrorCode = {}));
22
+ class MetaAgError extends Error {
23
+ constructor(message, code, details) {
24
+ super(message);
25
+ this.name = "MetaAgError";
26
+ this.code = code ?? MetaAgErrorCode.UNKNOWN;
27
+ this.details = details;
28
+ }
29
+ static assert(condition, message, code, details) {
30
+ if (!condition) {
31
+ throw new MetaAgError(message ?? "Assertion failed", code, details);
32
+ }
33
+ }
34
+ }
35
+ exports.MetaAgError = MetaAgError;
@@ -39,11 +39,11 @@ const transactions_1 = require("@mysten/sui/transactions");
39
39
  const utils_1 = require("@mysten/sui/utils");
40
40
  const sui_1 = require("../../constants/sui");
41
41
  const metaAg_1 = require("../../types/metaAg");
42
- const condition_1 = require("../../utils/condition");
43
42
  const sui_2 = require("../../utils/sui");
44
43
  const SuiClientUtils_1 = require("../../utils/SuiClientUtils");
45
44
  const buildTx_1 = require("../swap/buildTx");
46
45
  const common_1 = require("./common");
46
+ const error_1 = require("./error");
47
47
  const bluefin7kLegacy_1 = require("./providers/bluefin7kLegacy");
48
48
  const bluefinx_1 = require("./providers/bluefinx");
49
49
  const okx_1 = require("./providers/okx");
@@ -77,7 +77,7 @@ class MetaAg {
77
77
  if (p)
78
78
  return p;
79
79
  const providerOptions = this.options.providers[provider];
80
- (0, condition_1.assert)(!!providerOptions, `Provider not found: ${provider}`);
80
+ error_1.MetaAgError.assert(!!providerOptions, `Provider not found: ${provider}`, error_1.MetaAgErrorCode.PROVIDER_NOT_FOUND, { provider });
81
81
  switch (provider) {
82
82
  case metaAg_1.EProvider.BLUEFIN7K_LEGACY:
83
83
  this.providers[metaAg_1.EProvider.BLUEFIN7K_LEGACY] = new bluefin7kLegacy_1.BluefinLegacyProvider(providerOptions, this.options, this.client);
@@ -105,7 +105,7 @@ class MetaAg {
105
105
  this.providers[metaAg_1.EProvider.ASTRO] = new AstroProvider(providerOptions);
106
106
  break;
107
107
  default:
108
- throw new Error(`Provider not supported: ${provider}`);
108
+ throw new error_1.MetaAgError(`Provider not supported: ${provider}`, error_1.MetaAgErrorCode.PROVIDER_NOT_SUPPORTED, { provider });
109
109
  }
110
110
  return this.providers[provider];
111
111
  }
@@ -120,7 +120,7 @@ class MetaAg {
120
120
  case metaAg_1.EProvider.OKX:
121
121
  return (0, okx_1.simulateOKXSwap)(quote, this.inspector, simulation, this.options);
122
122
  default:
123
- throw new Error(`Provider not supported: ${provider.kind}`);
123
+ throw new error_1.MetaAgError(`Provider not supported: ${provider.kind}`, error_1.MetaAgErrorCode.PROVIDER_NOT_SUPPORTED, { provider: provider.kind });
124
124
  }
125
125
  }
126
126
  catch (error) {
@@ -208,9 +208,9 @@ class MetaAg {
208
208
  */
209
209
  async swap(options, slippageBps) {
210
210
  const provider = await this._getProvider(options.quote.provider);
211
- (0, condition_1.assert)(!!provider, `Provider not found: ${options.quote.provider}`);
212
- (0, condition_1.assert)((0, metaAg_1.isAggregatorProvider)(provider), `Provider does not support swap: ${provider.kind}`);
213
- (0, condition_1.assert)(!(0, sui_2.isSystemAddress)(options.signer), "Invalid signer address");
211
+ error_1.MetaAgError.assert(!!provider, `Provider not found: ${options.quote.provider}`, error_1.MetaAgErrorCode.PROVIDER_NOT_FOUND, { provider: options.quote.provider });
212
+ error_1.MetaAgError.assert((0, metaAg_1.isAggregatorProvider)(provider), `Provider does not support swap: ${provider.kind}, use fastSwap instead`, error_1.MetaAgErrorCode.PROVIDER_NOT_SUPPORT_SWAP, { provider: provider.kind });
213
+ error_1.MetaAgError.assert(!(0, sui_2.isSystemAddress)(options.signer), "Invalid signer address", error_1.MetaAgErrorCode.INVALID_SIGNER_ADDRESS, { signer: options.signer });
214
214
  const coinOut = await provider.swap(options);
215
215
  options.tx.add((0, common_1.metaSettle)(options.quote, coinOut, slippageBps ?? this.options.slippageBps ?? 100, this.options.tipBps, this.options.partner, this.options.partnerCommissionBps));
216
216
  options.tx.setSenderIfNotSet(options.signer);
@@ -222,7 +222,7 @@ class MetaAg {
222
222
  * @returns - txDigest of the transaction
223
223
  */
224
224
  async fastSwap(options, getTransactionBlockParams) {
225
- (0, condition_1.assert)(!(0, sui_2.isSystemAddress)(options.signer), "Invalid signer address");
225
+ error_1.MetaAgError.assert(!(0, sui_2.isSystemAddress)(options.signer), "Invalid signer address", error_1.MetaAgErrorCode.INVALID_SIGNER_ADDRESS, { signer: options.signer });
226
226
  const provider = await this._getProvider(options.quote.provider);
227
227
  if ((0, metaAg_1.isAggregatorProvider)(provider)) {
228
228
  return this._fastSwap(options, getTransactionBlockParams);
@@ -234,7 +234,7 @@ class MetaAg {
234
234
  });
235
235
  }
236
236
  else {
237
- throw new Error(`Provider not supported: ${provider.kind}`);
237
+ throw new error_1.MetaAgError(`Provider not supported: ${provider.kind}`, error_1.MetaAgErrorCode.PROVIDER_NOT_SUPPORTED, { provider: provider.kind });
238
238
  }
239
239
  }
240
240
  /**
@@ -5,7 +5,7 @@ const astros_aggregator_sdk_1 = require("@naviprotocol/astros-aggregator-sdk");
5
5
  const uuid_1 = require("uuid");
6
6
  const _7k_1 = require("../../../constants/_7k");
7
7
  const metaAg_1 = require("../../../types/metaAg");
8
- const condition_1 = require("../../../utils/condition");
8
+ const error_1 = require("../error");
9
9
  class AstroProvider {
10
10
  constructor(options) {
11
11
  this.options = options;
@@ -35,7 +35,7 @@ class AstroProvider {
35
35
  };
36
36
  }
37
37
  async swap({ signer, quote, coinIn, tx }) {
38
- (0, condition_1.assert)(quote.provider === metaAg_1.EProvider.ASTRO, "Invalid quote");
38
+ error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.ASTRO, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.ASTRO });
39
39
  const coin = await (0, astros_aggregator_sdk_1.buildSwapPTBFromQuote)(signer, tx, 0, coinIn, quote.quote);
40
40
  return coin;
41
41
  }
@@ -5,7 +5,7 @@ const bluefin7k_aggregator_sdk_1 = require("@bluefin-exchange/bluefin7k-aggregat
5
5
  const uuid_1 = require("uuid");
6
6
  const _7k_1 = require("../../../constants/_7k");
7
7
  const metaAg_1 = require("../../../types/metaAg");
8
- const condition_1 = require("../../../utils/condition");
8
+ const error_1 = require("../error");
9
9
  class Bluefin7kProvider {
10
10
  constructor(options, metaOptions, client) {
11
11
  this.options = options;
@@ -24,7 +24,7 @@ class Bluefin7kProvider {
24
24
  excludedPools: this.options.excludedPools,
25
25
  targetPools: this.options.targetPools,
26
26
  });
27
- (0, condition_1.assert)(!!quote, "No quote found");
27
+ error_1.MetaAgError.assert(!!quote, "No quote found", error_1.MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
28
28
  return {
29
29
  id: (0, uuid_1.v4)(),
30
30
  provider: metaAg_1.EProvider.BLUEFIN7K,
@@ -37,7 +37,7 @@ class Bluefin7kProvider {
37
37
  };
38
38
  }
39
39
  async swap({ quote, signer, tx, coinIn }) {
40
- (0, condition_1.assert)(quote.provider === metaAg_1.EProvider.BLUEFIN7K, "Invalid quote");
40
+ error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.BLUEFIN7K, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.BLUEFIN7K });
41
41
  const { coinOut } = await (0, bluefin7k_aggregator_sdk_1.buildTx)({
42
42
  quoteResponse: quote.quote,
43
43
  accountAddress: signer,
@@ -6,9 +6,9 @@ const uuid_1 = require("uuid");
6
6
  const config_1 = require("../../../config");
7
7
  const _7k_1 = require("../../../constants/_7k");
8
8
  const metaAg_1 = require("../../../types/metaAg");
9
- const condition_1 = require("../../../utils/condition");
10
9
  const buildTxV2_1 = require("../../swap/buildTxV2");
11
10
  const getQuote_1 = require("../../swap/getQuote");
11
+ const error_1 = require("../error");
12
12
  const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
13
13
  const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
14
14
  class BluefinLegacyProvider {
@@ -48,7 +48,7 @@ class BluefinLegacyProvider {
48
48
  };
49
49
  }
50
50
  async swap({ quote, signer, tx, coinIn }) {
51
- (0, condition_1.assert)(quote.provider === metaAg_1.EProvider.BLUEFIN7K_LEGACY, "Invalid quote");
51
+ error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.BLUEFIN7K_LEGACY, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.BLUEFIN7K_LEGACY });
52
52
  const { coinOut } = await (0, buildTxV2_1.buildTxV2)({
53
53
  quoteResponse: quote.quote,
54
54
  accountAddress: signer,
@@ -9,10 +9,10 @@ const _7k_1 = require("../../../constants/_7k");
9
9
  const client_1 = require("../../../libs/protocols/bluefinx/client");
10
10
  const aggregator_1 = require("../../../types/aggregator");
11
11
  const metaAg_1 = require("../../../types/metaAg");
12
- const condition_1 = require("../../../utils/condition");
13
12
  const buildTxV2_1 = require("../../swap/buildTxV2");
14
13
  const getQuote_1 = require("../../swap/getQuote");
15
14
  const common_1 = require("../common");
15
+ const error_1 = require("../error");
16
16
  const SUPPORT_COINS = [
17
17
  "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
18
18
  "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
@@ -54,7 +54,7 @@ class BluefinXProvider {
54
54
  SUPPORT_COINS.includes(options.coinTypeOut));
55
55
  }
56
56
  async fastSwap(options) {
57
- (0, condition_1.assert)(options.quote.provider === this.kind, "Invalid BluefinX quote");
57
+ error_1.MetaAgError.assert(options.quote.provider === this.kind, "Invalid BluefinX quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote: options.quote, expectedProvider: this.kind });
58
58
  const quote = options.quote.quote;
59
59
  const tx = new transactions_1.Transaction();
60
60
  const { tx: bluefinTx } = await (0, buildTxV2_1.buildTxV2Int)({
@@ -76,11 +76,11 @@ class BluefinXProvider {
76
76
  tx.transferObjects([coinOut], options.signer);
77
77
  }
78
78
  });
79
- (0, condition_1.assert)(bluefinTx instanceof aggregator_1.BluefinXTx, "BluefinX transaction not found");
79
+ error_1.MetaAgError.assert(bluefinTx instanceof aggregator_1.BluefinXTx, "BluefinX transaction not found", error_1.MetaAgErrorCode.BLUEFINX_TRANSACTION_NOT_FOUND, {});
80
80
  const { signature } = await options.signTransaction(bluefinTx.txBytes);
81
81
  const res = await (0, client_1.executeBluefinTx)(bluefinTx, signature);
82
- (0, condition_1.assert)(res.approved, "BluefinX transaction not approved");
83
- (0, condition_1.assert)(res.txDigest, "BluefinX transaction digest not found");
82
+ error_1.MetaAgError.assert(res.approved, "BluefinX transaction not approved", error_1.MetaAgErrorCode.BLUEFINX_TRANSACTION_NOT_APPROVED, {});
83
+ error_1.MetaAgError.assert(res.txDigest, "BluefinX transaction digest not found", error_1.MetaAgErrorCode.BLUEFINX_TRANSACTION_DIGEST_NOT_FOUND, {});
84
84
  return res.txDigest;
85
85
  }
86
86
  }
@@ -5,7 +5,7 @@ const aggregator_sdk_1 = require("@cetusprotocol/aggregator-sdk");
5
5
  const uuid_1 = require("uuid");
6
6
  const _7k_1 = require("../../../constants/_7k");
7
7
  const metaAg_1 = require("../../../types/metaAg");
8
- const condition_1 = require("../../../utils/condition");
8
+ const error_1 = require("../error");
9
9
  class CetusProvider {
10
10
  constructor(options, metaOptions, client) {
11
11
  this.options = options;
@@ -33,7 +33,7 @@ class CetusProvider {
33
33
  depth: this.options.depth,
34
34
  liquidityChanges: this.options.liquidityChanges,
35
35
  });
36
- (0, condition_1.assert)(!!quote, "No quote found");
36
+ error_1.MetaAgError.assert(!!quote, "No quote found", error_1.MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
37
37
  return {
38
38
  id: (0, uuid_1.v4)(),
39
39
  provider: metaAg_1.EProvider.CETUS,
@@ -46,7 +46,7 @@ class CetusProvider {
46
46
  };
47
47
  }
48
48
  async swap(options) {
49
- (0, condition_1.assert)(options.quote.provider === metaAg_1.EProvider.CETUS, "Expect Cetus quote");
49
+ error_1.MetaAgError.assert(options.quote.provider === metaAg_1.EProvider.CETUS, "Expect Cetus quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote: options.quote, expectedProvider: metaAg_1.EProvider.CETUS });
50
50
  const coinOut = await this.cetusClient.routerSwap({
51
51
  inputCoin: options.coinIn,
52
52
  router: options.quote.quote,
@@ -5,7 +5,7 @@ const sdk_1 = require("@flowx-finance/sdk");
5
5
  const uuid_1 = require("uuid");
6
6
  const _7k_1 = require("../../../constants/_7k");
7
7
  const metaAg_1 = require("../../../types/metaAg");
8
- const condition_1 = require("../../../utils/condition");
8
+ const error_1 = require("../error");
9
9
  class FlowxProvider {
10
10
  constructor(options, client) {
11
11
  this.options = options;
@@ -36,7 +36,7 @@ class FlowxProvider {
36
36
  };
37
37
  }
38
38
  async swap(options) {
39
- (0, condition_1.assert)(options.quote.provider === metaAg_1.EProvider.FLOWX, "Invalid quote");
39
+ error_1.MetaAgError.assert(options.quote.provider === metaAg_1.EProvider.FLOWX, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote: options.quote, expectedProvider: metaAg_1.EProvider.FLOWX });
40
40
  const builder = new sdk_1.TradeBuilder("mainnet", options.quote.quote.routes);
41
41
  builder.sender(options.signer);
42
42
  builder.slippage(10000 * 100);
@@ -39,11 +39,11 @@ const utils_1 = require("@mysten/sui/utils");
39
39
  const uuid_1 = require("uuid");
40
40
  const tokens_1 = require("../../../constants/tokens");
41
41
  const metaAg_1 = require("../../../types/metaAg");
42
- const condition_1 = require("../../../utils/condition");
43
42
  const sui_1 = require("../../../utils/sui");
44
43
  const common_1 = require("../common");
44
+ const error_1 = require("../error");
45
45
  const API = "https://web3.okx.com";
46
- const SWAP_PATH = "/api/v5/dex/aggregator/swap";
46
+ const SWAP_PATH = "/api/v6/dex/aggregator/swap";
47
47
  const CHAIN_ID = "784";
48
48
  const NORMALIZED_SUI_TYPE = (0, utils_1.normalizeStructTag)(tokens_1.SUI_TYPE);
49
49
  class OkxProvider {
@@ -57,11 +57,11 @@ class OkxProvider {
57
57
  if (!signer || (0, sui_1.isSystemAddress)(signer))
58
58
  return null;
59
59
  const request = {
60
- chainId: CHAIN_ID,
60
+ chainIndex: CHAIN_ID,
61
61
  amount: amountIn,
62
62
  fromTokenAddress: coinTypeIn === NORMALIZED_SUI_TYPE ? tokens_1.SUI_TYPE : coinTypeIn,
63
63
  toTokenAddress: coinTypeOut === NORMALIZED_SUI_TYPE ? tokens_1.SUI_TYPE : coinTypeOut,
64
- slippage: (this.metaOptions.slippageBps / 10000).toString(),
64
+ slippagePercent: (this.metaOptions.slippageBps / 100).toString(),
65
65
  userWalletAddress: signer,
66
66
  };
67
67
  const queryString = "?" + new URLSearchParams(request).toString();
@@ -70,7 +70,7 @@ class OkxProvider {
70
70
  headers: await getHeaders(this.options, "GET", SWAP_PATH, queryString),
71
71
  });
72
72
  const quote = (await response.json());
73
- (0, condition_1.assert)(quote.code === "0" && quote.data.length > 0, "No quote found");
73
+ error_1.MetaAgError.assert(quote.code === "0" && quote.data.length > 0, "No quote found", error_1.MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
74
74
  return {
75
75
  id: (0, uuid_1.v4)(),
76
76
  provider: this.kind,
@@ -84,7 +84,7 @@ class OkxProvider {
84
84
  }
85
85
  async fastSwap(options) {
86
86
  const { quote, signer, signTransaction } = options;
87
- (0, condition_1.assert)(quote.provider === metaAg_1.EProvider.OKX, "Invalid quote");
87
+ error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.OKX, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.OKX });
88
88
  const { tx, coin } = buildTx({ quote, signer });
89
89
  tx.add((0, common_1.metaSettle)(quote, coin, this.metaOptions.slippageBps, this.metaOptions.tipBps, this.metaOptions.partner, this.metaOptions.partnerCommissionBps));
90
90
  tx.transferObjects([coin], signer);
@@ -111,7 +111,7 @@ async function generateHmacSha256(message, secretKey) {
111
111
  if (typeof btoa !== "undefined") {
112
112
  return btoa(binary);
113
113
  }
114
- throw new Error("Base64 encoder not available in this environment");
114
+ throw new error_1.MetaAgError("Base64 encoder not available in this environment");
115
115
  };
116
116
  if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
117
117
  const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secretKey), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
@@ -124,7 +124,7 @@ async function generateHmacSha256(message, secretKey) {
124
124
  async function getHeaders(options, method, requestPath, queryString = "") {
125
125
  const { apiKey, secretKey, apiPassphrase, projectId } = options;
126
126
  if (!apiKey || !secretKey || !apiPassphrase || !projectId) {
127
- throw new Error("Missing required environment variables");
127
+ throw new error_1.MetaAgError("Missing required environment variables");
128
128
  }
129
129
  const timestamp = new Date().toISOString();
130
130
  const stringToSign = timestamp + method + requestPath + queryString;
@@ -145,7 +145,7 @@ const replaceFinalizeCommand = (tx, packageId) => {
145
145
  cmd.MoveCall.module === "router" &&
146
146
  cmd.MoveCall.function === "finalize");
147
147
  const cmd = builder.commands[i];
148
- (0, condition_1.assert)(cmd.MoveCall, "OKX: Finalize command not found");
148
+ error_1.MetaAgError.assert(cmd.MoveCall, "OKX: Finalize command not found", error_1.MetaAgErrorCode.OKX_FINALIZE_COMMAND_NOT_FOUND, { packageId });
149
149
  builder.replaceCommand(i, transactions_1.Commands.MoveCall({
150
150
  package: packageId,
151
151
  module: "router",
@@ -162,7 +162,7 @@ const replaceFinalizeCommand = (tx, packageId) => {
162
162
  };
163
163
  const buildTx = (options) => {
164
164
  const { quote, signer } = options;
165
- (0, condition_1.assert)(quote.provider === metaAg_1.EProvider.OKX, "Invalid quote");
165
+ error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.OKX, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.OKX });
166
166
  const tx = transactions_1.Transaction.from(quote.quote.tx.data);
167
167
  tx.setSenderIfNotSet(signer);
168
168
  const { tx: tx2, coin } = replaceFinalizeCommand(tx, quote.quote.tx.to);
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAY,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAEL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,SAAS,EACT,qBAAqB,EACtB,MAAM,oBAAoB,CA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AA;CAAE,EAEtD,OAAO,CAAC;;;;;CAQT,CAAC;AACF,eAAO,MAAM,cAAc,GACzB,IAAI,WAAW,EACf,WAAW,cAAc,EACzB,YAAY,qBAAqB;wBAmBE,MAAM;;EAG1C,CAAC;AACF,eAAO,MAAM,kBAAkB,GAC7B,UAAU,kBAAkB,EAC5B,OAAO,SAAS,EAChB,YAAY,qBAAqB,EACjC,WAAW,cAAc,EACzB,SAAS,QAAQ,CAAC,aAAa,CAAC;wBATG,MAAM;;;;EAuC1C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,SAAS,EAChB,SAAS,yBAAyB,EAClC,oBAAiB,EACjB,eAAU,EACV,UAAU,MAAM,EAChB,sBAAiB,MAET,IAAI,WAAW,SAqCxB,CAAC;AASF,eAAO,MAAM,OAAO,GAAU,CAAC,GAAG,GAAG,EACnC,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,MAAM,EACf,MAAM,MAAM,eAoBb,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { DevInspectResults } from "@mysten/sui/client";
2
+ import { EProvider, MetaQuote, MetaQuoteOptions } from "../../types/metaAg";
3
+ export declare enum MetaAgErrorCode {
4
+ UNKNOWN = 1000,
5
+ TIMEOUT = 1001,
6
+ PROVIDER_NOT_FOUND = 1002,
7
+ PROVIDER_NOT_SUPPORTED = 1003,
8
+ INVALID_QUOTE = 1004,
9
+ QUOTE_NOT_FOUND = 1005,
10
+ INVALID_SIGNER_ADDRESS = 1006,
11
+ PROVIDER_NOT_SUPPORT_SWAP = 1007,
12
+ SIMULATION_FAILED = 1008,
13
+ OKX_FINALIZE_COMMAND_NOT_FOUND = 1100,
14
+ BLUEFINX_TRANSACTION_NOT_FOUND = 1200,
15
+ BLUEFINX_TRANSACTION_NOT_APPROVED = 1201,
16
+ BLUEFINX_TRANSACTION_DIGEST_NOT_FOUND = 1202
17
+ }
18
+ export type MetaAgErrorDetailsMap = {
19
+ [MetaAgErrorCode.UNKNOWN]: any;
20
+ [MetaAgErrorCode.TIMEOUT]: {
21
+ timeout: number;
22
+ };
23
+ [MetaAgErrorCode.PROVIDER_NOT_FOUND]: {
24
+ provider: EProvider;
25
+ };
26
+ [MetaAgErrorCode.PROVIDER_NOT_SUPPORTED]: {
27
+ provider: EProvider;
28
+ };
29
+ [MetaAgErrorCode.INVALID_QUOTE]: {
30
+ quote: MetaQuote;
31
+ expectedProvider: EProvider;
32
+ };
33
+ [MetaAgErrorCode.QUOTE_NOT_FOUND]: {
34
+ provider: EProvider;
35
+ quoteOptions?: MetaQuoteOptions;
36
+ };
37
+ [MetaAgErrorCode.INVALID_SIGNER_ADDRESS]: {
38
+ signer: string;
39
+ };
40
+ [MetaAgErrorCode.PROVIDER_NOT_SUPPORT_SWAP]: {
41
+ provider: EProvider;
42
+ };
43
+ [MetaAgErrorCode.SIMULATION_FAILED]: {
44
+ error: DevInspectResults["error"];
45
+ };
46
+ [MetaAgErrorCode.OKX_FINALIZE_COMMAND_NOT_FOUND]: {
47
+ packageId: string;
48
+ };
49
+ [MetaAgErrorCode.BLUEFINX_TRANSACTION_NOT_FOUND]: Record<string, never>;
50
+ [MetaAgErrorCode.BLUEFINX_TRANSACTION_NOT_APPROVED]: Record<string, never>;
51
+ [MetaAgErrorCode.BLUEFINX_TRANSACTION_DIGEST_NOT_FOUND]: Record<string, never>;
52
+ };
53
+ export type MetaAgErrorDetails<T extends MetaAgErrorCode> = T extends keyof MetaAgErrorDetailsMap ? MetaAgErrorDetailsMap[T] : never;
54
+ export declare class MetaAgError<T extends MetaAgErrorCode> extends Error {
55
+ code: T;
56
+ details?: MetaAgErrorDetails<T>;
57
+ constructor(message: string, code?: T, details?: MetaAgErrorDetails<T>);
58
+ static assert<T extends MetaAgErrorCode>(condition: any, message?: string | null, code?: T, details?: MetaAgErrorDetails<T>): asserts condition;
59
+ }
60
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts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,EAAE,EAAE,EAAE,eAAe;CAW1D"}
1
+ {"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/astro.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,aAAa,EAAE,kBAAkB;IAEzD,OAAO,CAAC,QAAQ,CAAC,OAAO;IADpC,QAAQ,CAAC,IAAI,mBAAmB;gBACH,OAAO,EAAE,oBAAoB;IAEpD,KAAK,CAAC,EACV,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IA8BzC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,eAAe;CAgB1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"bluefin7k.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin7k.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,iBAAkB,YAAW,aAAa,EAAE,kBAAkB;IAGvE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAH9B,QAAQ,CAAC,IAAI,uBAAuB;gBAEjB,OAAO,EAAE,wBAAwB,EACjC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACrD,MAAM,EAAE,SAAS;IAMb,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAsBzD,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe;CAiB1D"}
1
+ {"version":3,"file":"bluefin7k.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin7k.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,iBAAkB,YAAW,aAAa,EAAE,kBAAkB;IAGvE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAH9B,QAAQ,CAAC,IAAI,uBAAuB;gBAEjB,OAAO,EAAE,wBAAwB,EACjC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACrD,MAAM,EAAE,SAAS;IAMb,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA2BzD,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe;CAsB1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"bluefin7kLegacy.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin7kLegacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,qBAAa,qBACX,YAAW,aAAa,EAAE,kBAAkB;IAI1C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAH9B,QAAQ,CAAC,IAAI,8BAA8B;gBAExB,OAAO,EAAE,4BAA4B,EACrC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACrD,MAAM,EAAE,SAAS;IAgBb,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAqBpD,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe;CAiB1D"}
1
+ {"version":3,"file":"bluefin7kLegacy.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin7kLegacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,qBAAa,qBACX,YAAW,aAAa,EAAE,kBAAkB;IAI1C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAH9B,QAAQ,CAAC,IAAI,8BAA8B;gBAExB,OAAO,EAAE,4BAA4B,EACrC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACrD,MAAM,EAAE,SAAS;IAgBb,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAqBpD,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe;CAsB1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"bluefinx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefinx.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAU/B,qBAAa,gBAAiB,YAAW,aAAa,EAAE,eAAe;IAEzD,OAAO,CAAC,QAAQ,CAAC,OAAO;IADpC,QAAQ,CAAC,IAAI,sBAAsB;gBACN,OAAO,EAAE,uBAAuB;IAKvD,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAqBjE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAStC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAiC9D"}
1
+ {"version":3,"file":"bluefinx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefinx.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAU/B,qBAAa,gBAAiB,YAAW,aAAa,EAAE,eAAe;IAEzD,OAAO,CAAC,QAAQ,CAAC,OAAO;IADpC,QAAQ,CAAC,IAAI,sBAAsB;gBACN,OAAO,EAAE,uBAAuB;IAKvD,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAqBjE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAStC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAqD9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,aAAa,EAAE,kBAAkB;IAInE,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,QAAQ,CAAC,IAAI,mBAAmB;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAE5B,OAAO,EAAE,oBAAoB,EAC9C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,SAAS;IAab,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA0BzD,IAAI,CAAC,OAAO,EAAE,eAAe;CAUpC"}
1
+ {"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,aAAa,EAAE,kBAAkB;IAInE,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,QAAQ,CAAC,IAAI,mBAAmB;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAE5B,OAAO,EAAE,oBAAoB,EAC9C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,SAAS;IAab,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA+BzD,IAAI,CAAC,OAAO,EAAE,eAAe;CAepC"}
@@ -1 +1 @@
1
- {"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,aAAa,EAAE,kBAAkB;IAInE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,QAAQ,CAAC,IAAI,mBAAmB;IAChC,OAAO,CAAC,MAAM,CAAmB;gBAEd,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,SAAS;IAK9B,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAqBzE"}
1
+ {"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,aAAa,EAAE,kBAAkB;IAInE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,QAAQ,CAAC,IAAI,mBAAmB;IAChC,OAAO,CAAC,MAAM,CAAmB;gBAEd,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,SAAS;IAK9B,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CA0BzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"okx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/okx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAc/C,OAAO,EACL,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EAErB,kBAAkB,EAClB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,qBAAa,WAAY,YAAW,aAAa,EAAE,eAAe;IAG9D,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,QAAQ,CAAC,IAAI,iBAAiB;gBAEX,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACpC,MAAM,EAAE,SAAS;IAG9B,KAAK,CAAC,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,MAAM,GACP,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IA+BzC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAuB9D;AAyGD,eAAO,MAAM,eAAe,GAC1B,CAAC,SAAS,SAAS,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAA;CAAE,EAEjD,OAAO,CAAC,EACR,WAAW,cAAc,EACzB,YAAY,qBAAqB,EACjC,aAAa,QAAQ,CAAC,aAAa,CAAC;;;;;EAoBrC,CAAC"}
1
+ {"version":3,"file":"okx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/okx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAc/C,OAAO,EACL,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EAErB,kBAAkB,EAClB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAQ/D,qBAAa,WAAY,YAAW,aAAa,EAAE,eAAe;IAG9D,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,QAAQ,CAAC,IAAI,iBAAiB;gBAEX,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACpC,MAAM,EAAE,SAAS;IAG9B,KAAK,CAAC,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,MAAM,GACP,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAoCzC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CA4B9D;AAmHD,eAAO,MAAM,eAAe,GAC1B,CAAC,SAAS,SAAS,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAA;CAAE,EAEjD,OAAO,CAAC,EACR,WAAW,cAAc,EACzB,YAAY,qBAAqB,EACjC,aAAa,QAAQ,CAAC,aAAa,CAAC;;;;;EAoBrC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
3
  * OKX DEX Swap API Types
4
- * Documentation: https://web3.okx.com/vi/build/docs/waas/dex-swap
4
+ * Documentation: https://web3.okx.com/vi/build/dev-docs/wallet-api/dex-swap
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });