@typus/typus-perp-sdk 1.1.3 → 1.1.5-pnl

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.
@@ -1,4 +1,11 @@
1
1
  import { Transaction, TransactionArgument, TransactionObjectInput } from "@mysten/sui/transactions";
2
+ export interface AddDelegateUserArgs {
3
+ version: TransactionObjectInput;
4
+ registry: TransactionObjectInput;
5
+ marketIndex: bigint | TransactionArgument;
6
+ user: string | TransactionArgument;
7
+ }
8
+ export declare function addDelegateUser(tx: Transaction, args: AddDelegateUserArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
2
9
  export interface AddTradingSymbolArgs {
3
10
  version: TransactionObjectInput;
4
11
  registry: TransactionObjectInput;
@@ -65,7 +72,17 @@ export interface CancelTradingOrderArgs {
65
72
  orderUser: string | TransactionArgument | TransactionArgument | null;
66
73
  }
67
74
  export declare function cancelTradingOrder(tx: Transaction, typeArgs: [string, string], args: CancelTradingOrderArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
68
- export interface CheckCollateralEnoughArgs {
75
+ export interface CheckCollateralEnoughWhenAddingPositionArgs {
76
+ symbolMarket: TransactionObjectInput;
77
+ order: TransactionObjectInput;
78
+ collateralOraclePrice: bigint | TransactionArgument;
79
+ collateralOraclePriceDecimal: bigint | TransactionArgument;
80
+ tradingPairOraclePrice: bigint | TransactionArgument;
81
+ tradingPairOraclePriceDecimal: bigint | TransactionArgument;
82
+ tradingFeeMbp: bigint | TransactionArgument;
83
+ }
84
+ export declare function checkCollateralEnoughWhenAddingPosition(tx: Transaction, typeArg: string, args: CheckCollateralEnoughWhenAddingPositionArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
85
+ export interface CheckCollateralEnoughWhenReducingPositionArgs {
69
86
  symbolMarket: TransactionObjectInput;
70
87
  order: TransactionObjectInput;
71
88
  collateralOraclePrice: bigint | TransactionArgument;
@@ -74,7 +91,7 @@ export interface CheckCollateralEnoughArgs {
74
91
  tradingPairOraclePriceDecimal: bigint | TransactionArgument;
75
92
  tradingFeeMbp: bigint | TransactionArgument;
76
93
  }
77
- export declare function checkCollateralEnough(tx: Transaction, typeArg: string, args: CheckCollateralEnoughArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
94
+ export declare function checkCollateralEnoughWhenReducingPosition(tx: Transaction, typeArg: string, args: CheckCollateralEnoughWhenReducingPositionArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
78
95
  export interface CheckOptionCollateralEnoughArgs {
79
96
  dovRegistry: TransactionObjectInput;
80
97
  typusOracleTradingSymbol: TransactionObjectInput;
@@ -181,6 +198,19 @@ export interface CreateTradingOrderWithBidReceiptV2Args {
181
198
  user: string | TransactionArgument;
182
199
  }
183
200
  export declare function createTradingOrderWithBidReceiptV2(tx: Transaction, typeArgs: [string, string, string], args: CreateTradingOrderWithBidReceiptV2Args, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
201
+ export interface CreateUserAccountArgs {
202
+ version: TransactionObjectInput;
203
+ registry: TransactionObjectInput;
204
+ marketIndex: bigint | TransactionArgument;
205
+ }
206
+ export declare function createUserAccount(tx: Transaction, args: CreateUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
207
+ export interface DepositUserAccountArgs {
208
+ version: TransactionObjectInput;
209
+ registry: TransactionObjectInput;
210
+ marketIndex: bigint | TransactionArgument;
211
+ collateral: TransactionObjectInput;
212
+ }
213
+ export declare function depositUserAccount(tx: Transaction, typeArg: string, args: DepositUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
184
214
  export declare function deprecated(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
185
215
  export interface ExecuteOptionCollateralOrder_Args {
186
216
  version: TransactionObjectInput;
@@ -309,6 +339,11 @@ export interface GetMaxReleasingCollateralAmountArgs {
309
339
  positionId: bigint | TransactionArgument;
310
340
  }
311
341
  export declare function getMaxReleasingCollateralAmount(tx: Transaction, typeArgs: [string, string], args: GetMaxReleasingCollateralAmountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
342
+ export interface GetMutMarketIdArgs {
343
+ registry: TransactionObjectInput;
344
+ marketIndex: bigint | TransactionArgument;
345
+ }
346
+ export declare function getMutMarketId(tx: Transaction, args: GetMutMarketIdArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
312
347
  export interface GetMutOrdersArgs {
313
348
  symbolMarket: TransactionObjectInput;
314
349
  isTokenCollateral: boolean | TransactionArgument;
@@ -349,6 +384,12 @@ export interface IncreaseCollateralArgs {
349
384
  }
350
385
  export declare function increaseCollateral(tx: Transaction, typeArgs: [string, string], args: IncreaseCollateralArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
351
386
  export declare function init(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
387
+ export interface InitUserAccountTableArgs {
388
+ version: TransactionObjectInput;
389
+ registry: TransactionObjectInput;
390
+ marketIndex: bigint | TransactionArgument;
391
+ }
392
+ export declare function initUserAccountTable(tx: Transaction, args: InitUserAccountTableArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
352
393
  export interface LiquidateArgs {
353
394
  version: TransactionObjectInput;
354
395
  registry: TransactionObjectInput;
@@ -634,6 +675,13 @@ export interface RemoveTradingSymbolArgs {
634
675
  marketIndex: bigint | TransactionArgument;
635
676
  }
636
677
  export declare function removeTradingSymbol(tx: Transaction, typeArg: string, args: RemoveTradingSymbolArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
678
+ export interface RemoveUserAccountArgs {
679
+ version: TransactionObjectInput;
680
+ registry: TransactionObjectInput;
681
+ marketIndex: bigint | TransactionArgument;
682
+ userAccountCap: TransactionObjectInput;
683
+ }
684
+ export declare function removeUserAccount(tx: Transaction, args: RemoveUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
637
685
  export interface ResumeMarketArgs {
638
686
  version: TransactionObjectInput;
639
687
  registry: TransactionObjectInput;
@@ -646,6 +694,12 @@ export interface ResumeTradingSymbolArgs {
646
694
  marketIndex: bigint | TransactionArgument;
647
695
  }
648
696
  export declare function resumeTradingSymbol(tx: Transaction, typeArg: string, args: ResumeTradingSymbolArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
697
+ export interface ReturnToUserArgs {
698
+ marketId: TransactionObjectInput;
699
+ balance: TransactionObjectInput;
700
+ user: string | TransactionArgument;
701
+ }
702
+ export declare function returnToUser(tx: Transaction, typeArg: string, args: ReturnToUserArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
649
703
  export interface SettleReceiptCollateralArgs {
650
704
  version: TransactionObjectInput;
651
705
  registry: TransactionObjectInput;
@@ -715,3 +769,11 @@ export interface UpdateProtocolFeeShareBpArgs {
715
769
  protocolFeeShareBp: bigint | TransactionArgument;
716
770
  }
717
771
  export declare function updateProtocolFeeShareBp(tx: Transaction, args: UpdateProtocolFeeShareBpArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
772
+ export interface WithdrawUserAccountArgs {
773
+ version: TransactionObjectInput;
774
+ registry: TransactionObjectInput;
775
+ marketIndex: bigint | TransactionArgument;
776
+ amount: bigint | TransactionArgument | TransactionArgument | null;
777
+ userAccountCap: TransactionObjectInput;
778
+ }
779
+ export declare function withdrawUserAccount(tx: Transaction, typeArg: string, args: WithdrawUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
@@ -1,18 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addDelegateUser = addDelegateUser;
3
4
  exports.addTradingSymbol = addTradingSymbol;
4
5
  exports.adjustMarketInfoUserOrderSize = adjustMarketInfoUserOrderSize;
5
6
  exports.adjustMarketInfoUserPositionSize = adjustMarketInfoUserPositionSize;
6
7
  exports.calculateTradingFeeRateMbp = calculateTradingFeeRateMbp;
7
8
  exports.cancelLinkedOrders = cancelLinkedOrders;
8
9
  exports.cancelTradingOrder = cancelTradingOrder;
9
- exports.checkCollateralEnough = checkCollateralEnough;
10
+ exports.checkCollateralEnoughWhenAddingPosition = checkCollateralEnoughWhenAddingPosition;
11
+ exports.checkCollateralEnoughWhenReducingPosition = checkCollateralEnoughWhenReducingPosition;
10
12
  exports.checkOptionCollateralEnough = checkOptionCollateralEnough;
11
13
  exports.checkReserveEnough = checkReserveEnough;
12
14
  exports.createTradingOrder = createTradingOrder;
13
15
  exports.createTradingOrderV2 = createTradingOrderV2;
14
16
  exports.createTradingOrderWithBidReceipt = createTradingOrderWithBidReceipt;
15
17
  exports.createTradingOrderWithBidReceiptV2 = createTradingOrderWithBidReceiptV2;
18
+ exports.createUserAccount = createUserAccount;
19
+ exports.depositUserAccount = depositUserAccount;
16
20
  exports.deprecated = deprecated;
17
21
  exports.executeOptionCollateralOrder_ = executeOptionCollateralOrder_;
18
22
  exports.executeOrder_ = executeOrder_;
@@ -26,12 +30,14 @@ exports.getLinkedPosition = getLinkedPosition;
26
30
  exports.getLiquidationInfo = getLiquidationInfo;
27
31
  exports.getMarketsBcs = getMarketsBcs;
28
32
  exports.getMaxReleasingCollateralAmount = getMaxReleasingCollateralAmount;
33
+ exports.getMutMarketId = getMutMarketId;
29
34
  exports.getMutOrders = getMutOrders;
30
35
  exports.getOrders = getOrders;
31
36
  exports.getUserOrders = getUserOrders;
32
37
  exports.getUserPositions = getUserPositions;
33
38
  exports.increaseCollateral = increaseCollateral;
34
39
  exports.init = init;
40
+ exports.initUserAccountTable = initUserAccountTable;
35
41
  exports.liquidate = liquidate;
36
42
  exports.managerCancelOrderByOpenInterestLimit = managerCancelOrderByOpenInterestLimit;
37
43
  exports.managerCloseOptionPosition = managerCloseOptionPosition;
@@ -53,8 +59,10 @@ exports.releaseCollateral = releaseCollateral;
53
59
  exports.removeLinkedOrder_ = removeLinkedOrder_;
54
60
  exports.removeLinkedOrders = removeLinkedOrders;
55
61
  exports.removeTradingSymbol = removeTradingSymbol;
62
+ exports.removeUserAccount = removeUserAccount;
56
63
  exports.resumeMarket = resumeMarket;
57
64
  exports.resumeTradingSymbol = resumeTradingSymbol;
65
+ exports.returnToUser = returnToUser;
58
66
  exports.settleReceiptCollateral = settleReceiptCollateral;
59
67
  exports.suspendMarket = suspendMarket;
60
68
  exports.suspendTradingSymbol = suspendTradingSymbol;
@@ -63,10 +71,18 @@ exports.tradingSymbolExists = tradingSymbolExists;
63
71
  exports.updateFundingRate = updateFundingRate;
64
72
  exports.updateMarketConfig = updateMarketConfig;
65
73
  exports.updateProtocolFeeShareBp = updateProtocolFeeShareBp;
74
+ exports.withdrawUserAccount = withdrawUserAccount;
66
75
  var __1 = require("..");
67
76
  var structs_1 = require("../../_dependencies/source/0x1/option/structs");
68
77
  var structs_2 = require("../../_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs");
69
78
  var util_1 = require("../../_framework/util");
79
+ function addDelegateUser(tx, args, published_at) {
80
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
81
+ return tx.moveCall({
82
+ target: "".concat(published_at, "::trading::add_delegate_user"),
83
+ arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64"), (0, util_1.pure)(tx, args.user, "address")],
84
+ });
85
+ }
70
86
  function addTradingSymbol(tx, typeArg, args, published_at) {
71
87
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
72
88
  return tx.moveCall({
@@ -166,10 +182,26 @@ function cancelTradingOrder(tx, typeArgs, args, published_at) {
166
182
  ],
167
183
  });
168
184
  }
169
- function checkCollateralEnough(tx, typeArg, args, published_at) {
185
+ function checkCollateralEnoughWhenAddingPosition(tx, typeArg, args, published_at) {
170
186
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
171
187
  return tx.moveCall({
172
- target: "".concat(published_at, "::trading::check_collateral_enough"),
188
+ target: "".concat(published_at, "::trading::check_collateral_enough_when_adding_position"),
189
+ typeArguments: [typeArg],
190
+ arguments: [
191
+ (0, util_1.obj)(tx, args.symbolMarket),
192
+ (0, util_1.obj)(tx, args.order),
193
+ (0, util_1.pure)(tx, args.collateralOraclePrice, "u64"),
194
+ (0, util_1.pure)(tx, args.collateralOraclePriceDecimal, "u64"),
195
+ (0, util_1.pure)(tx, args.tradingPairOraclePrice, "u64"),
196
+ (0, util_1.pure)(tx, args.tradingPairOraclePriceDecimal, "u64"),
197
+ (0, util_1.pure)(tx, args.tradingFeeMbp, "u64"),
198
+ ],
199
+ });
200
+ }
201
+ function checkCollateralEnoughWhenReducingPosition(tx, typeArg, args, published_at) {
202
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
203
+ return tx.moveCall({
204
+ target: "".concat(published_at, "::trading::check_collateral_enough_when_reducing_position"),
173
205
  typeArguments: [typeArg],
174
206
  arguments: [
175
207
  (0, util_1.obj)(tx, args.symbolMarket),
@@ -324,6 +356,21 @@ function createTradingOrderWithBidReceiptV2(tx, typeArgs, args, published_at) {
324
356
  ],
325
357
  });
326
358
  }
359
+ function createUserAccount(tx, args, published_at) {
360
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
361
+ return tx.moveCall({
362
+ target: "".concat(published_at, "::trading::create_user_account"),
363
+ arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64")],
364
+ });
365
+ }
366
+ function depositUserAccount(tx, typeArg, args, published_at) {
367
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
368
+ return tx.moveCall({
369
+ target: "".concat(published_at, "::trading::deposit_user_account"),
370
+ typeArguments: [typeArg],
371
+ arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64"), (0, util_1.obj)(tx, args.collateral)],
372
+ });
373
+ }
327
374
  function deprecated(tx, published_at) {
328
375
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
329
376
  return tx.moveCall({ target: "".concat(published_at, "::trading::deprecated"), arguments: [] });
@@ -508,6 +555,13 @@ function getMaxReleasingCollateralAmount(tx, typeArgs, args, published_at) {
508
555
  ],
509
556
  });
510
557
  }
558
+ function getMutMarketId(tx, args, published_at) {
559
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
560
+ return tx.moveCall({
561
+ target: "".concat(published_at, "::trading::get_mut_market_id"),
562
+ arguments: [(0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64")],
563
+ });
564
+ }
511
565
  function getMutOrders(tx, args, published_at) {
512
566
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
513
567
  return tx.moveCall({
@@ -559,6 +613,13 @@ function init(tx, published_at) {
559
613
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
560
614
  return tx.moveCall({ target: "".concat(published_at, "::trading::init"), arguments: [] });
561
615
  }
616
+ function initUserAccountTable(tx, args, published_at) {
617
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
618
+ return tx.moveCall({
619
+ target: "".concat(published_at, "::trading::init_user_account_table"),
620
+ arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64")],
621
+ });
622
+ }
562
623
  function liquidate(tx, typeArgs, args, published_at) {
563
624
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
564
625
  return tx.moveCall({
@@ -958,6 +1019,13 @@ function removeTradingSymbol(tx, typeArg, args, published_at) {
958
1019
  arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64")],
959
1020
  });
960
1021
  }
1022
+ function removeUserAccount(tx, args, published_at) {
1023
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
1024
+ return tx.moveCall({
1025
+ target: "".concat(published_at, "::trading::remove_user_account"),
1026
+ arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64"), (0, util_1.obj)(tx, args.userAccountCap)],
1027
+ });
1028
+ }
961
1029
  function resumeMarket(tx, args, published_at) {
962
1030
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
963
1031
  return tx.moveCall({
@@ -973,6 +1041,14 @@ function resumeTradingSymbol(tx, typeArg, args, published_at) {
973
1041
  arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64")],
974
1042
  });
975
1043
  }
1044
+ function returnToUser(tx, typeArg, args, published_at) {
1045
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
1046
+ return tx.moveCall({
1047
+ target: "".concat(published_at, "::trading::return_to_user"),
1048
+ typeArguments: [typeArg],
1049
+ arguments: [(0, util_1.obj)(tx, args.marketId), (0, util_1.obj)(tx, args.balance), (0, util_1.pure)(tx, args.user, "address")],
1050
+ });
1051
+ }
976
1052
  function settleReceiptCollateral(tx, typeArgs, args, published_at) {
977
1053
  if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
978
1054
  return tx.moveCall({
@@ -1080,3 +1156,17 @@ function updateProtocolFeeShareBp(tx, args, published_at) {
1080
1156
  ],
1081
1157
  });
1082
1158
  }
1159
+ function withdrawUserAccount(tx, typeArg, args, published_at) {
1160
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
1161
+ return tx.moveCall({
1162
+ target: "".concat(published_at, "::trading::withdraw_user_account"),
1163
+ typeArguments: [typeArg],
1164
+ arguments: [
1165
+ (0, util_1.obj)(tx, args.version),
1166
+ (0, util_1.obj)(tx, args.registry),
1167
+ (0, util_1.pure)(tx, args.marketIndex, "u64"),
1168
+ (0, util_1.pure)(tx, args.amount, "".concat(structs_1.Option.$typeName, "<u64>")),
1169
+ (0, util_1.obj)(tx, args.userAccountCap),
1170
+ ],
1171
+ });
1172
+ }
@@ -0,0 +1,36 @@
1
+ import { Transaction, TransactionArgument, TransactionObjectInput } from "@mysten/sui/transactions";
2
+ export interface AddDelegateUserArgs {
3
+ userAccount: TransactionObjectInput;
4
+ user: string | TransactionArgument;
5
+ }
6
+ export declare function addDelegateUser(tx: Transaction, args: AddDelegateUserArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
7
+ export declare function checkOwner(tx: Transaction, userAccount: TransactionObjectInput, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
8
+ export interface DepositArgs {
9
+ userAccount: TransactionObjectInput;
10
+ balance: TransactionObjectInput;
11
+ }
12
+ export declare function deposit(tx: Transaction, typeArg: string, args: DepositArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
13
+ export interface GetMutUserAccountArgs {
14
+ marketId: TransactionObjectInput;
15
+ user: string | TransactionArgument;
16
+ }
17
+ export declare function getMutUserAccount(tx: Transaction, args: GetMutUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
18
+ export declare function getUserAccountOwner(tx: Transaction, userAccountCap: TransactionObjectInput, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
19
+ export interface HasUserAccountArgs {
20
+ marketId: TransactionObjectInput;
21
+ user: string | TransactionArgument;
22
+ }
23
+ export declare function hasUserAccount(tx: Transaction, args: HasUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
24
+ export declare function newUserAccount(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
25
+ export interface RemoveUserAccountArgs {
26
+ marketId: TransactionObjectInput;
27
+ user: string | TransactionArgument;
28
+ userAccountCap: TransactionObjectInput;
29
+ }
30
+ export declare function removeUserAccount(tx: Transaction, args: RemoveUserAccountArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
31
+ export interface WithdrawArgs {
32
+ userAccount: TransactionObjectInput;
33
+ amount: bigint | TransactionArgument | TransactionArgument | null;
34
+ userAccountCap: TransactionObjectInput;
35
+ }
36
+ export declare function withdraw(tx: Transaction, typeArg: string, args: WithdrawArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addDelegateUser = addDelegateUser;
4
+ exports.checkOwner = checkOwner;
5
+ exports.deposit = deposit;
6
+ exports.getMutUserAccount = getMutUserAccount;
7
+ exports.getUserAccountOwner = getUserAccountOwner;
8
+ exports.hasUserAccount = hasUserAccount;
9
+ exports.newUserAccount = newUserAccount;
10
+ exports.removeUserAccount = removeUserAccount;
11
+ exports.withdraw = withdraw;
12
+ var __1 = require("..");
13
+ var structs_1 = require("../../_dependencies/source/0x1/option/structs");
14
+ var util_1 = require("../../_framework/util");
15
+ function addDelegateUser(tx, args, published_at) {
16
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
17
+ return tx.moveCall({
18
+ target: "".concat(published_at, "::user_account::add_delegate_user"),
19
+ arguments: [(0, util_1.obj)(tx, args.userAccount), (0, util_1.pure)(tx, args.user, "address")],
20
+ });
21
+ }
22
+ function checkOwner(tx, userAccount, published_at) {
23
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
24
+ return tx.moveCall({ target: "".concat(published_at, "::user_account::check_owner"), arguments: [(0, util_1.obj)(tx, userAccount)] });
25
+ }
26
+ function deposit(tx, typeArg, args, published_at) {
27
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
28
+ return tx.moveCall({
29
+ target: "".concat(published_at, "::user_account::deposit"),
30
+ typeArguments: [typeArg],
31
+ arguments: [(0, util_1.obj)(tx, args.userAccount), (0, util_1.obj)(tx, args.balance)],
32
+ });
33
+ }
34
+ function getMutUserAccount(tx, args, published_at) {
35
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
36
+ return tx.moveCall({
37
+ target: "".concat(published_at, "::user_account::get_mut_user_account"),
38
+ arguments: [(0, util_1.obj)(tx, args.marketId), (0, util_1.pure)(tx, args.user, "address")],
39
+ });
40
+ }
41
+ function getUserAccountOwner(tx, userAccountCap, published_at) {
42
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
43
+ return tx.moveCall({ target: "".concat(published_at, "::user_account::get_user_account_owner"), arguments: [(0, util_1.obj)(tx, userAccountCap)] });
44
+ }
45
+ function hasUserAccount(tx, args, published_at) {
46
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
47
+ return tx.moveCall({
48
+ target: "".concat(published_at, "::user_account::has_user_account"),
49
+ arguments: [(0, util_1.obj)(tx, args.marketId), (0, util_1.pure)(tx, args.user, "address")],
50
+ });
51
+ }
52
+ function newUserAccount(tx, published_at) {
53
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
54
+ return tx.moveCall({ target: "".concat(published_at, "::user_account::new_user_account"), arguments: [] });
55
+ }
56
+ function removeUserAccount(tx, args, published_at) {
57
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
58
+ return tx.moveCall({
59
+ target: "".concat(published_at, "::user_account::remove_user_account"),
60
+ arguments: [(0, util_1.obj)(tx, args.marketId), (0, util_1.pure)(tx, args.user, "address"), (0, util_1.obj)(tx, args.userAccountCap)],
61
+ });
62
+ }
63
+ function withdraw(tx, typeArg, args, published_at) {
64
+ if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
65
+ return tx.moveCall({
66
+ target: "".concat(published_at, "::user_account::withdraw"),
67
+ typeArguments: [typeArg],
68
+ arguments: [(0, util_1.obj)(tx, args.userAccount), (0, util_1.pure)(tx, args.amount, "".concat(structs_1.Option.$typeName, "<u64>")), (0, util_1.obj)(tx, args.userAccountCap)],
69
+ });
70
+ }
@@ -0,0 +1,168 @@
1
+ import * as reified from "../../_framework/reified";
2
+ import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
3
+ import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
4
+ import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../_framework/reified";
5
+ import { FieldsWithTypes } from "../../_framework/util";
6
+ import { Vector } from "../../_framework/vector";
7
+ import { PKG_V1 } from "../index";
8
+ import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
9
+ export declare function isUserAccount(type: string): boolean;
10
+ export interface UserAccountFields {
11
+ id: ToField<UID>;
12
+ owner: ToField<"address">;
13
+ delegateUser: ToField<Vector<"address">>;
14
+ symbols: ToField<Vector<TypeName>>;
15
+ u64Padding: ToField<Vector<"u64">>;
16
+ }
17
+ export type UserAccountReified = Reified<UserAccount, UserAccountFields>;
18
+ export declare class UserAccount implements StructClass {
19
+ __StructClass: true;
20
+ static readonly $typeName: string;
21
+ static readonly $numTypeParams = 0;
22
+ static readonly $isPhantom: readonly [];
23
+ readonly $typeName: string;
24
+ readonly $fullTypeName: `${typeof PKG_V1}::user_account::UserAccount`;
25
+ readonly $typeArgs: [];
26
+ readonly $isPhantom: readonly [];
27
+ readonly id: ToField<UID>;
28
+ readonly owner: ToField<"address">;
29
+ readonly delegateUser: ToField<Vector<"address">>;
30
+ readonly symbols: ToField<Vector<TypeName>>;
31
+ readonly u64Padding: ToField<Vector<"u64">>;
32
+ private constructor();
33
+ static reified(): UserAccountReified;
34
+ static get r(): reified.StructClassReified<UserAccount, UserAccountFields>;
35
+ static phantom(): PhantomReified<ToTypeStr<UserAccount>>;
36
+ static get p(): reified.PhantomReified<"0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5::user_account::UserAccount" | "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9::user_account::UserAccount">;
37
+ static get bcs(): import("@mysten/sui/bcs").BcsType<{
38
+ id: {
39
+ id: {
40
+ bytes: string;
41
+ };
42
+ };
43
+ owner: string;
44
+ delegate_user: string[];
45
+ symbols: {
46
+ name: {
47
+ bytes: number[];
48
+ };
49
+ }[];
50
+ u64_padding: string[];
51
+ }, {
52
+ id: {
53
+ id: {
54
+ bytes: string;
55
+ };
56
+ };
57
+ owner: string;
58
+ delegate_user: Iterable<string> & {
59
+ length: number;
60
+ };
61
+ symbols: Iterable<{
62
+ name: {
63
+ bytes: Iterable<number> & {
64
+ length: number;
65
+ };
66
+ };
67
+ }> & {
68
+ length: number;
69
+ };
70
+ u64_padding: Iterable<string | number | bigint> & {
71
+ length: number;
72
+ };
73
+ }>;
74
+ static fromFields(fields: Record<string, any>): UserAccount;
75
+ static fromFieldsWithTypes(item: FieldsWithTypes): UserAccount;
76
+ static fromBcs(data: Uint8Array): UserAccount;
77
+ toJSONField(): {
78
+ id: string;
79
+ owner: string;
80
+ delegateUser: string[];
81
+ symbols: {
82
+ name: string;
83
+ }[];
84
+ u64Padding: string[];
85
+ };
86
+ toJSON(): {
87
+ id: string;
88
+ owner: string;
89
+ delegateUser: string[];
90
+ symbols: {
91
+ name: string;
92
+ }[];
93
+ u64Padding: string[];
94
+ $typeName: string;
95
+ $typeArgs: [];
96
+ };
97
+ static fromJSONField(field: any): UserAccount;
98
+ static fromJSON(json: Record<string, any>): UserAccount;
99
+ static fromSuiParsedData(content: SuiParsedData): UserAccount;
100
+ static fromSuiObjectData(data: SuiObjectData): UserAccount;
101
+ static fetch(client: SuiClient, id: string): Promise<UserAccount>;
102
+ }
103
+ export declare function isUserAccountCap(type: string): boolean;
104
+ export interface UserAccountCapFields {
105
+ id: ToField<UID>;
106
+ owner: ToField<"address">;
107
+ userAccountId: ToField<ID>;
108
+ }
109
+ export type UserAccountCapReified = Reified<UserAccountCap, UserAccountCapFields>;
110
+ export declare class UserAccountCap implements StructClass {
111
+ __StructClass: true;
112
+ static readonly $typeName: string;
113
+ static readonly $numTypeParams = 0;
114
+ static readonly $isPhantom: readonly [];
115
+ readonly $typeName: string;
116
+ readonly $fullTypeName: `${typeof PKG_V1}::user_account::UserAccountCap`;
117
+ readonly $typeArgs: [];
118
+ readonly $isPhantom: readonly [];
119
+ readonly id: ToField<UID>;
120
+ readonly owner: ToField<"address">;
121
+ readonly userAccountId: ToField<ID>;
122
+ private constructor();
123
+ static reified(): UserAccountCapReified;
124
+ static get r(): reified.StructClassReified<UserAccountCap, UserAccountCapFields>;
125
+ static phantom(): PhantomReified<ToTypeStr<UserAccountCap>>;
126
+ static get p(): reified.PhantomReified<"0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5::user_account::UserAccountCap" | "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9::user_account::UserAccountCap">;
127
+ static get bcs(): import("@mysten/sui/bcs").BcsType<{
128
+ id: {
129
+ id: {
130
+ bytes: string;
131
+ };
132
+ };
133
+ owner: string;
134
+ user_account_id: {
135
+ bytes: string;
136
+ };
137
+ }, {
138
+ id: {
139
+ id: {
140
+ bytes: string;
141
+ };
142
+ };
143
+ owner: string;
144
+ user_account_id: {
145
+ bytes: string;
146
+ };
147
+ }>;
148
+ static fromFields(fields: Record<string, any>): UserAccountCap;
149
+ static fromFieldsWithTypes(item: FieldsWithTypes): UserAccountCap;
150
+ static fromBcs(data: Uint8Array): UserAccountCap;
151
+ toJSONField(): {
152
+ id: string;
153
+ owner: string;
154
+ userAccountId: string;
155
+ };
156
+ toJSON(): {
157
+ id: string;
158
+ owner: string;
159
+ userAccountId: string;
160
+ $typeName: string;
161
+ $typeArgs: [];
162
+ };
163
+ static fromJSONField(field: any): UserAccountCap;
164
+ static fromJSON(json: Record<string, any>): UserAccountCap;
165
+ static fromSuiParsedData(content: SuiParsedData): UserAccountCap;
166
+ static fromSuiObjectData(data: SuiObjectData): UserAccountCap;
167
+ static fetch(client: SuiClient, id: string): Promise<UserAccountCap>;
168
+ }