@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
- // export interface BidShare {
455
- // index: string;
456
- // share: string;
457
- // }
458
- // export async function getBidShares(
459
- // provider: JsonRpcProvider,
460
- // typusFrameworkPackageId: string,
461
- // packageId: string,
462
- // registry: string,
463
- // receipts: string[]
464
- // ): Promise<{ [key: string]: BidShare }> {
465
- // let transactionBlock = new TransactionBlock();
466
- // let target = `${packageId}::tds_view_function::get_bid_shares_bcs` as any;
467
- // let transactionBlockArguments = [
468
- // transactionBlock.pure(registry),
469
- // transactionBlock.makeMoveVec({
470
- // type: `${typusFrameworkPackageId}::vault::TypusBidReceipt`,
471
- // objects: receipts.map((id) => transactionBlock.object(id)),
472
- // }),
473
- // ];
474
- // transactionBlock.moveCall({
475
- // target,
476
- // typeArguments: [],
477
- // arguments: transactionBlockArguments,
478
- // });
479
- // let results = (await provider.devInspectTransactionBlock({ transactionBlock, sender: SENDER })).results;
480
- // // @ts-ignore
481
- // let bytes = results[results.length - 1].returnValues[0][0];
482
- // let reader = new BcsReader(new Uint8Array(bytes));
483
- // let result = Array.from(new Map()).reduce((map, [key, value]) => {
484
- // map[key] = value;
485
- // return map;
486
- // }, {});
487
- // reader.readVec((reader, i) => {
488
- // reader.read8();
489
- // let index = reader.read64();
490
- // let share = reader.read64();
491
- // result[index] = {
492
- // index: reader.read64(),
493
- // share: reader.read64(),
494
- // } as BidShare;
495
- // });
496
- // // @ts-ignore
497
- // return result;
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;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.1.1",
5
+ "version": "1.1.2",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "^0.3.3",