@typus/typus-sdk 0.1.3 → 0.1.5
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/constants.d.ts +9 -11
- package/lib/constants.js +19 -15
- package/lib/scripts/coveredCall/{getCoveredCallDepositTx.d.ts → getDeliveryTx.d.ts} +0 -0
- package/lib/scripts/coveredCall/{getCoveredCallUnsubscribeTx.js → getDeliveryTx.js} +6 -6
- package/lib/scripts/{getDepositTx.d.ts → coveredCall/getDepositTx.d.ts} +0 -0
- package/lib/scripts/{getDepositTx.js → coveredCall/getDepositTx.js} +7 -8
- package/lib/scripts/coveredCall/{getCoveredCallUnsubscribeTx.d.ts → getNewAuctionTx.d.ts} +0 -0
- package/lib/scripts/{getNewSharkFinVaultTx.js → coveredCall/getNewAuctionTx.js} +13 -11
- package/lib/scripts/{getNewSharkFinVaultTx.d.ts → coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts} +0 -0
- package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +65 -0
- package/lib/scripts/coveredCall/getNewBidTx.d.ts +1 -0
- package/lib/scripts/coveredCall/getNewBidTx.js +59 -0
- package/lib/scripts/coveredCall/getNewCoveredCallVaultTx.js +4 -2
- package/lib/scripts/coveredCall/getRemoveBidTx.d.ts +1 -0
- package/lib/scripts/coveredCall/getRemoveBidTx.js +56 -0
- package/lib/scripts/coveredCall/getSubscribeTx.d.ts +1 -0
- package/lib/scripts/coveredCall/getSubscribeTx.js +55 -0
- package/lib/scripts/coveredCall/getUnsubscribeTx.d.ts +1 -0
- package/lib/scripts/coveredCall/getUnsubscribeTx.js +55 -0
- package/lib/scripts/coveredCall/getWithdrawTx.d.ts +1 -0
- package/lib/scripts/coveredCall/{getCoveredCallDepositTx.js → getWithdrawTx.js} +6 -7
- package/lib/scripts/getNewOracleTx.js +3 -3
- package/lib/scripts/getUpdateOracleTx.js +1 -1
- package/lib/test/getUserShareFromRegistry.d.ts +1 -0
- package/lib/test/getUserShareFromRegistry.js +172 -0
- package/lib/test/testCrypto.d.ts +1 -0
- package/lib/test/testCrypto.js +54 -0
- package/lib/test/testDeposit.js +16 -43
- package/lib/test/testDepositV2.d.ts +0 -1
- package/lib/test/testDepositV2.js +61 -168
- package/lib/test/testMint.js +70 -30
- package/lib/test/testNewVault.d.ts +1 -0
- package/lib/test/testNewVault.js +171 -0
- package/lib/test/testOracle.js +4 -3
- package/lib/test/testSubscribeEvent.d.ts +1 -0
- package/lib/test/testSubscribeEvent.js +97 -0
- package/lib/test/testUnsubscribe.d.ts +1 -0
- package/lib/test/testUnsubscribe.js +86 -0
- package/lib/utils/auction/sealedAuction.d.ts +33 -0
- package/lib/utils/auction/sealedAuction.js +64 -0
- package/lib/utils/coveredCall/getDeliveryTx.d.ts +1 -0
- package/lib/utils/coveredCall/{getCoveredCallDepositTx.js → getDeliveryTx.js} +5 -10
- package/lib/utils/{getDepositTx.d.ts → coveredCall/getDepositTx.d.ts} +0 -0
- package/lib/utils/{getDepositTx.js → coveredCall/getDepositTx.js} +3 -3
- package/lib/utils/coveredCall/getNewAuctionTx.d.ts +1 -0
- package/lib/utils/{getNewSharkFinVaultTx.js → coveredCall/getNewAuctionTx.js} +15 -13
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +69 -0
- package/lib/utils/coveredCall/getNewBidTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewBidTx.js +62 -0
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +1 -1
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +3 -2
- package/lib/utils/coveredCall/getRemoveBidTx.d.ts +1 -0
- package/lib/utils/coveredCall/getRemoveBidTx.js +60 -0
- package/lib/utils/coveredCall/getSubscribeTx.d.ts +1 -0
- package/lib/utils/coveredCall/getSubscribeTx.js +59 -0
- package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +1 -0
- package/lib/utils/coveredCall/{getCoveredCallUnsubscribeTx.js → getUnsubscribeTx.js} +3 -3
- package/lib/utils/coveredCall/getWithdrawTx.d.ts +1 -0
- package/lib/utils/coveredCall/getWithdrawTx.js +61 -0
- package/lib/utils/fetchData.d.ts +11 -0
- package/lib/utils/fetchData.js +191 -0
- package/lib/utils/getNewOracleTx.d.ts +1 -1
- package/lib/utils/getNewOracleTx.js +2 -2
- package/lib/utils/getSubVault.js +1 -1
- package/lib/utils/getTypeArgumentFromToken.d.ts +1 -0
- package/lib/utils/getTypeArgumentFromToken.js +67 -0
- package/package.json +6 -2
- package/lib/utils/coveredCall/getCoveredCallDepositTx.d.ts +0 -1
- package/lib/utils/coveredCall/getCoveredCallUnsubscribeTx.d.ts +0 -1
- package/lib/utils/getNewSharkFinVaultTx.d.ts +0 -1
package/lib/test/testMint.js
CHANGED
|
@@ -44,47 +44,87 @@ var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
|
44
44
|
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
45
45
|
var mintAmount = 10005;
|
|
46
46
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
-
var
|
|
47
|
+
var moudleName, mintTx, moveCallTxn;
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
49
|
switch (_a.label) {
|
|
50
|
-
case 0:
|
|
51
|
-
console.log("test for mint, try to mint " + mintAmount + " ...");
|
|
52
|
-
return [4 /*yield*/, provider.getObject(constants_1.TOKEN_REGISTRY)];
|
|
50
|
+
case 0: return [4 /*yield*/, prepareData()];
|
|
53
51
|
case 1:
|
|
54
|
-
|
|
55
|
-
type = obj.details.data.fields.supply.type;
|
|
56
|
-
tokenName = constants_1.TOKEN_NAME.find(function (e) { return type.includes(e); });
|
|
57
|
-
if (!tokenName) {
|
|
58
|
-
console.log("can't find token in type: " + type);
|
|
59
|
-
return [2 /*return*/];
|
|
60
|
-
}
|
|
61
|
-
moudleName = constants_1.TOKEN_NAME_TO_MODULE[tokenName];
|
|
62
|
-
//@ts-ignore
|
|
63
|
-
console.log("Before: total mint fake " + tokenName + " token in the registry: " + obj.details.data.fields.supply.fields.value);
|
|
52
|
+
moudleName = _a.sent();
|
|
64
53
|
return [4 /*yield*/, (0, getMintTx_1.getMintTx)(constants_1.TOKEN_PACKAGE, constants_1.TOKEN_REGISTRY, moudleName, mintAmount)];
|
|
65
54
|
case 2:
|
|
66
55
|
mintTx = _a.sent();
|
|
67
56
|
return [4 /*yield*/, signer.executeMoveCall(mintTx)];
|
|
68
57
|
case 3:
|
|
69
58
|
moveCallTxn = _a.sent();
|
|
70
|
-
|
|
71
|
-
return [4 /*yield*/, provider.getTransactionWithEffects(digest)];
|
|
59
|
+
return [4 /*yield*/, checkData(moveCallTxn)];
|
|
72
60
|
case 4:
|
|
73
|
-
|
|
74
|
-
tokenObjectId = txn.effects.created[0].reference.objectId;
|
|
75
|
-
return [4 /*yield*/, provider.getObject(tokenObjectId)
|
|
76
|
-
//@ts-ignore
|
|
77
|
-
];
|
|
78
|
-
case 5:
|
|
79
|
-
tokenObj = _a.sent();
|
|
80
|
-
newTokenId = tokenObj.details.data.fields.id.id;
|
|
81
|
-
console.log("newTokenId: " + newTokenId);
|
|
82
|
-
return [4 /*yield*/, provider.getObject(constants_1.TOKEN_REGISTRY)];
|
|
83
|
-
case 6:
|
|
84
|
-
obj = _a.sent();
|
|
85
|
-
//@ts-ignore
|
|
86
|
-
console.log("After: total mint fake " + tokenName + " token in the registry: " + obj.details.data.fields.supply.fields.value);
|
|
61
|
+
_a.sent();
|
|
87
62
|
return [2 /*return*/];
|
|
88
63
|
}
|
|
89
64
|
});
|
|
90
65
|
}); })();
|
|
66
|
+
function prepareData() {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var obj, type_1, tokenName, moudleName, e_1;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
_a.trys.push([0, 2, , 3]);
|
|
73
|
+
console.log("test for mint, try to mint " + mintAmount + " ...");
|
|
74
|
+
return [4 /*yield*/, provider.getObject(constants_1.TOKEN_REGISTRY)];
|
|
75
|
+
case 1:
|
|
76
|
+
obj = _a.sent();
|
|
77
|
+
type_1 = obj.details.data.fields.treasury_cap.fields.total_supply.type;
|
|
78
|
+
console.log("type arugment : " + type_1);
|
|
79
|
+
tokenName = constants_1.TOKEN_NAME.find(function (e) { return type_1.includes(e); });
|
|
80
|
+
if (!tokenName) {
|
|
81
|
+
console.log("can't find token in type: " + type_1);
|
|
82
|
+
return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
moudleName = constants_1.TOKEN_NAME_TO_MODULE[tokenName];
|
|
85
|
+
//@ts-ignore
|
|
86
|
+
console.log("Before: total mint fake " + tokenName + " token in the registry: " + obj.details.data.fields.treasury_cap.fields.total_supply.fields.value);
|
|
87
|
+
return [2 /*return*/, moudleName];
|
|
88
|
+
case 2:
|
|
89
|
+
e_1 = _a.sent();
|
|
90
|
+
console.error(e_1);
|
|
91
|
+
return [3 /*break*/, 3];
|
|
92
|
+
case 3: return [2 /*return*/];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function checkData(moveCallTxn) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
var digest, txn, tokenObjectId, tokenObj, newTokenId, obj, e_2;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
switch (_a.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
_a.trys.push([0, 4, , 5]);
|
|
104
|
+
digest = moveCallTxn.EffectsCert.certificate.transactionDigest;
|
|
105
|
+
return [4 /*yield*/, provider.getTransactionWithEffects(digest)];
|
|
106
|
+
case 1:
|
|
107
|
+
txn = _a.sent();
|
|
108
|
+
tokenObjectId = txn.effects.created[0].reference.objectId;
|
|
109
|
+
return [4 /*yield*/, provider.getObject(tokenObjectId)
|
|
110
|
+
//@ts-ignore
|
|
111
|
+
];
|
|
112
|
+
case 2:
|
|
113
|
+
tokenObj = _a.sent();
|
|
114
|
+
newTokenId = tokenObj.details.data.fields.id.id;
|
|
115
|
+
console.log("newTokenId: " + newTokenId);
|
|
116
|
+
return [4 /*yield*/, provider.getObject(constants_1.TOKEN_REGISTRY)];
|
|
117
|
+
case 3:
|
|
118
|
+
obj = _a.sent();
|
|
119
|
+
//@ts-ignore
|
|
120
|
+
console.log("After: total mint in the registry: " + obj.details.data.fields.treasury_cap.fields.total_supply.fields.value);
|
|
121
|
+
return [3 /*break*/, 5];
|
|
122
|
+
case 4:
|
|
123
|
+
e_2 = _a.sent();
|
|
124
|
+
console.error(e_2);
|
|
125
|
+
return [3 /*break*/, 5];
|
|
126
|
+
case 5: return [2 /*return*/];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
var getNewOracleTx_1 = require("../utils/getNewOracleTx");
|
|
51
|
+
var getUpdateOracleTx_1 = require("../utils/getUpdateOracleTx");
|
|
52
|
+
var getNewCoveredCallVaultTx_1 = require("../utils/coveredCall/getNewCoveredCallVaultTx");
|
|
53
|
+
var constants_1 = require("../constants");
|
|
54
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
55
|
+
var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
56
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
57
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
58
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
59
|
+
var token = "0xaa8f8ccf372b461e5b8778b250bf13d9b1013174"; // minted token
|
|
60
|
+
var decimal = 8;
|
|
61
|
+
var expiration = 1;
|
|
62
|
+
var assetName = "BTC"; //TODO: it will show BTC base64 string in obj fields(for example, BTC will turn into "QlRD")
|
|
63
|
+
var strike = 105;
|
|
64
|
+
var price = 98;
|
|
65
|
+
var unix = 10000000;
|
|
66
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var typeArgument, priceOracle, newCoveredCallVaultTx, moveCallTxn;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0: return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
|
|
71
|
+
case 1:
|
|
72
|
+
typeArgument = _a.sent();
|
|
73
|
+
return [4 /*yield*/, createAndUpdatePriceOracle(typeArgument)];
|
|
74
|
+
case 2:
|
|
75
|
+
priceOracle = _a.sent();
|
|
76
|
+
return [4 /*yield*/, (0, getNewCoveredCallVaultTx_1.getNewCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, expiration, assetName, strike, priceOracle)];
|
|
77
|
+
case 3:
|
|
78
|
+
newCoveredCallVaultTx = _a.sent();
|
|
79
|
+
return [4 /*yield*/, signer.executeMoveCall(newCoveredCallVaultTx)];
|
|
80
|
+
case 4:
|
|
81
|
+
moveCallTxn = _a.sent();
|
|
82
|
+
return [4 /*yield*/, checkData(moveCallTxn)];
|
|
83
|
+
case 5:
|
|
84
|
+
_a.sent();
|
|
85
|
+
return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}); })();
|
|
89
|
+
function createAndUpdatePriceOracle(typeArgument) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
+
var newOracleTx, moveCallTxn, digest, txn, priceOracle, managerCap, updateOracleTx, newOracleObj;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
console.log("create new oracle...");
|
|
96
|
+
return [4 /*yield*/, (0, getNewOracleTx_1.getNewOracleTx)(constants_1.ORACLE_PACKAGE, typeArgument, decimal)];
|
|
97
|
+
case 1:
|
|
98
|
+
newOracleTx = _a.sent();
|
|
99
|
+
return [4 /*yield*/, signer.executeMoveCall(newOracleTx)];
|
|
100
|
+
case 2:
|
|
101
|
+
moveCallTxn = _a.sent();
|
|
102
|
+
digest = moveCallTxn.EffectsCert.certificate.transactionDigest;
|
|
103
|
+
return [4 /*yield*/, provider.getTransactionWithEffects(digest)];
|
|
104
|
+
case 3:
|
|
105
|
+
txn = _a.sent();
|
|
106
|
+
if (txn.effects.created[0].owner["AddressOwner"] == undefined) {
|
|
107
|
+
priceOracle = txn.effects.created[0].reference.objectId;
|
|
108
|
+
managerCap = txn.effects.created[1].reference.objectId;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
priceOracle = txn.effects.created[1].reference.objectId;
|
|
112
|
+
managerCap = txn.effects.created[0].reference.objectId;
|
|
113
|
+
}
|
|
114
|
+
console.log("priceOracle: " + priceOracle);
|
|
115
|
+
console.log("managerCap of priceOracle: " + managerCap);
|
|
116
|
+
console.log("update oracle...");
|
|
117
|
+
return [4 /*yield*/, (0, getUpdateOracleTx_1.getUpdateOracleTx)(constants_1.ORACLE_PACKAGE, typeArgument, priceOracle, managerCap, price, unix)];
|
|
118
|
+
case 4:
|
|
119
|
+
updateOracleTx = _a.sent();
|
|
120
|
+
return [4 /*yield*/, signer.executeMoveCall(updateOracleTx)];
|
|
121
|
+
case 5:
|
|
122
|
+
_a.sent();
|
|
123
|
+
return [4 /*yield*/, provider.getObject(priceOracle)];
|
|
124
|
+
case 6:
|
|
125
|
+
newOracleObj = _a.sent();
|
|
126
|
+
console.log("updated oracle data:");
|
|
127
|
+
//@ts-ignore
|
|
128
|
+
console.log(newOracleObj.details.data.fields);
|
|
129
|
+
return [2 /*return*/, priceOracle];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function checkData(moveCallTxn) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
+
var txn, _a, _b, obj, e_1;
|
|
137
|
+
var e_2, _c;
|
|
138
|
+
return __generator(this, function (_d) {
|
|
139
|
+
switch (_d.label) {
|
|
140
|
+
case 0:
|
|
141
|
+
_d.trys.push([0, 2, , 3]);
|
|
142
|
+
return [4 /*yield*/, provider.getTransactionWithEffects(
|
|
143
|
+
//@ts-ignore
|
|
144
|
+
moveCallTxn.EffectsCert.certificate.transactionDigest)];
|
|
145
|
+
case 1:
|
|
146
|
+
txn = _d.sent();
|
|
147
|
+
try {
|
|
148
|
+
for (_a = __values(txn.effects.created), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
149
|
+
obj = _b.value;
|
|
150
|
+
//@ts-ignore
|
|
151
|
+
if (obj.owner.ObjectOwner == constants_1.COVERED_CALL_REGISTRY)
|
|
152
|
+
console.log("new covered call vault: " + obj.reference.objectId);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
156
|
+
finally {
|
|
157
|
+
try {
|
|
158
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
159
|
+
}
|
|
160
|
+
finally { if (e_2) throw e_2.error; }
|
|
161
|
+
}
|
|
162
|
+
return [3 /*break*/, 3];
|
|
163
|
+
case 2:
|
|
164
|
+
e_1 = _d.sent();
|
|
165
|
+
console.error(e_1);
|
|
166
|
+
return [3 /*break*/, 3];
|
|
167
|
+
case 3: return [2 /*return*/];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
package/lib/test/testOracle.js
CHANGED
|
@@ -44,14 +44,15 @@ var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read
|
|
|
44
44
|
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
45
45
|
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
46
46
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
-
var price, unix, newOracleTx, moveCallTxn, digest, txn, newOracle, managerCap, updateOracleTx, newOracleObj;
|
|
47
|
+
var price, unix, decimal, newOracleTx, moveCallTxn, digest, txn, newOracle, managerCap, updateOracleTx, newOracleObj;
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
49
|
switch (_a.label) {
|
|
50
50
|
case 0:
|
|
51
51
|
price = 1234;
|
|
52
52
|
unix = 5678;
|
|
53
|
+
decimal = 8;
|
|
53
54
|
console.log("create new oracle...");
|
|
54
|
-
return [4 /*yield*/, (0, getNewOracleTx_1.getNewOracleTx)(constants_1.
|
|
55
|
+
return [4 /*yield*/, (0, getNewOracleTx_1.getNewOracleTx)(constants_1.ORACLE_PACKAGE, constants_1.DEFAULT_TYPE_ARGUMENT, decimal)];
|
|
55
56
|
case 1:
|
|
56
57
|
newOracleTx = _a.sent();
|
|
57
58
|
return [4 /*yield*/, signer.executeMoveCall(newOracleTx)];
|
|
@@ -66,7 +67,7 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
|
66
67
|
managerCap = txn.effects.created[1].reference.objectId;
|
|
67
68
|
console.log("managerCap: " + managerCap);
|
|
68
69
|
console.log("update oracle...");
|
|
69
|
-
return [4 /*yield*/, (0, getUpdateOracleTx_1.getUpdateOracleTx)(constants_1.
|
|
70
|
+
return [4 /*yield*/, (0, getUpdateOracleTx_1.getUpdateOracleTx)(constants_1.ORACLE_PACKAGE, constants_1.DEFAULT_TYPE_ARGUMENT, newOracle, managerCap, price, unix)];
|
|
70
71
|
case 4:
|
|
71
72
|
updateOracleTx = _a.sent();
|
|
72
73
|
return [4 /*yield*/, signer.executeMoveCall(updateOracleTx)];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
40
|
+
var provider = new sui_js_1.JsonRpcProvider("ws://136.243.36.109:9001"); //for read only operations
|
|
41
|
+
var devnetNftFilter = {
|
|
42
|
+
All: [
|
|
43
|
+
{ EventType: 'MoveEvent' },
|
|
44
|
+
{ Package: '0x2' },
|
|
45
|
+
{ Module: 'devnet_nft' },
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var subscriptionId, subFoundAndRemoved;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
console.log("test for subscribeEvent()");
|
|
54
|
+
return [4 /*yield*/, provider.subscribeEvent(
|
|
55
|
+
// { "SenderAddress": "0x82a2d7e3875b49217702d61b7411576af12ecab3" },
|
|
56
|
+
{ "All": [] }, function (event) {
|
|
57
|
+
console.log(event);
|
|
58
|
+
// handle subscription notification message here. This function is called once per subscription message.
|
|
59
|
+
})];
|
|
60
|
+
case 1:
|
|
61
|
+
subscriptionId = _a.sent();
|
|
62
|
+
return [4 /*yield*/, provider.unsubscribeEvent(subscriptionId)];
|
|
63
|
+
case 2:
|
|
64
|
+
subFoundAndRemoved = _a.sent();
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); })();
|
|
69
|
+
// (async () => {
|
|
70
|
+
// console.log("connect...")
|
|
71
|
+
// console.log(await subscribeEvent())
|
|
72
|
+
// })()
|
|
73
|
+
// async function subscribeEvent(): Promise<any[]> {
|
|
74
|
+
// let results: any[] = [];
|
|
75
|
+
// let msg = {
|
|
76
|
+
// jsonrpc: "2.0",
|
|
77
|
+
// id: 1,
|
|
78
|
+
// method: "sui_subscribeEvent",
|
|
79
|
+
// params:
|
|
80
|
+
// [{ "All": [{ SenderAddress: '0x82a2d7e3875b49217702d61b7411576af12ecab3' }] }]
|
|
81
|
+
// };
|
|
82
|
+
// let ws = new WebSocket("wss://pubsub.devnet.sui.io:443")
|
|
83
|
+
// //ws://136.243.36.109:9001
|
|
84
|
+
// ws.onmessage = function (e) {
|
|
85
|
+
// // do something with the response...
|
|
86
|
+
// console.log(JSON.parse(e.data.toString()))
|
|
87
|
+
// results = JSON.parse(e.data.toString()).result;
|
|
88
|
+
// // close the connection from the server
|
|
89
|
+
// ws.close();
|
|
90
|
+
// };
|
|
91
|
+
// ws.onopen = function () {
|
|
92
|
+
// ws.send(JSON.stringify(msg));
|
|
93
|
+
// };
|
|
94
|
+
// return new Promise((resolve, reject) => {
|
|
95
|
+
// setTimeout(() => resolve(results), 5000);
|
|
96
|
+
// });
|
|
97
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var getDepositTx_1 = require("../utils/coveredCall/getDepositTx");
|
|
40
|
+
var constants_1 = require("../constants");
|
|
41
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
+
var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
43
|
+
var getUnsubscribeTx_1 = require("../utils/coveredCall/getUnsubscribeTx");
|
|
44
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
45
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
46
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
47
|
+
/*
|
|
48
|
+
after unsubscribe, the subvault (is deposited) "balance" in fields will be 0,
|
|
49
|
+
and a regular linked list node will be created if not exist, and the value increase.
|
|
50
|
+
|
|
51
|
+
EX:
|
|
52
|
+
subvault balance:1234, regular linked list node value:1000
|
|
53
|
+
after unsubscribe
|
|
54
|
+
subvault balance:0, regular linked list node value:2234
|
|
55
|
+
*/
|
|
56
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
+
var depositAmount, isRolling, token, vaultIndex, typeArgument, depositTx, unSubscribedTx;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
depositAmount = 123;
|
|
62
|
+
isRolling = true;
|
|
63
|
+
token = "0xaa8f8ccf372b461e5b8778b250bf13d9b1013174" // minted token
|
|
64
|
+
;
|
|
65
|
+
vaultIndex = 3;
|
|
66
|
+
return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
|
|
67
|
+
case 1:
|
|
68
|
+
typeArgument = _a.sent();
|
|
69
|
+
return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, isRolling, token, depositAmount)];
|
|
70
|
+
case 2:
|
|
71
|
+
depositTx = _a.sent();
|
|
72
|
+
return [4 /*yield*/, signer.executeMoveCall(depositTx)];
|
|
73
|
+
case 3:
|
|
74
|
+
_a.sent();
|
|
75
|
+
console.log("deposit " + depositAmount + " to new vault successfully");
|
|
76
|
+
return [4 /*yield*/, (0, getUnsubscribeTx_1.getUnsubscribeTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex)];
|
|
77
|
+
case 4:
|
|
78
|
+
unSubscribedTx = _a.sent();
|
|
79
|
+
return [4 /*yield*/, signer.executeMoveCall(unSubscribedTx)];
|
|
80
|
+
case 5:
|
|
81
|
+
_a.sent();
|
|
82
|
+
console.log("unsubscribe successfully");
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); })();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BcsWriter } from '@mysten/bcs';
|
|
2
|
+
/**
|
|
3
|
+
* Encrypt bid info
|
|
4
|
+
* @param {bigint} price bid price
|
|
5
|
+
* @param {bigint} size bid size
|
|
6
|
+
* @param {string} secret secret to encrypt the bid info
|
|
7
|
+
* @returns the first element is the random number generated during bid encryption process,
|
|
8
|
+
* and the second is bid ciphertext
|
|
9
|
+
*/
|
|
10
|
+
export declare function encryptBid(price: bigint, size: bigint, secret: string): [bigint, string];
|
|
11
|
+
/**
|
|
12
|
+
* Decrypt to bid info
|
|
13
|
+
* @param {string} encryptedBid bid ciphertext
|
|
14
|
+
* @param {string} secret secret to decrypt the ciphertext to plain bid info
|
|
15
|
+
* @returns [bid price, bid size, blindingFactor]
|
|
16
|
+
*/
|
|
17
|
+
export declare function decryptBid(encryptedBid: string, secret: string): [BigInt, BigInt, BigInt];
|
|
18
|
+
/**
|
|
19
|
+
* Get hash of bid info - should be same as onchain
|
|
20
|
+
* @param {bigint} price bid price
|
|
21
|
+
* @param {bigint} size bid size
|
|
22
|
+
* @param {bigint} blindingFactor a random number
|
|
23
|
+
* @returns {string} the hash of bid info
|
|
24
|
+
*/
|
|
25
|
+
export declare function getBidHash(price: bigint, size: bigint, blindingFactor: bigint): string;
|
|
26
|
+
/**
|
|
27
|
+
* Serialize bid info to BCS buffer - should be same as onchain
|
|
28
|
+
* @param {bigint} price bid price
|
|
29
|
+
* @param {bigint} size bid size
|
|
30
|
+
* @param {bigint} blindingFactor a random number
|
|
31
|
+
* @returns {BcsWriter} the serialized bid info
|
|
32
|
+
*/
|
|
33
|
+
export declare function constructBidInfo(price: bigint, size: bigint, blindingFactor: bigint): BcsWriter;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.constructBidInfo = exports.getBidHash = exports.decryptBid = exports.encryptBid = void 0;
|
|
7
|
+
var bcs_1 = require("@mysten/bcs");
|
|
8
|
+
var js_sha3_1 = require("js-sha3");
|
|
9
|
+
var encrypt_with_password_1 = __importDefault(require("encrypt-with-password"));
|
|
10
|
+
var random_bigint_1 = __importDefault(require("random-bigint"));
|
|
11
|
+
/**
|
|
12
|
+
* Encrypt bid info
|
|
13
|
+
* @param {bigint} price bid price
|
|
14
|
+
* @param {bigint} size bid size
|
|
15
|
+
* @param {string} secret secret to encrypt the bid info
|
|
16
|
+
* @returns the first element is the random number generated during bid encryption process,
|
|
17
|
+
* and the second is bid ciphertext
|
|
18
|
+
*/
|
|
19
|
+
function encryptBid(price, size, secret) {
|
|
20
|
+
var randomNumber = (0, random_bigint_1.default)(64);
|
|
21
|
+
var msg = constructBidInfo(price, size, randomNumber);
|
|
22
|
+
var res = encrypt_with_password_1.default.encrypt(msg.toString("hex"), secret);
|
|
23
|
+
return [randomNumber, res];
|
|
24
|
+
}
|
|
25
|
+
exports.encryptBid = encryptBid;
|
|
26
|
+
/**
|
|
27
|
+
* Decrypt to bid info
|
|
28
|
+
* @param {string} encryptedBid bid ciphertext
|
|
29
|
+
* @param {string} secret secret to decrypt the ciphertext to plain bid info
|
|
30
|
+
* @returns [bid price, bid size, blindingFactor]
|
|
31
|
+
*/
|
|
32
|
+
function decryptBid(encryptedBid, secret) {
|
|
33
|
+
var res = encrypt_with_password_1.default.decrypt(encryptedBid, secret);
|
|
34
|
+
var buffer = Buffer.from(res, "hex");
|
|
35
|
+
var price = buffer.slice(0, buffer.length / 3).readBigUInt64LE(0);
|
|
36
|
+
var size = buffer.slice(buffer.length / 3, buffer.length / 3 * 2).readBigUInt64LE(0);
|
|
37
|
+
var blindingFactor = buffer.slice(buffer.length / 3 * 2).readBigUInt64LE(0);
|
|
38
|
+
return [price, size, blindingFactor];
|
|
39
|
+
}
|
|
40
|
+
exports.decryptBid = decryptBid;
|
|
41
|
+
/**
|
|
42
|
+
* Get hash of bid info - should be same as onchain
|
|
43
|
+
* @param {bigint} price bid price
|
|
44
|
+
* @param {bigint} size bid size
|
|
45
|
+
* @param {bigint} blindingFactor a random number
|
|
46
|
+
* @returns {string} the hash of bid info
|
|
47
|
+
*/
|
|
48
|
+
function getBidHash(price, size, blindingFactor) {
|
|
49
|
+
var msg = constructBidInfo(price, size, blindingFactor);
|
|
50
|
+
var hash = (0, js_sha3_1.sha3_256)(msg.toBytes());
|
|
51
|
+
return hash;
|
|
52
|
+
}
|
|
53
|
+
exports.getBidHash = getBidHash;
|
|
54
|
+
/**
|
|
55
|
+
* Serialize bid info to BCS buffer - should be same as onchain
|
|
56
|
+
* @param {bigint} price bid price
|
|
57
|
+
* @param {bigint} size bid size
|
|
58
|
+
* @param {bigint} blindingFactor a random number
|
|
59
|
+
* @returns {BcsWriter} the serialized bid info
|
|
60
|
+
*/
|
|
61
|
+
function constructBidInfo(price, size, blindingFactor) {
|
|
62
|
+
return new bcs_1.BcsWriter().write64(price).write64(size).write64(blindingFactor);
|
|
63
|
+
}
|
|
64
|
+
exports.constructBidInfo = constructBidInfo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDeliveryTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: number): Promise<any>;
|
|
@@ -36,22 +36,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
function
|
|
39
|
+
exports.getDeliveryTx = void 0;
|
|
40
|
+
function getDeliveryTx(packageId, managerCap, registry, typeArgument, index) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
42
|
var tx;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
44
44
|
tx = {
|
|
45
45
|
packageObjectId: packageId,
|
|
46
46
|
module: 'covered_call',
|
|
47
|
-
function: '
|
|
47
|
+
function: 'delivery',
|
|
48
48
|
typeArguments: [typeArgument],
|
|
49
49
|
arguments: [
|
|
50
|
+
managerCap,
|
|
50
51
|
registry,
|
|
51
52
|
index,
|
|
52
|
-
rolling,
|
|
53
|
-
coin,
|
|
54
|
-
amount
|
|
55
53
|
],
|
|
56
54
|
gasBudget: 10000,
|
|
57
55
|
};
|
|
@@ -59,7 +57,4 @@ function getCoveredCallDepositTx(packageId, registry, typeArgument, index, rolli
|
|
|
59
57
|
});
|
|
60
58
|
});
|
|
61
59
|
}
|
|
62
|
-
exports.
|
|
63
|
-
/*
|
|
64
|
-
sui client call --package 0x1543511bdce9ea3c401c4939126cea518adee965 --module covered_call --function deposit --type-args 0x2::sui::SUI --args 0xb02452d0bbef3cbdc7840ea5bad27bcdd4031675 0 true COIN 9999 --gas-budget 100000
|
|
65
|
-
*/
|
|
60
|
+
exports.getDeliveryTx = getDeliveryTx;
|
|
File without changes
|