@typus/typus-sdk 1.0.23 → 1.0.25
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.js +3 -1
- package/lib/utils/portfolio/{single-collateral/getMintTx.js → mint.js} +3 -5
- package/lib/utils/portfolio/multiple-collateral/user-entry.d.ts +13 -4
- package/lib/utils/portfolio/multiple-collateral/user-entry.js +13 -4
- package/lib/utils/portfolio/single-collateral/user-entry.d.ts +81 -0
- package/lib/utils/portfolio/single-collateral/user-entry.js +247 -0
- package/package.json +1 -1
- package/lib/scripts/sui.d.ts +0 -1
- package/lib/scripts/sui.js +0 -174
- package/lib/utils/auction/getBid.d.ts +0 -3
- package/lib/utils/auction/getBid.js +0 -75
- package/lib/utils/portfolio/single-collateral/fetchData.d.ts +0 -97
- package/lib/utils/portfolio/single-collateral/fetchData.js +0 -34
- package/lib/utils/portfolio/single-collateral/getTypeArgumentFromToken.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/getTypeArgumentFromToken.js +0 -74
- package/lib/utils/portfolio/single-collateral/getVaultData.d.ts +0 -15
- package/lib/utils/portfolio/single-collateral/getVaultData.js +0 -315
- package/lib/utils/portfolio/single-collateral/getWhiteListFromRegistry.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/getWhiteListFromRegistry.js +0 -73
- package/lib/utils/portfolio/single-collateral/user/getClaimAndHarvestTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getClaimAndHarvestTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getClaimTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getClaimTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getCompoundTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getCompoundTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getDepositTx.d.ts +0 -12
- package/lib/utils/portfolio/single-collateral/user/getDepositTx.js +0 -69
- package/lib/utils/portfolio/single-collateral/user/getHarvestTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getHarvestTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getNewBidTx.d.ts +0 -14
- package/lib/utils/portfolio/single-collateral/user/getNewBidTx.js +0 -78
- package/lib/utils/portfolio/single-collateral/user/getUnsubscribeTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getUnsubscribeTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getWithdrawTx.d.ts +0 -11
- package/lib/utils/portfolio/single-collateral/user/getWithdrawTx.js +0 -67
- /package/lib/utils/portfolio/{single-collateral/getLeaderBoard.d.ts → leader-board.d.ts} +0 -0
- /package/lib/utils/portfolio/{single-collateral/getLeaderBoard.js → leader-board.js} +0 -0
- /package/lib/utils/portfolio/{single-collateral/getMintTx.d.ts → mint.d.ts} +0 -0
package/lib/scripts/sui.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
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
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
7
|
-
var fs_1 = __importDefault(require("fs"));
|
|
8
|
-
var execSync = require("child_process").execSync;
|
|
9
|
-
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.devnetConnection); //for read only operations
|
|
10
|
-
var owner = "0xd28103a499003bed0b1b9ee52988ecdd2db82224";
|
|
11
|
-
var obj1 = "0x7e9e58daeb94bbd0450bb9ee9f00e219a1f2b734"; //obj owned by owner
|
|
12
|
-
var obj2 = "0x74aa838eb6627c8e74b0645484abb463e6fd6669"; //obj owned by owner
|
|
13
|
-
var obj1Digest = "tclmc0L6hewmfWxQAxSl9eUe14C82+hzE4OblKgY38U=";
|
|
14
|
-
var obj2Digest = "tclmc0L6hewmfWxQAxSl9eUe14C82+hzE4OblKgY38U=";
|
|
15
|
-
var receiver = "0x15ca0895f29101085cb26e00ede89420741b3140";
|
|
16
|
-
var tx1 = "GRiBgktRqgJ4MSoRhCfSm/+1R/Zh9jy4UncoQeFAu5I=";
|
|
17
|
-
// export PRIVATEKEY=~/.sui/sui_config/sui.keystore
|
|
18
|
-
var secretKeysPath = process.env.PRIVATEKEY;
|
|
19
|
-
var subVault = "0xd3b2d3ee74afe2b5af0f810b3368955f068188e8";
|
|
20
|
-
var TEST_MNEMONIC = "tackle wheat jungle viable memory dwarf swift fold purpose cattle impose horn";
|
|
21
|
-
var VALID_SECRET_KEY = "Itk7iNFs91kXKdqVqmLrBKJItNIoSyWAOh+ZC2qaSihpxiAxNYwKPjwfresk9CSbKCmwNwvXfPQoeLL4rVa4OQ=="; //'mdqVWeFekT7pqy5T49+tV12jO0m+ESW7ki4zSU9JiCgbL0kJbj5dvQ/PqcDAzZLZqzshVEs01d1KZdmLh4uZIg==';
|
|
22
|
-
// let secretKeys = (readJsonFile<any>(secretKeysPath as string))
|
|
23
|
-
// let sender = secretKeys[0]
|
|
24
|
-
// let keypair = Ed25519Keypair.fromSecretKey(fromB64(sender))// Error: Wrong secretKey size. Expected 64 bytes, got 65.
|
|
25
|
-
// let keypair = Ed25519Keypair.fromSecretKey(fromB64(VALID_SECRET_KEY))
|
|
26
|
-
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(TEST_MNEMONIC);
|
|
27
|
-
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
28
|
-
function readJsonFile(filePath) {
|
|
29
|
-
return JSON.parse(fs_1.default.readFileSync(filePath, "utf-8"));
|
|
30
|
-
}
|
|
31
|
-
// //Success
|
|
32
|
-
// (async () => {
|
|
33
|
-
// console.log("test for getObjectsOwnedByAddress()")
|
|
34
|
-
// const objects = await provider.getObjectsOwnedByAddress(
|
|
35
|
-
// owner
|
|
36
|
-
// )
|
|
37
|
-
// console.log(objects)
|
|
38
|
-
// })();
|
|
39
|
-
// //Success
|
|
40
|
-
// (async () => {
|
|
41
|
-
// console.log("test for getObject() and getObjectBatch()")
|
|
42
|
-
// const txn = await provider.getObject(
|
|
43
|
-
// obj1
|
|
44
|
-
// );
|
|
45
|
-
// console.log(txn)
|
|
46
|
-
// // You can also fetch multiple objects in one batch request
|
|
47
|
-
// const txns = await provider.getObjectBatch([
|
|
48
|
-
// obj1,
|
|
49
|
-
// obj2,
|
|
50
|
-
// ]);
|
|
51
|
-
// console.log(txns)
|
|
52
|
-
// })();
|
|
53
|
-
// // Fail
|
|
54
|
-
// (async () => {
|
|
55
|
-
// console.log("test for getTransactionWithEffects() and getTransactionWithEffectsBatch()")
|
|
56
|
-
// const txn = await provider.getTransactionWithEffects(
|
|
57
|
-
// obj1Digest
|
|
58
|
-
// );
|
|
59
|
-
// console.log(txn)
|
|
60
|
-
// You can also fetch multiple transactions in one batch request
|
|
61
|
-
// const txns = await provider.getTransactionWithEffectsBatch([
|
|
62
|
-
// obj1Digest,
|
|
63
|
-
// obj2Digest,
|
|
64
|
-
// ]);
|
|
65
|
-
// console.log(txns)
|
|
66
|
-
// })();
|
|
67
|
-
// //Fail (without correct signer)
|
|
68
|
-
// (async () => {
|
|
69
|
-
// console.log("test for transferObject()")
|
|
70
|
-
// const transferTxn = await signer.transferObject({
|
|
71
|
-
// objectId: obj1,
|
|
72
|
-
// gasBudget: gasBudget,
|
|
73
|
-
// recipient: receiver,
|
|
74
|
-
// });
|
|
75
|
-
// console.log('transferTxn', transferTxn);
|
|
76
|
-
// })();
|
|
77
|
-
// //Fail (without correct signer)
|
|
78
|
-
// (async () => {
|
|
79
|
-
// console.log("test for signAndExecuteTransactionBlock()")
|
|
80
|
-
// const moveCallTxn = await signer.signAndExecuteTransactionBlock({
|
|
81
|
-
// packageObjectId: '0x2',
|
|
82
|
-
// module: 'devnet_nft',
|
|
83
|
-
// function: 'mint',
|
|
84
|
-
// typeArguments: [],
|
|
85
|
-
// arguments: [
|
|
86
|
-
// 'Example NFT',
|
|
87
|
-
// 'An NFT created by the wallet Command Line Tool',
|
|
88
|
-
// 'ipfs://bafkreibngqhl3gaa7daob4i2vccziay2jjlp435cf66vhono7nrvww53ty',
|
|
89
|
-
// ],
|
|
90
|
-
// gasBudget: gasBudget,
|
|
91
|
-
// });
|
|
92
|
-
// console.log('moveCallTxn', moveCallTxn);
|
|
93
|
-
// })();
|
|
94
|
-
// //Fail( Error subscribing to event)
|
|
95
|
-
// (async () => {
|
|
96
|
-
// console.log("test for subscribeEvent()")
|
|
97
|
-
// // calls RPC method 'sui_subscribeEvent' with params:
|
|
98
|
-
// // [ { SenderAddress: '0xbff6ccc8707aa517b4f1b95750a2a8c666012df3' } ]
|
|
99
|
-
// const subscriptionId = await provider.subscribeEvent(
|
|
100
|
-
// { SenderAddress: '0xbff6ccc8707aa517b4f1b95750a2a8c666012df3' },
|
|
101
|
-
// (event: SuiEventEnvelope) => {
|
|
102
|
-
// console.log(event)
|
|
103
|
-
// // handle subscription notification message here. This function is called once per subscription message.
|
|
104
|
-
// }
|
|
105
|
-
// );
|
|
106
|
-
// // later, to unsubscribe
|
|
107
|
-
// // calls RPC method 'sui_unsubscribeEvent' with params: [ subscriptionId ]
|
|
108
|
-
// const subFoundAndRemoved = await provider.unsubscribeEvent(subscriptionId);
|
|
109
|
-
// })();
|
|
110
|
-
// //Fail (without correct signer)
|
|
111
|
-
//refer: https://docs.sui.io/build/json-rpc
|
|
112
|
-
// (async () => {
|
|
113
|
-
// console.log("test for publish()")
|
|
114
|
-
// const compiledModules = JSON.parse(
|
|
115
|
-
// execSync(
|
|
116
|
-
// `${cliPath} move build --dump-bytecode-as-base64 --path ${packagePath}`,
|
|
117
|
-
// { encoding: 'utf-8' }
|
|
118
|
-
// )
|
|
119
|
-
// );
|
|
120
|
-
// const modulesInBytes = compiledModules.map((m) =>
|
|
121
|
-
// Array.from(new Base64DataBuffer(m).getData())
|
|
122
|
-
// );
|
|
123
|
-
// const publishTxn = await signer.publish({
|
|
124
|
-
// compiledModules: modulesInBytes,
|
|
125
|
-
// gasBudget: gasBudget,
|
|
126
|
-
// });
|
|
127
|
-
// console.log('publishTxn', publishTxn);
|
|
128
|
-
// })();
|
|
129
|
-
// //Success
|
|
130
|
-
// (async () => {
|
|
131
|
-
// console.log("test for getTransactions()") // return digest
|
|
132
|
-
// let txs = await provider.getTransactionsForObject(
|
|
133
|
-
// obj1
|
|
134
|
-
// )
|
|
135
|
-
// console.log(txs)
|
|
136
|
-
// let tx = await provider.getTransactionWithEffects(
|
|
137
|
-
// txs[0]
|
|
138
|
-
// )
|
|
139
|
-
// console.log(tx)
|
|
140
|
-
// })();
|
|
141
|
-
// //Success
|
|
142
|
-
// (async () => {
|
|
143
|
-
// console.log("test for getEvents()")//input type: EventQuery
|
|
144
|
-
// const senderEvents = await provider.getEvents(
|
|
145
|
-
// { "Transaction": tx1 },
|
|
146
|
-
// null,
|
|
147
|
-
// null,
|
|
148
|
-
// );
|
|
149
|
-
// for (let e of senderEvents.data) {
|
|
150
|
-
// console.log(e.event)
|
|
151
|
-
// }
|
|
152
|
-
// })();
|
|
153
|
-
// let packageId = "0xfbbdd33ab4c02e7a315e2477931bae4cbdf46381";
|
|
154
|
-
// let registry = "0x0a9d87a1b6c00415708d2f1c62784b52f797213c";
|
|
155
|
-
// let coin = "0x84e5c5702bfbb00a830fb43e720a3a412cc2a8db";
|
|
156
|
-
// console.log("test for deposit()")
|
|
157
|
-
// await deposit(packageId, registry, coin)
|
|
158
|
-
// async function deposit(packageId: string, registry: string, coin: string) {
|
|
159
|
-
// let txn = {
|
|
160
|
-
// packageObjectId: packageId,
|
|
161
|
-
// module: 'shark_fin',
|
|
162
|
-
// function: 'deposit',
|
|
163
|
-
// typeArguments: ["0x2::sui::SUI"],
|
|
164
|
-
// arguments: [
|
|
165
|
-
// registry,
|
|
166
|
-
// 0,
|
|
167
|
-
// true,
|
|
168
|
-
// coin
|
|
169
|
-
// ],
|
|
170
|
-
// gasBudget: gasBudget,
|
|
171
|
-
// }
|
|
172
|
-
// const moveCallTxn = await signer.signAndExecuteTransactionBlock(txn);
|
|
173
|
-
// console.log('moveCallTxn', moveCallTxn);
|
|
174
|
-
// }
|
|
@@ -1,75 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
-
exports.getBid = void 0;
|
|
40
|
-
var constants_1 = require("../../constants");
|
|
41
|
-
function getBid(portfolioVault, provider) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
var obj2, ids, tmp, bids;
|
|
44
|
-
return __generator(this, function (_a) {
|
|
45
|
-
switch (_a.label) {
|
|
46
|
-
case 0: return [4 /*yield*/, provider.getDynamicFields({ parentId: portfolioVault.auction.bids })];
|
|
47
|
-
case 1:
|
|
48
|
-
obj2 = (_a.sent()).data;
|
|
49
|
-
ids = obj2.map(function (e) { return e.objectId; });
|
|
50
|
-
return [4 /*yield*/, provider.multiGetObjects({
|
|
51
|
-
ids: ids,
|
|
52
|
-
options: { showContent: true },
|
|
53
|
-
})];
|
|
54
|
-
case 2:
|
|
55
|
-
tmp = _a.sent();
|
|
56
|
-
bids = tmp.map(function (e) {
|
|
57
|
-
var _a;
|
|
58
|
-
//@ts-ignore
|
|
59
|
-
var bidData = (_a = e.data) === null || _a === void 0 ? void 0 : _a.content.fields.value.fields;
|
|
60
|
-
// console.log(bidData);
|
|
61
|
-
var res = {
|
|
62
|
-
price: bidData.price,
|
|
63
|
-
size: Number(bidData.size / Math.pow(10, constants_1.TOKEN_DECIMAL)).toString(),
|
|
64
|
-
tsMs: bidData.ts_ms,
|
|
65
|
-
tokenBalance: bidData.balance,
|
|
66
|
-
ownerAddress: bidData.bidder,
|
|
67
|
-
};
|
|
68
|
-
return res;
|
|
69
|
-
});
|
|
70
|
-
return [2 /*return*/, bids];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
exports.getBid = getBid;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export interface PortfolioVault {
|
|
2
|
-
vaultId: string;
|
|
3
|
-
typeArgs: string[];
|
|
4
|
-
assets: string[];
|
|
5
|
-
info: Info;
|
|
6
|
-
config: Config;
|
|
7
|
-
depositVault: DepositVault;
|
|
8
|
-
bidVault: BidVault;
|
|
9
|
-
auction: Auction;
|
|
10
|
-
authority: string[];
|
|
11
|
-
tvl: string;
|
|
12
|
-
}
|
|
13
|
-
export interface Info {
|
|
14
|
-
index: string;
|
|
15
|
-
creator: string;
|
|
16
|
-
createTsMs: string;
|
|
17
|
-
round: string;
|
|
18
|
-
deliveryInfo: DeliveryInfo;
|
|
19
|
-
}
|
|
20
|
-
export interface Config {
|
|
21
|
-
optionType: string;
|
|
22
|
-
period: number;
|
|
23
|
-
activationTsMs: string;
|
|
24
|
-
expirationTsMs: string;
|
|
25
|
-
dTokenDecimal: string;
|
|
26
|
-
bTokenDecimal: string;
|
|
27
|
-
oTokenDecimal: string;
|
|
28
|
-
lotSize: string;
|
|
29
|
-
capacity: string;
|
|
30
|
-
leverage: string;
|
|
31
|
-
hasNext: boolean;
|
|
32
|
-
activeVaultConfig: VaultConfig;
|
|
33
|
-
warmupVaultConfig: VaultConfig;
|
|
34
|
-
upcomingVaultConfig: VaultConfig;
|
|
35
|
-
}
|
|
36
|
-
export declare function parseVaultConfig(vaultConfigF: any): VaultConfig;
|
|
37
|
-
export declare function parsePayoffConfig(payoffConfigF: any): PayoffConfig;
|
|
38
|
-
export interface PayoffConfig {
|
|
39
|
-
strikePct: string;
|
|
40
|
-
weight: string;
|
|
41
|
-
isBuyer: boolean;
|
|
42
|
-
strike: string;
|
|
43
|
-
}
|
|
44
|
-
export interface VaultConfig {
|
|
45
|
-
payoffConfigs: PayoffConfig[];
|
|
46
|
-
strikeIncrement: string;
|
|
47
|
-
decaySpeed: string;
|
|
48
|
-
initialPrice: string;
|
|
49
|
-
finalPrice: string;
|
|
50
|
-
auctionDurationInMs: string;
|
|
51
|
-
}
|
|
52
|
-
export interface DeliveryInfo {
|
|
53
|
-
round: string;
|
|
54
|
-
price: string;
|
|
55
|
-
size: string;
|
|
56
|
-
premium: string;
|
|
57
|
-
tsMs: string;
|
|
58
|
-
}
|
|
59
|
-
export interface DepositVault {
|
|
60
|
-
activeSubVault: SubVault;
|
|
61
|
-
deactivatingSubVault: SubVault;
|
|
62
|
-
inactiveSubVault: SubVault;
|
|
63
|
-
warmupSubVault: SubVault;
|
|
64
|
-
hasNext: boolean;
|
|
65
|
-
}
|
|
66
|
-
export interface BidVault {
|
|
67
|
-
bidderSubVault: SubVault;
|
|
68
|
-
premiumSubVault: SubVault;
|
|
69
|
-
performanceFeeSubVault: SubVault;
|
|
70
|
-
}
|
|
71
|
-
export interface SubVault {
|
|
72
|
-
balance: string;
|
|
73
|
-
shareSupply: string;
|
|
74
|
-
}
|
|
75
|
-
export declare function parseSubVault(subVaultF: any): SubVault;
|
|
76
|
-
export interface Auction {
|
|
77
|
-
startTsMs: string;
|
|
78
|
-
endTsMs: string;
|
|
79
|
-
priceConfig: PriceConfig;
|
|
80
|
-
index: string;
|
|
81
|
-
bids: string;
|
|
82
|
-
ownerships: string;
|
|
83
|
-
totalBidSize: string;
|
|
84
|
-
ableToRemoveBid: boolean;
|
|
85
|
-
}
|
|
86
|
-
export interface PriceConfig {
|
|
87
|
-
decaySpeed: string;
|
|
88
|
-
initialPrice: string;
|
|
89
|
-
finalPrice: string;
|
|
90
|
-
}
|
|
91
|
-
export interface Bid {
|
|
92
|
-
price: string;
|
|
93
|
-
size: string;
|
|
94
|
-
tsMs: string;
|
|
95
|
-
tokenBalance: string;
|
|
96
|
-
ownerAddress: string;
|
|
97
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSubVault = exports.parsePayoffConfig = exports.parseVaultConfig = void 0;
|
|
4
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
5
|
-
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.devnetConnection); //for read only operations
|
|
6
|
-
var decode = function (str) { return Buffer.from(str, "base64").toString("binary"); };
|
|
7
|
-
function parseVaultConfig(vaultConfigF) {
|
|
8
|
-
var payoffConfigs = vaultConfigF.payoff_configs.map(function (x) { return parsePayoffConfig(x.fields); });
|
|
9
|
-
return {
|
|
10
|
-
payoffConfigs: payoffConfigs,
|
|
11
|
-
strikeIncrement: vaultConfigF.strike_increment,
|
|
12
|
-
decaySpeed: vaultConfigF.decay_speed,
|
|
13
|
-
initialPrice: vaultConfigF.initial_price,
|
|
14
|
-
finalPrice: vaultConfigF.final_price,
|
|
15
|
-
auctionDurationInMs: vaultConfigF.auction_duration_in_ms,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.parseVaultConfig = parseVaultConfig;
|
|
19
|
-
function parsePayoffConfig(payoffConfigF) {
|
|
20
|
-
return {
|
|
21
|
-
strikePct: payoffConfigF.strike_pct,
|
|
22
|
-
weight: payoffConfigF.weight,
|
|
23
|
-
isBuyer: payoffConfigF.is_buyer,
|
|
24
|
-
strike: payoffConfigF.strike,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.parsePayoffConfig = parsePayoffConfig;
|
|
28
|
-
function parseSubVault(subVaultF) {
|
|
29
|
-
return {
|
|
30
|
-
balance: subVaultF.balance,
|
|
31
|
-
shareSupply: subVaultF.share_supply,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
exports.parseSubVault = parseSubVault;
|
|
@@ -1,74 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
-
exports.getTypeArgumentFromToken = void 0;
|
|
40
|
-
function getTypeArgumentFromToken(token, provider) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
-
var tokenInfo, typeArgument, e_1;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
_a.trys.push([0, 2, , 3]);
|
|
47
|
-
return [4 /*yield*/, provider.getObject({
|
|
48
|
-
id: token,
|
|
49
|
-
options: { showContent: true },
|
|
50
|
-
})];
|
|
51
|
-
case 1:
|
|
52
|
-
tokenInfo = _a.sent();
|
|
53
|
-
if (tokenInfo.error !== undefined) {
|
|
54
|
-
console.log("obj not exists, but is:");
|
|
55
|
-
console.log(tokenInfo.error.code);
|
|
56
|
-
return [2 /*return*/];
|
|
57
|
-
}
|
|
58
|
-
1;
|
|
59
|
-
console.log(tokenInfo);
|
|
60
|
-
typeArgument = tokenInfo.data.content.type;
|
|
61
|
-
console.log(typeArgument);
|
|
62
|
-
typeArgument = typeArgument.split("<")[1];
|
|
63
|
-
typeArgument = typeArgument.split(">")[0];
|
|
64
|
-
return [2 /*return*/, typeArgument];
|
|
65
|
-
case 2:
|
|
66
|
-
e_1 = _a.sent();
|
|
67
|
-
console.error(e_1);
|
|
68
|
-
return [3 /*break*/, 3];
|
|
69
|
-
case 3: return [2 /*return*/];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.getTypeArgumentFromToken = getTypeArgumentFromToken;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from "@mysten/sui.js";
|
|
2
|
-
import { PortfolioVault } from "./fetchData";
|
|
3
|
-
export declare function getVaultDataFromRegistry(registry: string, provider: JsonRpcProvider, index?: string): Promise<PortfolioVault[]>;
|
|
4
|
-
export declare function getNodesKeyFromLinkedList(linkedList: string, provider: JsonRpcProvider): Promise<string[]>;
|
|
5
|
-
export declare function getUserShares(user_share_registry: string, provider: JsonRpcProvider, user: string): Promise<Share[]>;
|
|
6
|
-
export interface Share {
|
|
7
|
-
index: string;
|
|
8
|
-
tag: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function getUserInfo(user_share_registry: string, provider: JsonRpcProvider): Promise<UserInfo[]>;
|
|
12
|
-
export interface UserInfo {
|
|
13
|
-
user: string;
|
|
14
|
-
shares: Share[];
|
|
15
|
-
}
|