@7kprotocol/sdk-ts 3.4.2-beta.8 → 3.4.2-beta.9
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/lib/cjs/features/metaAg/index.js +9 -3
- package/lib/cjs/features/metaAg/providers/bluefin.js +2 -2
- package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/esm/features/metaAg/index.js +9 -3
- package/lib/esm/features/metaAg/providers/bluefin.js +2 -2
- package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.MetaAg = void 0;
|
|
37
37
|
const client_1 = require("@mysten/sui/client");
|
|
38
38
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
39
|
+
const utils_1 = require("@mysten/sui/utils");
|
|
39
40
|
const _7k_1 = require("../../constants/_7k");
|
|
40
41
|
const sui_1 = require("../../constants/sui");
|
|
41
42
|
const metaAg_1 = require("../../types/metaAg");
|
|
@@ -110,8 +111,8 @@ class MetaAg {
|
|
|
110
111
|
sender: simulation.sender,
|
|
111
112
|
transactionBlock: tx,
|
|
112
113
|
}), simulation.timeout ?? 2000, `simulation for ${provider.kind} provider with id ${id}`);
|
|
113
|
-
if (res.effects.status.status ===
|
|
114
|
-
throw new Error(res.error ??
|
|
114
|
+
if (res.effects.status.status === "failure") {
|
|
115
|
+
throw new Error(res.error ?? "Simulation failed");
|
|
115
116
|
}
|
|
116
117
|
const amountOut = extractAmountOutWrapper(res.events);
|
|
117
118
|
return {
|
|
@@ -150,9 +151,14 @@ class MetaAg {
|
|
|
150
151
|
* @returns quotes from all providers
|
|
151
152
|
*/
|
|
152
153
|
async quote(options, simulation) {
|
|
154
|
+
const opts = {
|
|
155
|
+
...options,
|
|
156
|
+
coinInType: (0, utils_1.normalizeStructTag)(options.coinInType),
|
|
157
|
+
coinOutType: (0, utils_1.normalizeStructTag)(options.coinOutType),
|
|
158
|
+
};
|
|
153
159
|
const quotes = await Promise.allSettled(Object.keys(this.options.providers).map(async (provider) => {
|
|
154
160
|
const p = await this._getProvider(provider);
|
|
155
|
-
return this._quote(p,
|
|
161
|
+
return this._quote(p, opts, simulation);
|
|
156
162
|
}));
|
|
157
163
|
return quotes
|
|
158
164
|
.map((quote) => quote.status === "fulfilled"
|
|
@@ -45,8 +45,8 @@ class BluefinProvider {
|
|
|
45
45
|
amountIn: quote.swapAmountWithDecimal,
|
|
46
46
|
rawAmountOut: quote.returnAmountWithDecimal,
|
|
47
47
|
amountOut: expectedAmount,
|
|
48
|
-
coinTypeIn:
|
|
49
|
-
coinTypeOut:
|
|
48
|
+
coinTypeIn: options.coinInType,
|
|
49
|
+
coinTypeOut: options.coinOutType,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
async swap({ quote, signer, tx, coinIn }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAML,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAa5B,qBAAa,MAAM;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,OAAO,CAA0B;gBAC7B,OAAO,CAAC,EAAE,aAAa;YAkBrB,YAAY;YAyCZ,SAAS;YAqDT,MAAM;IA0BpB;;;;;OAKG;IACG,KAAK,CACT,OAAO,EAAE,gBAAgB,EACzB,UAAU,CAAC,EAAE,qBAAqB,GACjC,OAAO,CAAC,SAAS,EAAE,CAAC;IAqBvB;;;;;OAKG;IACG,IAAI,CACR,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,CAAC;IAkBrC;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,aAAa;CA4B3C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getFullnodeUrl, SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { coinWithBalance, Transaction, } from "@mysten/sui/transactions";
|
|
3
|
+
import { normalizeStructTag } from "@mysten/sui/utils";
|
|
3
4
|
import { _7K_META_CONFIG, _7K_META_PACKAGE_ID, _7K_META_PUBLISHED_AT, _7K_META_VAULT, } from "../../constants/_7k";
|
|
4
5
|
import { SUI_ADDRESS_ZERO } from "../../constants/sui";
|
|
5
6
|
import { EProvider, } from "../../types/metaAg";
|
|
@@ -77,8 +78,8 @@ export class MetaAg {
|
|
|
77
78
|
sender: simulation.sender,
|
|
78
79
|
transactionBlock: tx,
|
|
79
80
|
}), simulation.timeout ?? 2000, `simulation for ${provider.kind} provider with id ${id}`);
|
|
80
|
-
if (res.effects.status.status ===
|
|
81
|
-
throw new Error(res.error ??
|
|
81
|
+
if (res.effects.status.status === "failure") {
|
|
82
|
+
throw new Error(res.error ?? "Simulation failed");
|
|
82
83
|
}
|
|
83
84
|
const amountOut = extractAmountOutWrapper(res.events);
|
|
84
85
|
return {
|
|
@@ -117,9 +118,14 @@ export class MetaAg {
|
|
|
117
118
|
* @returns quotes from all providers
|
|
118
119
|
*/
|
|
119
120
|
async quote(options, simulation) {
|
|
121
|
+
const opts = {
|
|
122
|
+
...options,
|
|
123
|
+
coinInType: normalizeStructTag(options.coinInType),
|
|
124
|
+
coinOutType: normalizeStructTag(options.coinOutType),
|
|
125
|
+
};
|
|
120
126
|
const quotes = await Promise.allSettled(Object.keys(this.options.providers).map(async (provider) => {
|
|
121
127
|
const p = await this._getProvider(provider);
|
|
122
|
-
return this._quote(p,
|
|
128
|
+
return this._quote(p, opts, simulation);
|
|
123
129
|
}));
|
|
124
130
|
return quotes
|
|
125
131
|
.map((quote) => quote.status === "fulfilled"
|
|
@@ -44,8 +44,8 @@ export class BluefinProvider {
|
|
|
44
44
|
amountIn: quote.swapAmountWithDecimal,
|
|
45
45
|
rawAmountOut: quote.returnAmountWithDecimal,
|
|
46
46
|
amountOut: expectedAmount,
|
|
47
|
-
coinTypeIn:
|
|
48
|
-
coinTypeOut:
|
|
47
|
+
coinTypeIn: options.coinInType,
|
|
48
|
+
coinTypeOut: options.coinOutType,
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
async swap({ quote, signer, tx, coinIn }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAML,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAa5B,qBAAa,MAAM;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,OAAO,CAA0B;gBAC7B,OAAO,CAAC,EAAE,aAAa;YAkBrB,YAAY;YAyCZ,SAAS;YAqDT,MAAM;IA0BpB;;;;;OAKG;IACG,KAAK,CACT,OAAO,EAAE,gBAAgB,EACzB,UAAU,CAAC,EAAE,qBAAqB,GACjC,OAAO,CAAC,SAAS,EAAE,CAAC;IAqBvB;;;;;OAKG;IACG,IAAI,CACR,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,CAAC;IAkBrC;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,aAAa;CA4B3C"}
|