@typus/typus-sdk 0.1.7 → 0.1.8
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
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const TOKEN_PACKAGE = "0x0a7a15d173690ac676b03eb8285a615a8982cb27";
|
|
2
|
-
export declare const TOKEN_REGISTRY = "
|
|
2
|
+
export declare const TOKEN_REGISTRY = "0x7fe9f4e9c4cb004a19cd5b5b2cc71509f94780aa";
|
|
3
3
|
export declare const ORACLE_PACKAGE = "0xe85eabdada216e470344b2e70cdc8155a4007a2a";
|
|
4
|
-
export declare const COVERED_CALL_PACKAGE = "
|
|
5
|
-
export declare const COVERED_CALL_REGISTRY = "
|
|
6
|
-
export declare const COVERED_CALL_MANAGER = "
|
|
4
|
+
export declare const COVERED_CALL_PACKAGE = "0x76ed224498d2be57bf77ec8c0015957dd6096a36";
|
|
5
|
+
export declare const COVERED_CALL_REGISTRY = "0x4a3b7c389f5f7a506317774a49e39631ff160537";
|
|
6
|
+
export declare const COVERED_CALL_MANAGER = "0x35f69cc3dff02a9e86616569a72a0c8e9d950cca";
|
|
7
7
|
export declare const DOV_PACKAGE = "0x461c7f49f322c3b12523f51c8b8f00d6e0eda243";
|
|
8
8
|
export declare const DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
9
9
|
export declare const FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
package/lib/constants.js
CHANGED
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.TEST_MNEMONIC = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.DOV_PACKAGE = exports.COVERED_CALL_MANAGER = exports.COVERED_CALL_REGISTRY = exports.COVERED_CALL_PACKAGE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY = exports.TOKEN_PACKAGE = void 0;
|
|
4
4
|
//publish from sui-dev-token
|
|
5
5
|
exports.TOKEN_PACKAGE = "0x0a7a15d173690ac676b03eb8285a615a8982cb27";
|
|
6
|
-
exports.TOKEN_REGISTRY = "
|
|
6
|
+
exports.TOKEN_REGISTRY = "0x7fe9f4e9c4cb004a19cd5b5b2cc71509f94780aa"; //fake btc registry
|
|
7
7
|
//publish from typus-oracle
|
|
8
8
|
exports.ORACLE_PACKAGE = "0xe85eabdada216e470344b2e70cdc8155a4007a2a";
|
|
9
9
|
//publish from typus-dov/cover_call
|
|
10
|
-
exports.COVERED_CALL_PACKAGE = "
|
|
11
|
-
exports.COVERED_CALL_REGISTRY = "
|
|
12
|
-
exports.COVERED_CALL_MANAGER = "
|
|
10
|
+
exports.COVERED_CALL_PACKAGE = "0x76ed224498d2be57bf77ec8c0015957dd6096a36";
|
|
11
|
+
exports.COVERED_CALL_REGISTRY = "0x4a3b7c389f5f7a506317774a49e39631ff160537";
|
|
12
|
+
exports.COVERED_CALL_MANAGER = "0x35f69cc3dff02a9e86616569a72a0c8e9d950cca";
|
|
13
13
|
//publish from typus-dov/typus-dov
|
|
14
14
|
exports.DOV_PACKAGE = "0x461c7f49f322c3b12523f51c8b8f00d6e0eda243";
|
|
15
15
|
exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
package/lib/test/testDeposit.js
CHANGED
|
@@ -55,9 +55,9 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
|
55
55
|
case 0:
|
|
56
56
|
depositAmount = 123;
|
|
57
57
|
isRolling = true;
|
|
58
|
-
token = "
|
|
58
|
+
token = "0x82416a9dacea43afa6570863f1bcd3e55e75448e" // minted token
|
|
59
59
|
;
|
|
60
|
-
vaultIndex =
|
|
60
|
+
vaultIndex = 0;
|
|
61
61
|
return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
|
|
62
62
|
case 1:
|
|
63
63
|
typeArgument = _a.sent();
|
package/lib/test/testNewVault.js
CHANGED
|
@@ -56,7 +56,7 @@ var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
|
56
56
|
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
57
57
|
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
58
58
|
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
59
|
-
var token = "
|
|
59
|
+
var token = "0x82416a9dacea43afa6570863f1bcd3e55e75448e"; // minted token
|
|
60
60
|
var decimal = 8;
|
|
61
61
|
var expiration = 1;
|
|
62
62
|
var assetName = "BTC"; //TODO: it will show BTC base64 string in obj fields(for example, BTC will turn into "QlRD")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
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 getWithdrawTx_1 = require("../utils/coveredCall/getWithdrawTx");
|
|
40
|
+
var constants_1 = require("../constants");
|
|
41
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
+
var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
43
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
44
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
45
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
46
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var withdrawAmount, isRolling, token, vaultIndex, typeArgument, withdrawTx;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
withdrawAmount = 12;
|
|
52
|
+
isRolling = true;
|
|
53
|
+
token = "0x82416a9dacea43afa6570863f1bcd3e55e75448e" // minted token
|
|
54
|
+
;
|
|
55
|
+
vaultIndex = 0;
|
|
56
|
+
return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
|
|
57
|
+
case 1:
|
|
58
|
+
typeArgument = _a.sent();
|
|
59
|
+
console.log("test for withdraw, try to withdraw " + token + " for " + withdrawAmount + " ...");
|
|
60
|
+
return [4 /*yield*/, (0, getWithdrawTx_1.getWithdrawTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, isRolling, withdrawAmount)];
|
|
61
|
+
case 2:
|
|
62
|
+
withdrawTx = _a.sent();
|
|
63
|
+
return [4 /*yield*/, signer.executeMoveCall(withdrawTx)];
|
|
64
|
+
case 3:
|
|
65
|
+
_a.sent();
|
|
66
|
+
console.log("withdraw to vault successfully");
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); })();
|