@7kprotocol/sdk-ts 3.0.0 → 3.0.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.
- package/lib/cjs/features/swap/buildTx.js +1 -1
- package/lib/cjs/features/swap/config.js +8 -8
- package/lib/cjs/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/config.d.ts.map +1 -1
- package/lib/cjs/types/utils/sui.d.ts +2 -1
- package/lib/cjs/types/utils/sui.d.ts.map +1 -1
- package/lib/cjs/utils/sui.js +8 -1
- package/lib/esm/features/swap/buildTx.js +1 -1
- package/lib/esm/features/swap/config.js +8 -8
- package/lib/esm/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/esm/types/features/swap/config.d.ts.map +1 -1
- package/lib/esm/types/utils/sui.d.ts +2 -1
- package/lib/esm/types/utils/sui.d.ts.map +1 -1
- package/lib/esm/utils/sui.js +8 -1
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ const buildTx = async ({ quoteResponse, accountAddress, slippage, commission: __
|
|
|
41
41
|
let coinData;
|
|
42
42
|
if (coinIn) {
|
|
43
43
|
coinData = tx.splitCoins(coinIn, splits);
|
|
44
|
-
sui_1.SuiUtils.
|
|
44
|
+
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, quoteResponse.tokenIn, coinIn, accountAddress);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
const { coinData: _data } = await (0, getSplitCoinForTx_1.getSplitCoinForTx)(accountAddress, quoteResponse.swapAmountWithDecimal, splits, (0, token_1.denormalizeTokenType)(quoteResponse.tokenIn), tx, devInspect, isSponsored || isBluefinX);
|
|
@@ -16,7 +16,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
16
16
|
},
|
|
17
17
|
bluefin: {
|
|
18
18
|
name: "Bluefin",
|
|
19
|
-
package: "
|
|
19
|
+
package: "0x406f52151e7dd65addd93b0bdad7989e82aec20c3ae6971954a5140f14a59e4b",
|
|
20
20
|
globalConfig: "0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352",
|
|
21
21
|
},
|
|
22
22
|
bluefinx: {
|
|
@@ -31,7 +31,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
31
31
|
},
|
|
32
32
|
cetus: {
|
|
33
33
|
name: "Cetus",
|
|
34
|
-
package: "
|
|
34
|
+
package: "0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187",
|
|
35
35
|
globalConfig: "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",
|
|
36
36
|
},
|
|
37
37
|
deepbook_v3: {
|
|
@@ -47,7 +47,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
47
47
|
},
|
|
48
48
|
flowx_v3: {
|
|
49
49
|
name: "Flowx Finance V3",
|
|
50
|
-
package: "
|
|
50
|
+
package: "0x3974baf3c1fb21edba6407feff33e77c8fd05670b5cd8815e8fdc289b1f30267",
|
|
51
51
|
registry: "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc",
|
|
52
52
|
version: "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",
|
|
53
53
|
},
|
|
@@ -57,7 +57,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
57
57
|
},
|
|
58
58
|
kriya_v3: {
|
|
59
59
|
name: "Kriya V3",
|
|
60
|
-
package: "
|
|
60
|
+
package: "0x7cfee19b76f44a30cd7b8edcbb24eff1cc3fdc3495d3d07e99f1af46f5719861",
|
|
61
61
|
version: "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78",
|
|
62
62
|
},
|
|
63
63
|
obric: {
|
|
@@ -84,13 +84,13 @@ exports.DEFAULT_CONFIG = {
|
|
|
84
84
|
},
|
|
85
85
|
steamm: {
|
|
86
86
|
name: "Steamm",
|
|
87
|
-
package: "
|
|
88
|
-
script: "
|
|
87
|
+
package: "0x4454d95507deb17d5017db11105bd95027d434776af1d0049ce27a3510a9a1ba",
|
|
88
|
+
script: "0xa5eda33c0829a546b55fdf0bb1ad88175df00e1c72690b79ac966c49082b9834",
|
|
89
89
|
oracle: "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b",
|
|
90
90
|
},
|
|
91
91
|
magma: {
|
|
92
92
|
name: "Magma",
|
|
93
|
-
package: "
|
|
93
|
+
package: "0x97aa7a842f53ccafc3514fb875fee9b9cd65cf9e6e39087ee327c94f77a4e319",
|
|
94
94
|
globalConfig: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
95
95
|
},
|
|
96
96
|
haedal_pmm: {
|
|
@@ -99,7 +99,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
99
99
|
},
|
|
100
100
|
momentum: {
|
|
101
101
|
name: "Momentum",
|
|
102
|
-
package: "
|
|
102
|
+
package: "0x9c12f3aa14a449a0a23c066589e269086f021a98939f21158cfacb16d19787c3",
|
|
103
103
|
version: "0x2375a0b1ec12010aaea3b2545acfa2ad34cfbba03ce4b59f4c39e1e25eed1b2a",
|
|
104
104
|
},
|
|
105
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,aAAa,EAGd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,OAAO,GAAU,2GAQ3B,aAAa,KAAG,OAAO,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,aAAa,EAGd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,OAAO,GAAU,2GAQ3B,aAAa,KAAG,OAAO,CAAC,aAAa,CA4IvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,MAyI5B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,MAyI5B,CAAC;AAIF,wBAAsB,SAAS,oBAe9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransactionArgument, Transaction } from "@mysten/sui/transactions";
|
|
2
1
|
import { CoinStruct, SuiObjectResponseQuery } from "@mysten/sui/client";
|
|
2
|
+
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
3
3
|
type DataPage<T> = {
|
|
4
4
|
data: T[];
|
|
5
5
|
nextCursor?: any;
|
|
@@ -50,6 +50,7 @@ export declare const SuiUtils: {
|
|
|
50
50
|
NestedResult: [number, number];
|
|
51
51
|
};
|
|
52
52
|
collectDust(tx: Transaction, coinType: string, coin: TransactionArgument): void;
|
|
53
|
+
transferOrDestroyZeroCoin(tx: Transaction, coinType: string, coin: TransactionArgument, address: string): void;
|
|
53
54
|
};
|
|
54
55
|
export {};
|
|
55
56
|
//# sourceMappingURL=sui.d.ts.map
|
|
@@ -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,EACL,UAAU,EAEV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM5E,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;oBAQd,WAAW,YAAY,MAAM;;;;iBAQhC,WAAW,YAAY,MAAM;;;;wBASpC,WAAW,YACL,MAAM,cACJ,mBAAmB;;;;wBAU3B,WAAW,YACL,MAAM,WACP,mBAAmB;;;;oBASd,WAAW,YAAY,MAAM,QAAQ,mBAAmB;kCASlE,WAAW,YACL,MAAM,QACV,mBAAmB,WAChB,MAAM;CAQlB,CAAC"}
|
package/lib/cjs/utils/sui.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SuiUtils = void 0;
|
|
4
4
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
5
5
|
const utils_1 = require("@mysten/sui/utils");
|
|
6
|
-
const token_1 = require("./token");
|
|
7
6
|
const config_1 = require("../config");
|
|
8
7
|
const _7k_1 = require("../constants/_7k");
|
|
8
|
+
const token_1 = require("./token");
|
|
9
9
|
exports.SuiUtils = {
|
|
10
10
|
getSuiCoin(amount, txb) {
|
|
11
11
|
const [coin] = txb.splitCoins(txb.gas, [amount]);
|
|
@@ -202,4 +202,11 @@ exports.SuiUtils = {
|
|
|
202
202
|
arguments: [tx.object(_7k_1._7K_VAULT), tx.object(_7k_1._7K_CONFIG), coin],
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
|
+
transferOrDestroyZeroCoin(tx, coinType, coin, address) {
|
|
206
|
+
tx.moveCall({
|
|
207
|
+
target: `${_7k_1._7K_PACKAGE_ID}::utils::transfer_or_destroy`,
|
|
208
|
+
typeArguments: [coinType],
|
|
209
|
+
arguments: [coin, tx.pure.address(address)],
|
|
210
|
+
});
|
|
211
|
+
},
|
|
205
212
|
};
|
|
@@ -38,7 +38,7 @@ export const buildTx = async ({ quoteResponse, accountAddress, slippage, commiss
|
|
|
38
38
|
let coinData;
|
|
39
39
|
if (coinIn) {
|
|
40
40
|
coinData = tx.splitCoins(coinIn, splits);
|
|
41
|
-
SuiUtils.
|
|
41
|
+
SuiUtils.transferOrDestroyZeroCoin(tx, quoteResponse.tokenIn, coinIn, accountAddress);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
const { coinData: _data } = await getSplitCoinForTx(accountAddress, quoteResponse.swapAmountWithDecimal, splits, denormalizeTokenType(quoteResponse.tokenIn), tx, devInspect, isSponsored || isBluefinX);
|
|
@@ -12,7 +12,7 @@ export const DEFAULT_CONFIG = {
|
|
|
12
12
|
},
|
|
13
13
|
bluefin: {
|
|
14
14
|
name: "Bluefin",
|
|
15
|
-
package: "
|
|
15
|
+
package: "0x406f52151e7dd65addd93b0bdad7989e82aec20c3ae6971954a5140f14a59e4b",
|
|
16
16
|
globalConfig: "0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352",
|
|
17
17
|
},
|
|
18
18
|
bluefinx: {
|
|
@@ -27,7 +27,7 @@ export const DEFAULT_CONFIG = {
|
|
|
27
27
|
},
|
|
28
28
|
cetus: {
|
|
29
29
|
name: "Cetus",
|
|
30
|
-
package: "
|
|
30
|
+
package: "0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187",
|
|
31
31
|
globalConfig: "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",
|
|
32
32
|
},
|
|
33
33
|
deepbook_v3: {
|
|
@@ -43,7 +43,7 @@ export const DEFAULT_CONFIG = {
|
|
|
43
43
|
},
|
|
44
44
|
flowx_v3: {
|
|
45
45
|
name: "Flowx Finance V3",
|
|
46
|
-
package: "
|
|
46
|
+
package: "0x3974baf3c1fb21edba6407feff33e77c8fd05670b5cd8815e8fdc289b1f30267",
|
|
47
47
|
registry: "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc",
|
|
48
48
|
version: "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",
|
|
49
49
|
},
|
|
@@ -53,7 +53,7 @@ export const DEFAULT_CONFIG = {
|
|
|
53
53
|
},
|
|
54
54
|
kriya_v3: {
|
|
55
55
|
name: "Kriya V3",
|
|
56
|
-
package: "
|
|
56
|
+
package: "0x7cfee19b76f44a30cd7b8edcbb24eff1cc3fdc3495d3d07e99f1af46f5719861",
|
|
57
57
|
version: "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78",
|
|
58
58
|
},
|
|
59
59
|
obric: {
|
|
@@ -80,13 +80,13 @@ export const DEFAULT_CONFIG = {
|
|
|
80
80
|
},
|
|
81
81
|
steamm: {
|
|
82
82
|
name: "Steamm",
|
|
83
|
-
package: "
|
|
84
|
-
script: "
|
|
83
|
+
package: "0x4454d95507deb17d5017db11105bd95027d434776af1d0049ce27a3510a9a1ba",
|
|
84
|
+
script: "0xa5eda33c0829a546b55fdf0bb1ad88175df00e1c72690b79ac966c49082b9834",
|
|
85
85
|
oracle: "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b",
|
|
86
86
|
},
|
|
87
87
|
magma: {
|
|
88
88
|
name: "Magma",
|
|
89
|
-
package: "
|
|
89
|
+
package: "0x97aa7a842f53ccafc3514fb875fee9b9cd65cf9e6e39087ee327c94f77a4e319",
|
|
90
90
|
globalConfig: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
91
91
|
},
|
|
92
92
|
haedal_pmm: {
|
|
@@ -95,7 +95,7 @@ export const DEFAULT_CONFIG = {
|
|
|
95
95
|
},
|
|
96
96
|
momentum: {
|
|
97
97
|
name: "Momentum",
|
|
98
|
-
package: "
|
|
98
|
+
package: "0x9c12f3aa14a449a0a23c066589e269086f021a98939f21158cfacb16d19787c3",
|
|
99
99
|
version: "0x2375a0b1ec12010aaea3b2545acfa2ad34cfbba03ce4b59f4c39e1e25eed1b2a",
|
|
100
100
|
},
|
|
101
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,aAAa,EAGd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,OAAO,GAAU,2GAQ3B,aAAa,KAAG,OAAO,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,aAAa,EAGd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,OAAO,GAAU,2GAQ3B,aAAa,KAAG,OAAO,CAAC,aAAa,CA4IvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,MAyI5B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,MAyI5B,CAAC;AAIF,wBAAsB,SAAS,oBAe9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransactionArgument, Transaction } from "@mysten/sui/transactions";
|
|
2
1
|
import { CoinStruct, SuiObjectResponseQuery } from "@mysten/sui/client";
|
|
2
|
+
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
3
3
|
type DataPage<T> = {
|
|
4
4
|
data: T[];
|
|
5
5
|
nextCursor?: any;
|
|
@@ -50,6 +50,7 @@ export declare const SuiUtils: {
|
|
|
50
50
|
NestedResult: [number, number];
|
|
51
51
|
};
|
|
52
52
|
collectDust(tx: Transaction, coinType: string, coin: TransactionArgument): void;
|
|
53
|
+
transferOrDestroyZeroCoin(tx: Transaction, coinType: string, coin: TransactionArgument, address: string): void;
|
|
53
54
|
};
|
|
54
55
|
export {};
|
|
55
56
|
//# sourceMappingURL=sui.d.ts.map
|
|
@@ -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,EACL,UAAU,EAEV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM5E,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;oBAQd,WAAW,YAAY,MAAM;;;;iBAQhC,WAAW,YAAY,MAAM;;;;wBASpC,WAAW,YACL,MAAM,cACJ,mBAAmB;;;;wBAU3B,WAAW,YACL,MAAM,WACP,mBAAmB;;;;oBASd,WAAW,YAAY,MAAM,QAAQ,mBAAmB;kCASlE,WAAW,YACL,MAAM,QACV,mBAAmB,WAChB,MAAM;CAQlB,CAAC"}
|
package/lib/esm/utils/sui.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { parseStructTag } from "@mysten/sui/utils";
|
|
3
|
-
import { checkIsSui } from "./token";
|
|
4
3
|
import { Config } from "../config";
|
|
5
4
|
import { _7K_CONFIG, _7K_PACKAGE_ID, _7K_VAULT } from "../constants/_7k";
|
|
5
|
+
import { checkIsSui } from "./token";
|
|
6
6
|
export const SuiUtils = {
|
|
7
7
|
getSuiCoin(amount, txb) {
|
|
8
8
|
const [coin] = txb.splitCoins(txb.gas, [amount]);
|
|
@@ -199,4 +199,11 @@ export const SuiUtils = {
|
|
|
199
199
|
arguments: [tx.object(_7K_VAULT), tx.object(_7K_CONFIG), coin],
|
|
200
200
|
});
|
|
201
201
|
},
|
|
202
|
+
transferOrDestroyZeroCoin(tx, coinType, coin, address) {
|
|
203
|
+
tx.moveCall({
|
|
204
|
+
target: `${_7K_PACKAGE_ID}::utils::transfer_or_destroy`,
|
|
205
|
+
typeArguments: [coinType],
|
|
206
|
+
arguments: [coin, tx.pure.address(address)],
|
|
207
|
+
});
|
|
208
|
+
},
|
|
202
209
|
};
|