@typus/typus-sdk 1.1.1 → 1.1.2
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.
|
@@ -176,3 +176,21 @@ export interface DepositShare {
|
|
|
176
176
|
export declare function getDepositShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
177
177
|
[key: string]: DepositShare;
|
|
178
178
|
}>;
|
|
179
|
+
export interface BidVault {
|
|
180
|
+
id: string;
|
|
181
|
+
depositToken: string;
|
|
182
|
+
bidToken: string;
|
|
183
|
+
incentiveToken: string | undefined;
|
|
184
|
+
index: string;
|
|
185
|
+
shareSupply: string;
|
|
186
|
+
metadata: string;
|
|
187
|
+
u64Padding: string[];
|
|
188
|
+
bcsPadding: string[];
|
|
189
|
+
}
|
|
190
|
+
export interface BidShare {
|
|
191
|
+
bidVault: BidVault;
|
|
192
|
+
share: string;
|
|
193
|
+
}
|
|
194
|
+
export declare function getMyBids(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
195
|
+
[key: string]: BidShare;
|
|
196
|
+
}>;
|
|
@@ -52,7 +52,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.getDepositShares = exports.getAuctionBids = exports.getAuctions = exports.getVaults = exports.SENDER = void 0;
|
|
55
|
+
exports.getMyBids = exports.getDepositShares = exports.getAuctionBids = exports.getAuctions = exports.getVaults = exports.SENDER = void 0;
|
|
56
56
|
var sui_js_1 = require("@mysten/sui.js");
|
|
57
57
|
var bcs_1 = require("@mysten/bcs");
|
|
58
58
|
var tools_1 = require("../tools");
|
|
@@ -451,48 +451,66 @@ function getDepositShares(provider, typusFrameworkPackageId, packageId, registry
|
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
453
|
exports.getDepositShares = getDepositShares;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
454
|
+
function getMyBids(provider, typusFrameworkPackageId, packageId, registry, receipts) {
|
|
455
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
456
|
+
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
457
|
+
return __generator(this, function (_a) {
|
|
458
|
+
switch (_a.label) {
|
|
459
|
+
case 0:
|
|
460
|
+
transactionBlock = new sui_js_1.TransactionBlock();
|
|
461
|
+
target = "".concat(packageId, "::tds_view_function::get_my_bids_bcs");
|
|
462
|
+
transactionBlockArguments = [
|
|
463
|
+
transactionBlock.pure(registry),
|
|
464
|
+
transactionBlock.makeMoveVec({
|
|
465
|
+
type: "".concat(typusFrameworkPackageId, "::vault::TypusBidReceipt"),
|
|
466
|
+
objects: receipts.map(function (id) { return transactionBlock.object(id); }),
|
|
467
|
+
}),
|
|
468
|
+
];
|
|
469
|
+
transactionBlock.moveCall({
|
|
470
|
+
target: target,
|
|
471
|
+
typeArguments: [],
|
|
472
|
+
arguments: transactionBlockArguments,
|
|
473
|
+
});
|
|
474
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: exports.SENDER })];
|
|
475
|
+
case 1:
|
|
476
|
+
results = (_a.sent()).results;
|
|
477
|
+
bytes = results[results.length - 1].returnValues[0][0];
|
|
478
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
479
|
+
result = Array.from(new Map()).reduce(function (map, _a) {
|
|
480
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
481
|
+
map[key] = value;
|
|
482
|
+
return map;
|
|
483
|
+
}, {});
|
|
484
|
+
reader.readVec(function (reader, i) {
|
|
485
|
+
reader.read16();
|
|
486
|
+
var bidVault = {
|
|
487
|
+
id: (0, tools_1.AddressFromBytes)(reader.readBytes(32)),
|
|
488
|
+
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
489
|
+
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
490
|
+
incentiveToken: reader
|
|
491
|
+
.readVec(function (reader) {
|
|
492
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
|
493
|
+
})
|
|
494
|
+
.at(0),
|
|
495
|
+
index: reader.read64(),
|
|
496
|
+
shareSupply: reader.read64(),
|
|
497
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
498
|
+
u64Padding: reader.readVec(function (reader) {
|
|
499
|
+
return reader.read64();
|
|
500
|
+
}),
|
|
501
|
+
bcsPadding: reader.readVec(function (reader) {
|
|
502
|
+
return reader.read8();
|
|
503
|
+
}),
|
|
504
|
+
};
|
|
505
|
+
result[bidVault.index] = {
|
|
506
|
+
bidVault: bidVault,
|
|
507
|
+
share: reader.read64(),
|
|
508
|
+
};
|
|
509
|
+
});
|
|
510
|
+
// @ts-ignore
|
|
511
|
+
return [2 /*return*/, result];
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
exports.getMyBids = getMyBids;
|