@7kprotocol/sdk-ts 1.3.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -1
- package/lib/cjs/buildTx.js +13 -5
- package/lib/cjs/estimateGasFee.js +3 -3
- package/lib/cjs/libs/getSplitCoinForTx.js +5 -14
- package/lib/cjs/libs/protocols/aftermath/index.js +1 -1
- package/lib/cjs/libs/protocols/base.js +1 -1
- package/lib/cjs/libs/protocols/cetus/index.js +4 -4
- package/lib/cjs/libs/protocols/deepbook/index.js +1 -1
- package/lib/cjs/libs/protocols/kriyaV3/index.js +4 -4
- package/lib/cjs/libs/protocols/suiswap/index.js +2 -2
- package/lib/cjs/libs/protocols/turbos/index.js +2 -2
- package/lib/cjs/suiClient.js +1 -1
- package/lib/cjs/types/buildTx.d.ts +2 -2
- package/lib/cjs/types/buildTx.d.ts.map +1 -1
- package/lib/cjs/types/estimateGasFee.d.ts +1 -1
- package/lib/cjs/types/estimateGasFee.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +1 -1
- package/lib/cjs/types/libs/getCoinOjectIdsByAmount.d.ts +1 -1
- package/lib/cjs/types/libs/getCoinOjectIdsByAmount.d.ts.map +1 -1
- package/lib/cjs/types/libs/getSplitCoinForTx.d.ts +3 -3
- package/lib/cjs/types/libs/getSplitCoinForTx.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/aftermath/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/aftermath/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/base.d.ts +3 -22
- package/lib/cjs/types/libs/protocols/base.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/bluemove/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/bluemove/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/cetus/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/cetus/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/deepbook/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/deepbook/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/flowx/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/flowx/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts +4 -5
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/swapWithRoute.d.ts +2 -2
- package/lib/cjs/types/libs/swapWithRoute.d.ts.map +1 -1
- package/lib/cjs/types/suiClient.d.ts +1 -1
- package/lib/cjs/types/suiClient.d.ts.map +1 -1
- package/lib/cjs/types/types/sui.d.ts +1 -1
- package/lib/cjs/types/types/sui.d.ts.map +1 -1
- package/lib/cjs/types/types/tx.d.ts +5 -2
- package/lib/cjs/types/types/tx.d.ts.map +1 -1
- package/lib/cjs/types/utils/sui.d.ts +10 -11
- package/lib/cjs/types/utils/sui.d.ts.map +1 -1
- package/lib/cjs/utils/sui.js +8 -9
- package/lib/esm/buildTx.js +13 -5
- package/lib/esm/estimateGasFee.js +3 -3
- package/lib/esm/libs/getSplitCoinForTx.js +5 -14
- package/lib/esm/libs/protocols/aftermath/index.js +1 -1
- package/lib/esm/libs/protocols/base.js +1 -1
- package/lib/esm/libs/protocols/cetus/index.js +4 -4
- package/lib/esm/libs/protocols/deepbook/index.js +1 -1
- package/lib/esm/libs/protocols/kriyaV3/index.js +4 -4
- package/lib/esm/libs/protocols/suiswap/index.js +2 -2
- package/lib/esm/libs/protocols/turbos/index.js +2 -2
- package/lib/esm/suiClient.js +1 -1
- package/lib/esm/types/buildTx.d.ts +2 -2
- package/lib/esm/types/buildTx.d.ts.map +1 -1
- package/lib/esm/types/estimateGasFee.d.ts +1 -1
- package/lib/esm/types/estimateGasFee.d.ts.map +1 -1
- package/lib/esm/types/index.d.ts +1 -1
- package/lib/esm/types/libs/getCoinOjectIdsByAmount.d.ts +1 -1
- package/lib/esm/types/libs/getCoinOjectIdsByAmount.d.ts.map +1 -1
- package/lib/esm/types/libs/getSplitCoinForTx.d.ts +3 -3
- package/lib/esm/types/libs/getSplitCoinForTx.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/aftermath/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/aftermath/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/base.d.ts +3 -22
- package/lib/esm/types/libs/protocols/base.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/bluemove/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/bluemove/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/cetus/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/cetus/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/deepbook/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/deepbook/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/flowx/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/flowx/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/kriya/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/kriya/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/turbos/index.d.ts +4 -5
- package/lib/esm/types/libs/protocols/turbos/index.d.ts.map +1 -1
- package/lib/esm/types/libs/swapWithRoute.d.ts +2 -2
- package/lib/esm/types/libs/swapWithRoute.d.ts.map +1 -1
- package/lib/esm/types/suiClient.d.ts +1 -1
- package/lib/esm/types/suiClient.d.ts.map +1 -1
- package/lib/esm/types/types/sui.d.ts +1 -1
- package/lib/esm/types/types/sui.d.ts.map +1 -1
- package/lib/esm/types/types/tx.d.ts +5 -2
- package/lib/esm/types/types/tx.d.ts.map +1 -1
- package/lib/esm/types/utils/sui.d.ts +10 -11
- package/lib/esm/types/utils/sui.d.ts.map +1 -1
- package/lib/esm/utils/sui.js +8 -9
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { TxSorSwap } from "../../types/aggregator";
|
|
3
3
|
import { TransactionResultItem } from "../../types/sui";
|
|
4
4
|
export interface BaseContractParams {
|
|
@@ -11,27 +11,8 @@ export declare abstract class BaseContract {
|
|
|
11
11
|
protected inputCoinObject: TransactionResultItem;
|
|
12
12
|
protected currentAccount: string;
|
|
13
13
|
constructor({ swapInfo, inputCoinObject, currentAccount, }: BaseContractParams);
|
|
14
|
-
abstract swap(tx:
|
|
15
|
-
protected getInputCoinValue(tx:
|
|
16
|
-
index: number;
|
|
17
|
-
kind: "Input";
|
|
18
|
-
value?: any;
|
|
19
|
-
type?: "object" | undefined;
|
|
20
|
-
} | {
|
|
21
|
-
index: number;
|
|
22
|
-
kind: "Input";
|
|
23
|
-
type: "pure";
|
|
24
|
-
value?: any;
|
|
25
|
-
} | {
|
|
26
|
-
kind: "GasCoin";
|
|
27
|
-
} | {
|
|
28
|
-
index: number;
|
|
29
|
-
kind: "Result";
|
|
30
|
-
} | {
|
|
31
|
-
index: number;
|
|
32
|
-
resultIndex: number;
|
|
33
|
-
kind: "NestedResult";
|
|
34
|
-
};
|
|
14
|
+
abstract swap(tx: Transaction): Promise<TransactionResultItem>;
|
|
15
|
+
protected getInputCoinValue(tx: Transaction): import("@mysten/sui/transactions").TransactionArgument;
|
|
35
16
|
protected getTypeParams(): string[];
|
|
36
17
|
}
|
|
37
18
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC9B,SAAS,CAAC,eAAe,EAAE,qBAAqB,CAAC;IACjD,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;gBAErB,EACV,QAAQ,EACR,eAAe,EACf,cAAc,GACf,EAAE,kBAAkB;IAMrB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAE9D,SAAS,CAAC,iBAAiB,CAAC,EAAE,EAAE,WAAW;IAQ3C,SAAS,CAAC,aAAa;CAKxB"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class BluemoveContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/bluemove/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/bluemove/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAoB3B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class CetusContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/cetus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/cetus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAyC3B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class DeepBookContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
private createAccountCap;
|
|
10
9
|
private deleteAccountCap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/deepbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/deepbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;IA+D1B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;CAMzB"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class FlowXContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/flowx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/flowx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAY3B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class KriyaContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriya/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriya/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAyB3B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class KriyaV3Contract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriyaV3/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriyaV3/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA+D3B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class SuiswapContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/suiswap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/suiswap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA2B3B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
export declare class TurbosContract extends BaseContract {
|
|
4
|
-
swap(tx:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
kind: "NestedResult";
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
8
7
|
}>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/turbos/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/turbos/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUvC,qBAAa,cAAe,SAAQ,YAAY;IACxC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAqC3B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { TxSorSwap } from "../types/aggregator";
|
|
3
3
|
import { TransactionResultItem } from "../types/sui";
|
|
4
4
|
export declare function swapWithRoute({ route, inputCoinObject, currentAccount, tx, }: {
|
|
5
5
|
route: TxSorSwap[];
|
|
6
6
|
inputCoinObject: TransactionResultItem;
|
|
7
7
|
currentAccount: string;
|
|
8
|
-
tx:
|
|
8
|
+
tx: Transaction;
|
|
9
9
|
}): Promise<TransactionResultItem | undefined>;
|
|
10
10
|
//# sourceMappingURL=swapWithRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swapWithRoute.d.ts","sourceRoot":"","sources":["../../../../src/libs/swapWithRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"swapWithRoute.d.ts","sourceRoot":"","sources":["../../../../src/libs/swapWithRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,eAAe,EACf,cAAc,EACd,EAAE,GACH,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,WAAW,CAAC;CACjB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAiB7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suiClient.d.ts","sourceRoot":"","sources":["../../../src/suiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"suiClient.d.ts","sourceRoot":"","sources":["../../../src/suiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAM/D,wBAAgB,YAAY,cAE3B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,QAE7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/types/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/types/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
2
|
import { Commission, QuoteResponse } from "./aggregator";
|
|
3
3
|
import BigNumber from "bignumber.js";
|
|
4
4
|
export interface CommonParams {
|
|
5
|
-
tx?: TransactionBlock;
|
|
6
5
|
quoteResponse: QuoteResponse;
|
|
7
6
|
accountAddress: string;
|
|
8
7
|
slippage: BigNumber.Value;
|
|
9
8
|
commission: Commission;
|
|
9
|
+
extendTx?: {
|
|
10
|
+
tx: Transaction;
|
|
11
|
+
coinIn?: TransactionObjectArgument;
|
|
12
|
+
};
|
|
10
13
|
}
|
|
11
14
|
export interface BuildTxParams extends CommonParams {
|
|
12
15
|
isGasEstimate?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../../../src/types/tx.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../../../src/types/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,WAAW,CAAC;QAChB,MAAM,CAAC,EAAE,yBAAyB,CAAC;KACpC,CAAC;CACH;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransactionArgument,
|
|
2
|
-
import { CoinStruct, SuiObjectResponseQuery } from "@mysten/sui
|
|
1
|
+
import { TransactionArgument, Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { CoinStruct, SuiObjectResponseQuery } from "@mysten/sui/client";
|
|
3
3
|
type DataPage<T> = {
|
|
4
4
|
data: T[];
|
|
5
5
|
nextCursor?: any;
|
|
@@ -11,19 +11,18 @@ type PageQuery = {
|
|
|
11
11
|
};
|
|
12
12
|
type PaginationArgs = "all" | PageQuery;
|
|
13
13
|
export declare const SuiUtils: {
|
|
14
|
-
getSuiCoin(amount: bigint | TransactionArgument, txb:
|
|
15
|
-
mergeCoins(coinObjects: Array<string | TransactionArgument>, txb:
|
|
16
|
-
getCoinValue(coinType: string, coinObject: string | TransactionArgument, txb:
|
|
14
|
+
getSuiCoin(amount: bigint | TransactionArgument, txb: Transaction): TransactionArgument;
|
|
15
|
+
mergeCoins(coinObjects: Array<string | TransactionArgument>, txb: Transaction): TransactionArgument | undefined;
|
|
16
|
+
getCoinValue(coinType: string, coinObject: string | TransactionArgument, txb: Transaction): TransactionArgument;
|
|
17
17
|
getExactCoinByAmount(coinType: string, coins: {
|
|
18
18
|
objectId: string;
|
|
19
19
|
balance: bigint;
|
|
20
|
-
}[], amount: bigint, txb:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
kind: "NestedResult";
|
|
20
|
+
}[], amount: bigint, txb: Transaction): {
|
|
21
|
+
$kind: "NestedResult";
|
|
22
|
+
NestedResult: [number, number];
|
|
24
23
|
};
|
|
25
|
-
mergeAllUserCoins(coinType: string, signerAddress: string): Promise<
|
|
26
|
-
mergeAllCoinsWithoutFetch(coins: CoinStruct[], coinType: string, txb:
|
|
24
|
+
mergeAllUserCoins(coinType: string, signerAddress: string): Promise<Transaction | undefined>;
|
|
25
|
+
mergeAllCoinsWithoutFetch(coins: CoinStruct[], coinType: string, txb: Transaction): void;
|
|
27
26
|
getAllUserCoins({ address, type }: {
|
|
28
27
|
type: string;
|
|
29
28
|
address: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/utils/sui.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/utils/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACL,UAAU,EAEV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAK5B,KAAK,QAAQ,CAAC,CAAC,IAAI;IACjB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAExC,eAAO,MAAM,QAAQ;uBAET,MAAM,GAAG,mBAAmB,OAC/B,WAAW,GACf,mBAAmB;4BAMP,KAAK,CAAC,MAAM,GAAG,mBAAmB,CAAC,OAC3C,WAAW,GACf,mBAAmB,GAAG,SAAS;2BAsBtB,MAAM,cACJ,MAAM,GAAG,mBAAmB,OACnC,WAAW,GACf,mBAAmB;mCAYV,MAAM,SACT;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,UACtC,MAAM,OACT,WAAW;;;;gCAoBgB,MAAM,iBAAiB,MAAM;qCAoCtD,UAAU,EAAE,YACT,MAAM,OACX,WAAW;uCAsBuB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;sCA8BhE,MAAM,SACP;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;iCA6BvC,MAAM,SACN,sBAAsB,mBACb,cAAc,GAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;4BAyBD,MAAM;CAO/B,CAAC"}
|
package/lib/esm/utils/sui.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { parseStructTag } from "@mysten/sui
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { parseStructTag } from "@mysten/sui/utils";
|
|
3
3
|
import { checkIsSui } from "./token";
|
|
4
4
|
import { getSuiClient } from "../suiClient";
|
|
5
5
|
export const SuiUtils = {
|
|
6
6
|
getSuiCoin(amount, txb) {
|
|
7
|
-
const
|
|
8
|
-
const [coin] = txb.splitCoins(txb.gas, [inputCoinAmount]);
|
|
7
|
+
const [coin] = txb.splitCoins(txb.gas, [amount]);
|
|
9
8
|
return coin;
|
|
10
9
|
},
|
|
11
10
|
mergeCoins(coinObjects, txb) {
|
|
@@ -36,7 +35,7 @@ export const SuiUtils = {
|
|
|
36
35
|
},
|
|
37
36
|
getExactCoinByAmount(coinType, coins, amount, txb) {
|
|
38
37
|
if (checkIsSui(coinType)) {
|
|
39
|
-
const [coinA] = txb.splitCoins(txb.gas, [
|
|
38
|
+
const [coinA] = txb.splitCoins(txb.gas, [amount]);
|
|
40
39
|
return coinA;
|
|
41
40
|
}
|
|
42
41
|
else {
|
|
@@ -44,7 +43,7 @@ export const SuiUtils = {
|
|
|
44
43
|
if (coinsX.length > 1) {
|
|
45
44
|
txb.mergeCoins(txb.object(coinsX[0]), coinsX.slice(1).map((coin) => txb.object(coin)));
|
|
46
45
|
}
|
|
47
|
-
const [coinA] = txb.splitCoins(txb.object(coinsX[0]), [
|
|
46
|
+
const [coinA] = txb.splitCoins(txb.object(coinsX[0]), [amount]);
|
|
48
47
|
return coinA;
|
|
49
48
|
}
|
|
50
49
|
},
|
|
@@ -58,10 +57,10 @@ export const SuiUtils = {
|
|
|
58
57
|
coins.forEach((coin) => {
|
|
59
58
|
totalBalance += BigInt(coin.balance);
|
|
60
59
|
});
|
|
61
|
-
const txb = new
|
|
60
|
+
const txb = new Transaction();
|
|
62
61
|
if (checkIsSui(coinType)) {
|
|
63
62
|
totalBalance = totalBalance - BigInt("1000");
|
|
64
|
-
txb.splitCoins(txb.gas, [
|
|
63
|
+
txb.splitCoins(txb.gas, [totalBalance]);
|
|
65
64
|
}
|
|
66
65
|
const coinObjectsIds = coins.map((coin) => coin.coinObjectId);
|
|
67
66
|
if (coins.length > 1) {
|
|
@@ -80,7 +79,7 @@ export const SuiUtils = {
|
|
|
80
79
|
});
|
|
81
80
|
if (checkIsSui(coinType)) {
|
|
82
81
|
totalBalance = totalBalance - BigInt("1000");
|
|
83
|
-
txb.splitCoins(txb.gas, [
|
|
82
|
+
txb.splitCoins(txb.gas, [totalBalance]);
|
|
84
83
|
}
|
|
85
84
|
const coinObjectsIds = coins.map((coin) => coin.coinObjectId);
|
|
86
85
|
if (coins.length > 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7kprotocol/sdk-ts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript-eslint": "^7.15.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@mysten/sui
|
|
66
|
+
"@mysten/sui": "^1.5.0",
|
|
67
67
|
"bignumber.js": "^9.1.2",
|
|
68
68
|
"bn.js": "^5.2.1"
|
|
69
69
|
}
|