@typus/typus-perp-sdk 1.1.32-codegen-exp7 → 1.1.32-codegen-exp8
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/dist/src/client.js +34 -3
- package/dist/src/fetch.d.ts +3 -91
- package/dist/src/fetch.js +43 -41
- package/dist/src/generated/typus_perp/admin.d.ts +158 -1
- package/dist/src/generated/typus_perp/admin.js +211 -0
- package/dist/src/generated/typus_perp/competition.d.ts +39 -1
- package/dist/src/generated/typus_perp/competition.js +46 -0
- package/dist/src/generated/typus_perp/deps/sui/table.d.ts +31 -0
- package/dist/src/generated/typus_perp/{tlp.js → deps/sui/table.js} +28 -13
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +0 -8
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +3 -11
- package/dist/src/generated/typus_perp/error.d.ts +443 -0
- package/dist/src/generated/typus_perp/error.js +788 -0
- package/dist/src/generated/typus_perp/escrow.d.ts +51 -1
- package/dist/src/generated/typus_perp/escrow.js +63 -0
- package/dist/src/generated/typus_perp/lp_pool.d.ts +2 -476
- package/dist/src/generated/typus_perp/lp_pool.js +19 -492
- package/dist/src/generated/typus_perp/position.d.ts +1016 -1
- package/dist/src/generated/typus_perp/position.js +1187 -0
- package/dist/src/generated/typus_perp/profit_vault.d.ts +272 -0
- package/dist/src/generated/typus_perp/profit_vault.js +321 -0
- package/dist/src/generated/typus_perp/symbol.d.ts +30 -1
- package/dist/src/generated/typus_perp/symbol.js +42 -0
- package/dist/src/generated/typus_perp/trading.d.ts +56 -418
- package/dist/src/generated/typus_perp/trading.js +124 -552
- package/dist/src/generated/typus_perp/treasury_caps.d.ts +32 -1
- package/dist/src/generated/typus_perp/treasury_caps.js +40 -0
- package/dist/src/generated/typus_perp/user_account.d.ts +107 -1
- package/dist/src/generated/typus_perp/user_account.js +149 -0
- package/dist/src/generated/typus_stake_pool/admin.d.ts +9 -25
- package/dist/src/generated/typus_stake_pool/admin.js +11 -36
- package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +56 -4
- package/dist/src/generated/typus_stake_pool/stake_pool.js +68 -4
- package/dist/src/generated/utils/index.js +3 -0
- package/dist/src/grpc/graphql.d.ts +6 -6
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +13 -19
- package/dist/src/user/order.js +1 -6
- package/dist/src/user/orderWithBidReceipt.js +3 -3
- package/package.json +2 -2
- package/dist/src/generated/typus_perp/lending.d.ts +0 -47
- package/dist/src/generated/typus_perp/lending.js +0 -50
- package/dist/src/generated/typus_perp/tlp.d.ts +0 -13
|
@@ -5,9 +5,40 @@
|
|
|
5
5
|
* The `treasury_caps` module defines the `TreasuryCaps` struct, which is a shared
|
|
6
6
|
* object that stores the treasury caps for the TLP tokens.
|
|
7
7
|
*/
|
|
8
|
-
import { MoveStruct } from "../utils/index";
|
|
8
|
+
import { MoveStruct, type RawTransactionArgument } from "../utils/index";
|
|
9
|
+
import { type Transaction } from "@mysten/sui/transactions";
|
|
9
10
|
export declare const TreasuryCaps: MoveStruct<{
|
|
10
11
|
id: MoveStruct<{
|
|
11
12
|
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
12
13
|
}, "0x2::object::UID">;
|
|
13
14
|
}, "@typus/perp::treasury_caps::TreasuryCaps">;
|
|
15
|
+
export interface InitOptions {
|
|
16
|
+
package?: string;
|
|
17
|
+
arguments?: [];
|
|
18
|
+
}
|
|
19
|
+
export declare function init(options?: InitOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
20
|
+
export interface GetMutTreasuryCapArguments {
|
|
21
|
+
treasuryCaps: RawTransactionArgument<string>;
|
|
22
|
+
}
|
|
23
|
+
export interface GetMutTreasuryCapOptions {
|
|
24
|
+
package?: string;
|
|
25
|
+
arguments: GetMutTreasuryCapArguments | [treasuryCaps: RawTransactionArgument<string>];
|
|
26
|
+
typeArguments: [string];
|
|
27
|
+
}
|
|
28
|
+
/** Gets a mutable reference to a treasury cap. WARNING: no authority check inside */
|
|
29
|
+
export declare function getMutTreasuryCap(options: GetMutTreasuryCapOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
30
|
+
export interface ManagerStoreTreasuryCapArguments {
|
|
31
|
+
version: RawTransactionArgument<string>;
|
|
32
|
+
treasuryCaps: RawTransactionArgument<string>;
|
|
33
|
+
treasuryCap: RawTransactionArgument<string>;
|
|
34
|
+
}
|
|
35
|
+
export interface ManagerStoreTreasuryCapOptions {
|
|
36
|
+
package?: string;
|
|
37
|
+
arguments: ManagerStoreTreasuryCapArguments | [
|
|
38
|
+
version: RawTransactionArgument<string>,
|
|
39
|
+
treasuryCaps: RawTransactionArgument<string>,
|
|
40
|
+
treasuryCap: RawTransactionArgument<string>
|
|
41
|
+
];
|
|
42
|
+
typeArguments: [string];
|
|
43
|
+
}
|
|
44
|
+
export declare function managerStoreTreasuryCap(options: ManagerStoreTreasuryCapOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -37,6 +37,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.TreasuryCaps = void 0;
|
|
40
|
+
exports.init = init;
|
|
41
|
+
exports.getMutTreasuryCap = getMutTreasuryCap;
|
|
42
|
+
exports.managerStoreTreasuryCap = managerStoreTreasuryCap;
|
|
40
43
|
/**
|
|
41
44
|
* The `treasury_caps` module defines the `TreasuryCaps` struct, which is a shared
|
|
42
45
|
* object that stores the treasury caps for the TLP tokens.
|
|
@@ -50,3 +53,40 @@ exports.TreasuryCaps = new index_1.MoveStruct({
|
|
|
50
53
|
id: object.UID,
|
|
51
54
|
},
|
|
52
55
|
});
|
|
56
|
+
function init(options = {}) {
|
|
57
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
58
|
+
return (tx) => tx.moveCall({
|
|
59
|
+
package: packageAddress,
|
|
60
|
+
module: "treasury_caps",
|
|
61
|
+
function: "init",
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Gets a mutable reference to a treasury cap. WARNING: no authority check inside */
|
|
65
|
+
function getMutTreasuryCap(options) {
|
|
66
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
67
|
+
const argumentsTypes = [`${packageAddress}::treasury_caps::TreasuryCaps`];
|
|
68
|
+
const parameterNames = ["treasuryCaps"];
|
|
69
|
+
return (tx) => tx.moveCall({
|
|
70
|
+
package: packageAddress,
|
|
71
|
+
module: "treasury_caps",
|
|
72
|
+
function: "get_mut_treasury_cap",
|
|
73
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
74
|
+
typeArguments: options.typeArguments,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function managerStoreTreasuryCap(options) {
|
|
78
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
79
|
+
const argumentsTypes = [
|
|
80
|
+
`${packageAddress}::admin::Version`,
|
|
81
|
+
`${packageAddress}::treasury_caps::TreasuryCaps`,
|
|
82
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::TreasuryCap<${options.typeArguments[0]}>`,
|
|
83
|
+
];
|
|
84
|
+
const parameterNames = ["version", "treasuryCaps", "treasuryCap"];
|
|
85
|
+
return (tx) => tx.moveCall({
|
|
86
|
+
package: packageAddress,
|
|
87
|
+
module: "treasury_caps",
|
|
88
|
+
function: "manager_store_treasury_cap",
|
|
89
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
90
|
+
typeArguments: options.typeArguments,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* The `user_account` module defines the `UserAccount` and `UserAccountCap`
|
|
6
6
|
* structs, and the logic for creating, updating, and using them.
|
|
7
7
|
*/
|
|
8
|
-
import { MoveStruct } from "../utils/index";
|
|
8
|
+
import { MoveStruct, type RawTransactionArgument } from "../utils/index";
|
|
9
|
+
import { type Transaction } from "@mysten/sui/transactions";
|
|
9
10
|
export declare const UserAccount: MoveStruct<{
|
|
10
11
|
id: MoveStruct<{
|
|
11
12
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
@@ -38,3 +39,108 @@ export declare const UserAccountCap: MoveStruct<{
|
|
|
38
39
|
/** The ID of the user account. */
|
|
39
40
|
user_account_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
40
41
|
}, "@typus/perp::user_account::UserAccountCap">;
|
|
42
|
+
export interface NewUserAccountOptions {
|
|
43
|
+
package?: string;
|
|
44
|
+
arguments?: [];
|
|
45
|
+
}
|
|
46
|
+
/** Creates a new user account and capability. */
|
|
47
|
+
export declare function newUserAccount(options?: NewUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
48
|
+
export interface RemoveUserAccountArguments {
|
|
49
|
+
marketId: RawTransactionArgument<string>;
|
|
50
|
+
user: RawTransactionArgument<string>;
|
|
51
|
+
userAccountCap: RawTransactionArgument<string>;
|
|
52
|
+
}
|
|
53
|
+
export interface RemoveUserAccountOptions {
|
|
54
|
+
package?: string;
|
|
55
|
+
arguments: RemoveUserAccountArguments | [marketId: RawTransactionArgument<string>, user: RawTransactionArgument<string>, userAccountCap: RawTransactionArgument<string>];
|
|
56
|
+
}
|
|
57
|
+
/** Removes a user account. WARNING: no authority check inside */
|
|
58
|
+
export declare function removeUserAccount(options: RemoveUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
59
|
+
export interface HasUserAccountArguments {
|
|
60
|
+
marketId: RawTransactionArgument<string>;
|
|
61
|
+
user: RawTransactionArgument<string>;
|
|
62
|
+
}
|
|
63
|
+
export interface HasUserAccountOptions {
|
|
64
|
+
package?: string;
|
|
65
|
+
arguments: HasUserAccountArguments | [marketId: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
66
|
+
}
|
|
67
|
+
/** Checks if a user has an account. */
|
|
68
|
+
export declare function hasUserAccount(options: HasUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
69
|
+
export interface GetMutUserAccountArguments {
|
|
70
|
+
marketId: RawTransactionArgument<string>;
|
|
71
|
+
user: RawTransactionArgument<string>;
|
|
72
|
+
}
|
|
73
|
+
export interface GetMutUserAccountOptions {
|
|
74
|
+
package?: string;
|
|
75
|
+
arguments: GetMutUserAccountArguments | [marketId: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets a mutable reference to a user account. WARNING: no security check, only
|
|
79
|
+
* delegate_user or cranker can access
|
|
80
|
+
*/
|
|
81
|
+
export declare function getMutUserAccount(options: GetMutUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
82
|
+
export interface CheckOwnerArguments {
|
|
83
|
+
userAccount: RawTransactionArgument<string>;
|
|
84
|
+
}
|
|
85
|
+
export interface CheckOwnerOptions {
|
|
86
|
+
package?: string;
|
|
87
|
+
arguments: CheckOwnerArguments | [userAccount: RawTransactionArgument<string>];
|
|
88
|
+
}
|
|
89
|
+
/** Checks if the sender is the owner of the user account. Abort if not owner */
|
|
90
|
+
export declare function checkOwner(options: CheckOwnerOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
91
|
+
export interface AddDelegateUserArguments {
|
|
92
|
+
userAccount: RawTransactionArgument<string>;
|
|
93
|
+
user: RawTransactionArgument<string>;
|
|
94
|
+
}
|
|
95
|
+
export interface AddDelegateUserOptions {
|
|
96
|
+
package?: string;
|
|
97
|
+
arguments: AddDelegateUserArguments | [userAccount: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
98
|
+
}
|
|
99
|
+
/** Adds a delegate user to a user account. WARNING: no authority check inside */
|
|
100
|
+
export declare function addDelegateUser(options: AddDelegateUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
101
|
+
export interface RemoveDelegateUserArguments {
|
|
102
|
+
userAccount: RawTransactionArgument<string>;
|
|
103
|
+
user: RawTransactionArgument<string>;
|
|
104
|
+
}
|
|
105
|
+
export interface RemoveDelegateUserOptions {
|
|
106
|
+
package?: string;
|
|
107
|
+
arguments: RemoveDelegateUserArguments | [userAccount: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
108
|
+
}
|
|
109
|
+
/** Remove a delegate user from a user account. WARNING: no authority check inside */
|
|
110
|
+
export declare function removeDelegateUser(options: RemoveDelegateUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
111
|
+
export interface DepositArguments {
|
|
112
|
+
userAccount: RawTransactionArgument<string>;
|
|
113
|
+
balance: RawTransactionArgument<string>;
|
|
114
|
+
}
|
|
115
|
+
export interface DepositOptions {
|
|
116
|
+
package?: string;
|
|
117
|
+
arguments: DepositArguments | [userAccount: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
|
|
118
|
+
typeArguments: [string];
|
|
119
|
+
}
|
|
120
|
+
/** Deposits collateral into a user account. WARNING: no authority check inside */
|
|
121
|
+
export declare function deposit(options: DepositOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
122
|
+
export interface WithdrawArguments {
|
|
123
|
+
userAccount: RawTransactionArgument<string>;
|
|
124
|
+
amount: RawTransactionArgument<number | bigint | null>;
|
|
125
|
+
userAccountCap: RawTransactionArgument<string>;
|
|
126
|
+
}
|
|
127
|
+
export interface WithdrawOptions {
|
|
128
|
+
package?: string;
|
|
129
|
+
arguments: WithdrawArguments | [
|
|
130
|
+
userAccount: RawTransactionArgument<string>,
|
|
131
|
+
amount: RawTransactionArgument<number | bigint | null>,
|
|
132
|
+
userAccountCap: RawTransactionArgument<string>
|
|
133
|
+
];
|
|
134
|
+
typeArguments: [string];
|
|
135
|
+
}
|
|
136
|
+
/** Withdraws collateral from a user account. WARNING: no authority check inside */
|
|
137
|
+
export declare function withdraw(options: WithdrawOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
138
|
+
export interface GetUserAccountOwnerArguments {
|
|
139
|
+
userAccountCap: RawTransactionArgument<string>;
|
|
140
|
+
}
|
|
141
|
+
export interface GetUserAccountOwnerOptions {
|
|
142
|
+
package?: string;
|
|
143
|
+
arguments: GetUserAccountOwnerArguments | [userAccountCap: RawTransactionArgument<string>];
|
|
144
|
+
}
|
|
145
|
+
/** Gets the owner of a user account from a capability. */
|
|
146
|
+
export declare function getUserAccountOwner(options: GetUserAccountOwnerOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -37,6 +37,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.UserAccountCap = exports.UserAccount = void 0;
|
|
40
|
+
exports.newUserAccount = newUserAccount;
|
|
41
|
+
exports.removeUserAccount = removeUserAccount;
|
|
42
|
+
exports.hasUserAccount = hasUserAccount;
|
|
43
|
+
exports.getMutUserAccount = getMutUserAccount;
|
|
44
|
+
exports.checkOwner = checkOwner;
|
|
45
|
+
exports.addDelegateUser = addDelegateUser;
|
|
46
|
+
exports.removeDelegateUser = removeDelegateUser;
|
|
47
|
+
exports.deposit = deposit;
|
|
48
|
+
exports.withdraw = withdraw;
|
|
49
|
+
exports.getUserAccountOwner = getUserAccountOwner;
|
|
40
50
|
/**
|
|
41
51
|
* The `user_account` module defines the `UserAccount` and `UserAccountCap`
|
|
42
52
|
* structs, and the logic for creating, updating, and using them.
|
|
@@ -70,3 +80,142 @@ exports.UserAccountCap = new index_1.MoveStruct({
|
|
|
70
80
|
user_account_id: bcs_1.bcs.Address,
|
|
71
81
|
},
|
|
72
82
|
});
|
|
83
|
+
/** Creates a new user account and capability. */
|
|
84
|
+
function newUserAccount(options = {}) {
|
|
85
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
86
|
+
return (tx) => tx.moveCall({
|
|
87
|
+
package: packageAddress,
|
|
88
|
+
module: "user_account",
|
|
89
|
+
function: "new_user_account",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Removes a user account. WARNING: no authority check inside */
|
|
93
|
+
function removeUserAccount(options) {
|
|
94
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
95
|
+
const argumentsTypes = [
|
|
96
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
97
|
+
"address",
|
|
98
|
+
`${packageAddress}::user_account::UserAccountCap`,
|
|
99
|
+
];
|
|
100
|
+
const parameterNames = ["marketId", "user", "userAccountCap"];
|
|
101
|
+
return (tx) => tx.moveCall({
|
|
102
|
+
package: packageAddress,
|
|
103
|
+
module: "user_account",
|
|
104
|
+
function: "remove_user_account",
|
|
105
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/** Checks if a user has an account. */
|
|
109
|
+
function hasUserAccount(options) {
|
|
110
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
111
|
+
const argumentsTypes = [
|
|
112
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
113
|
+
"address",
|
|
114
|
+
];
|
|
115
|
+
const parameterNames = ["marketId", "user"];
|
|
116
|
+
return (tx) => tx.moveCall({
|
|
117
|
+
package: packageAddress,
|
|
118
|
+
module: "user_account",
|
|
119
|
+
function: "has_user_account",
|
|
120
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Gets a mutable reference to a user account. WARNING: no security check, only
|
|
125
|
+
* delegate_user or cranker can access
|
|
126
|
+
*/
|
|
127
|
+
function getMutUserAccount(options) {
|
|
128
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
129
|
+
const argumentsTypes = [
|
|
130
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
131
|
+
"address",
|
|
132
|
+
];
|
|
133
|
+
const parameterNames = ["marketId", "user"];
|
|
134
|
+
return (tx) => tx.moveCall({
|
|
135
|
+
package: packageAddress,
|
|
136
|
+
module: "user_account",
|
|
137
|
+
function: "get_mut_user_account",
|
|
138
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** Checks if the sender is the owner of the user account. Abort if not owner */
|
|
142
|
+
function checkOwner(options) {
|
|
143
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
144
|
+
const argumentsTypes = [`${packageAddress}::user_account::UserAccount`];
|
|
145
|
+
const parameterNames = ["userAccount"];
|
|
146
|
+
return (tx) => tx.moveCall({
|
|
147
|
+
package: packageAddress,
|
|
148
|
+
module: "user_account",
|
|
149
|
+
function: "check_owner",
|
|
150
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** Adds a delegate user to a user account. WARNING: no authority check inside */
|
|
154
|
+
function addDelegateUser(options) {
|
|
155
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
156
|
+
const argumentsTypes = [`${packageAddress}::user_account::UserAccount`, "address"];
|
|
157
|
+
const parameterNames = ["userAccount", "user"];
|
|
158
|
+
return (tx) => tx.moveCall({
|
|
159
|
+
package: packageAddress,
|
|
160
|
+
module: "user_account",
|
|
161
|
+
function: "add_delegate_user",
|
|
162
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** Remove a delegate user from a user account. WARNING: no authority check inside */
|
|
166
|
+
function removeDelegateUser(options) {
|
|
167
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
168
|
+
const argumentsTypes = [`${packageAddress}::user_account::UserAccount`, "address"];
|
|
169
|
+
const parameterNames = ["userAccount", "user"];
|
|
170
|
+
return (tx) => tx.moveCall({
|
|
171
|
+
package: packageAddress,
|
|
172
|
+
module: "user_account",
|
|
173
|
+
function: "remove_delegate_user",
|
|
174
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/** Deposits collateral into a user account. WARNING: no authority check inside */
|
|
178
|
+
function deposit(options) {
|
|
179
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
180
|
+
const argumentsTypes = [
|
|
181
|
+
`${packageAddress}::user_account::UserAccount`,
|
|
182
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
183
|
+
];
|
|
184
|
+
const parameterNames = ["userAccount", "balance"];
|
|
185
|
+
return (tx) => tx.moveCall({
|
|
186
|
+
package: packageAddress,
|
|
187
|
+
module: "user_account",
|
|
188
|
+
function: "deposit",
|
|
189
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
190
|
+
typeArguments: options.typeArguments,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/** Withdraws collateral from a user account. WARNING: no authority check inside */
|
|
194
|
+
function withdraw(options) {
|
|
195
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
196
|
+
const argumentsTypes = [
|
|
197
|
+
`${packageAddress}::user_account::UserAccount`,
|
|
198
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
|
|
199
|
+
`${packageAddress}::user_account::UserAccountCap`,
|
|
200
|
+
];
|
|
201
|
+
const parameterNames = ["userAccount", "amount", "userAccountCap"];
|
|
202
|
+
return (tx) => tx.moveCall({
|
|
203
|
+
package: packageAddress,
|
|
204
|
+
module: "user_account",
|
|
205
|
+
function: "withdraw",
|
|
206
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
207
|
+
typeArguments: options.typeArguments,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/** Gets the owner of a user account from a capability. */
|
|
211
|
+
function getUserAccountOwner(options) {
|
|
212
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
213
|
+
const argumentsTypes = [`${packageAddress}::user_account::UserAccountCap`];
|
|
214
|
+
const parameterNames = ["userAccountCap"];
|
|
215
|
+
return (tx) => tx.moveCall({
|
|
216
|
+
package: packageAddress,
|
|
217
|
+
module: "user_account",
|
|
218
|
+
function: "get_user_account_owner",
|
|
219
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
@@ -99,6 +99,14 @@ export declare const SendFeeEvent: MoveStruct<{
|
|
|
99
99
|
/** The amount of fees sent. */
|
|
100
100
|
amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
101
101
|
}, "@typus/stake-pool::admin::SendFeeEvent">;
|
|
102
|
+
export declare const ProtocolFeeEvent: MoveStruct<{
|
|
103
|
+
/** The type name of the token. */
|
|
104
|
+
token: MoveStruct<{
|
|
105
|
+
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
106
|
+
}, "std::type_name::TypeName">;
|
|
107
|
+
/** The amount of fees charged. */
|
|
108
|
+
amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
109
|
+
}, "@typus/stake-pool::admin::ProtocolFeeEvent">;
|
|
102
110
|
export interface VersionCheckArguments {
|
|
103
111
|
version: RawTransactionArgument<string>;
|
|
104
112
|
}
|
|
@@ -206,29 +214,5 @@ export interface ChargeFeeOptions {
|
|
|
206
214
|
arguments: ChargeFeeArguments | [version: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
|
|
207
215
|
typeArguments: [string];
|
|
208
216
|
}
|
|
209
|
-
/** Charges a protocol fee.
|
|
217
|
+
/** Charges a protocol fee. */
|
|
210
218
|
export declare function chargeFee(options: ChargeFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
211
|
-
export interface SendLiquidatorFeeArguments {
|
|
212
|
-
version: RawTransactionArgument<string>;
|
|
213
|
-
}
|
|
214
|
-
export interface SendLiquidatorFeeOptions {
|
|
215
|
-
package?: string;
|
|
216
|
-
arguments: SendLiquidatorFeeArguments | [version: RawTransactionArgument<string>];
|
|
217
|
-
typeArguments: [string];
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Sends the liquidator fees to the fee address. Safe with constant address as
|
|
221
|
-
* receiver
|
|
222
|
-
*/
|
|
223
|
-
export declare function sendLiquidatorFee(options: SendLiquidatorFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
224
|
-
export interface ChargeLiquidatorFeeArguments {
|
|
225
|
-
version: RawTransactionArgument<string>;
|
|
226
|
-
balance: RawTransactionArgument<string>;
|
|
227
|
-
}
|
|
228
|
-
export interface ChargeLiquidatorFeeOptions {
|
|
229
|
-
package?: string;
|
|
230
|
-
arguments: ChargeLiquidatorFeeArguments | [version: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
|
|
231
|
-
typeArguments: [string];
|
|
232
|
-
}
|
|
233
|
-
/** Charges a liquidator fee. WARNING: no authority check inside */
|
|
234
|
-
export declare function chargeLiquidatorFee(options: ChargeLiquidatorFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.SendFeeEvent = exports.Version = exports.FeePool = exports.FeeInfo = void 0;
|
|
39
|
+
exports.ProtocolFeeEvent = exports.SendFeeEvent = exports.Version = exports.FeePool = exports.FeeInfo = void 0;
|
|
40
40
|
exports.versionCheck = versionCheck;
|
|
41
41
|
exports.upgrade = upgrade;
|
|
42
42
|
exports.init = init;
|
|
@@ -47,8 +47,6 @@ exports.installEcosystemManagerCapEntry = installEcosystemManagerCapEntry;
|
|
|
47
47
|
exports.addTailsExpAmount = addTailsExpAmount;
|
|
48
48
|
exports.sendFee = sendFee;
|
|
49
49
|
exports.chargeFee = chargeFee;
|
|
50
|
-
exports.sendLiquidatorFee = sendLiquidatorFee;
|
|
51
|
-
exports.chargeLiquidatorFee = chargeLiquidatorFee;
|
|
52
50
|
/**
|
|
53
51
|
* The `admin` module provides administrative functionalities for the Typus Stake
|
|
54
52
|
* Pool. It includes version management, authority control, and fee handling.
|
|
@@ -101,6 +99,15 @@ exports.SendFeeEvent = new index_1.MoveStruct({
|
|
|
101
99
|
amount: bcs_1.bcs.u64(),
|
|
102
100
|
},
|
|
103
101
|
});
|
|
102
|
+
exports.ProtocolFeeEvent = new index_1.MoveStruct({
|
|
103
|
+
name: `${$moduleName}::ProtocolFeeEvent`,
|
|
104
|
+
fields: {
|
|
105
|
+
/** The type name of the token. */
|
|
106
|
+
token: type_name.TypeName,
|
|
107
|
+
/** The amount of fees charged. */
|
|
108
|
+
amount: bcs_1.bcs.u64(),
|
|
109
|
+
},
|
|
110
|
+
});
|
|
104
111
|
/** Checks if the contract version is valid. */
|
|
105
112
|
function versionCheck(options) {
|
|
106
113
|
const packageAddress = options.package ?? "@typus/stake-pool";
|
|
@@ -222,7 +229,7 @@ function sendFee(options) {
|
|
|
222
229
|
typeArguments: options.typeArguments,
|
|
223
230
|
});
|
|
224
231
|
}
|
|
225
|
-
/** Charges a protocol fee.
|
|
232
|
+
/** Charges a protocol fee. */
|
|
226
233
|
function chargeFee(options) {
|
|
227
234
|
const packageAddress = options.package ?? "@typus/stake-pool";
|
|
228
235
|
const argumentsTypes = [
|
|
@@ -238,35 +245,3 @@ function chargeFee(options) {
|
|
|
238
245
|
typeArguments: options.typeArguments,
|
|
239
246
|
});
|
|
240
247
|
}
|
|
241
|
-
/**
|
|
242
|
-
* Sends the liquidator fees to the fee address. Safe with constant address as
|
|
243
|
-
* receiver
|
|
244
|
-
*/
|
|
245
|
-
function sendLiquidatorFee(options) {
|
|
246
|
-
const packageAddress = options.package ?? "@typus/stake-pool";
|
|
247
|
-
const argumentsTypes = [`${packageAddress}::admin::Version`];
|
|
248
|
-
const parameterNames = ["version"];
|
|
249
|
-
return (tx) => tx.moveCall({
|
|
250
|
-
package: packageAddress,
|
|
251
|
-
module: "admin",
|
|
252
|
-
function: "send_liquidator_fee",
|
|
253
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
254
|
-
typeArguments: options.typeArguments,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
/** Charges a liquidator fee. WARNING: no authority check inside */
|
|
258
|
-
function chargeLiquidatorFee(options) {
|
|
259
|
-
const packageAddress = options.package ?? "@typus/stake-pool";
|
|
260
|
-
const argumentsTypes = [
|
|
261
|
-
`${packageAddress}::admin::Version`,
|
|
262
|
-
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
263
|
-
];
|
|
264
|
-
const parameterNames = ["version", "balance"];
|
|
265
|
-
return (tx) => tx.moveCall({
|
|
266
|
-
package: packageAddress,
|
|
267
|
-
module: "admin",
|
|
268
|
-
function: "charge_liquidator_fee",
|
|
269
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
270
|
-
typeArguments: options.typeArguments,
|
|
271
|
-
});
|
|
272
|
-
}
|
|
@@ -367,6 +367,20 @@ export declare const AddIncentiveTokenEvent: MoveStruct<{
|
|
|
367
367
|
length: number;
|
|
368
368
|
}, string>;
|
|
369
369
|
}, "@typus/stake-pool::stake_pool::AddIncentiveTokenEvent">;
|
|
370
|
+
export declare const DeactivateStakePoolEvent: MoveStruct<{
|
|
371
|
+
sender: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
372
|
+
index: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
373
|
+
u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
|
|
374
|
+
length: number;
|
|
375
|
+
}, string>;
|
|
376
|
+
}, "@typus/stake-pool::stake_pool::DeactivateStakePoolEvent">;
|
|
377
|
+
export declare const ActivateStakePoolEvent: MoveStruct<{
|
|
378
|
+
sender: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
379
|
+
index: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
380
|
+
u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
|
|
381
|
+
length: number;
|
|
382
|
+
}, string>;
|
|
383
|
+
}, "@typus/stake-pool::stake_pool::ActivateStakePoolEvent">;
|
|
370
384
|
export declare const DeactivateIncentiveTokenEvent: MoveStruct<{
|
|
371
385
|
sender: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
372
386
|
index: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
@@ -601,6 +615,36 @@ export interface AddIncentiveTokenOptions {
|
|
|
601
615
|
}
|
|
602
616
|
/** [Authorized Function] Adds a new incentive token to a pool. */
|
|
603
617
|
export declare function addIncentiveToken(options: AddIncentiveTokenOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
618
|
+
export interface DeactivateStakePoolArguments {
|
|
619
|
+
version: RawTransactionArgument<string>;
|
|
620
|
+
registry: RawTransactionArgument<string>;
|
|
621
|
+
index: RawTransactionArgument<number | bigint>;
|
|
622
|
+
}
|
|
623
|
+
export interface DeactivateStakePoolOptions {
|
|
624
|
+
package?: string;
|
|
625
|
+
arguments: DeactivateStakePoolArguments | [
|
|
626
|
+
version: RawTransactionArgument<string>,
|
|
627
|
+
registry: RawTransactionArgument<string>,
|
|
628
|
+
index: RawTransactionArgument<number | bigint>
|
|
629
|
+
];
|
|
630
|
+
}
|
|
631
|
+
/** [Authorized Function] Activates a stake pool. */
|
|
632
|
+
export declare function deactivateStakePool(options: DeactivateStakePoolOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
633
|
+
export interface ActivateStakePoolArguments {
|
|
634
|
+
version: RawTransactionArgument<string>;
|
|
635
|
+
registry: RawTransactionArgument<string>;
|
|
636
|
+
index: RawTransactionArgument<number | bigint>;
|
|
637
|
+
}
|
|
638
|
+
export interface ActivateStakePoolOptions {
|
|
639
|
+
package?: string;
|
|
640
|
+
arguments: ActivateStakePoolArguments | [
|
|
641
|
+
version: RawTransactionArgument<string>,
|
|
642
|
+
registry: RawTransactionArgument<string>,
|
|
643
|
+
index: RawTransactionArgument<number | bigint>
|
|
644
|
+
];
|
|
645
|
+
}
|
|
646
|
+
/** [Authorized Function] Activates a stake pool. */
|
|
647
|
+
export declare function activateStakePool(options: ActivateStakePoolOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
604
648
|
export interface DeactivateIncentiveTokenArguments {
|
|
605
649
|
version: RawTransactionArgument<string>;
|
|
606
650
|
registry: RawTransactionArgument<string>;
|
|
@@ -721,15 +765,15 @@ export interface DepositIncentiveOptions {
|
|
|
721
765
|
}
|
|
722
766
|
/** [Authorized Function] Deposits incentive tokens. */
|
|
723
767
|
export declare function depositIncentive(options: DepositIncentiveOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
724
|
-
export interface
|
|
768
|
+
export interface WithdrawIncentiveArguments {
|
|
725
769
|
version: RawTransactionArgument<string>;
|
|
726
770
|
registry: RawTransactionArgument<string>;
|
|
727
771
|
index: RawTransactionArgument<number | bigint>;
|
|
728
772
|
amount: RawTransactionArgument<number | bigint | null>;
|
|
729
773
|
}
|
|
730
|
-
export interface
|
|
774
|
+
export interface WithdrawIncentiveOptions {
|
|
731
775
|
package?: string;
|
|
732
|
-
arguments:
|
|
776
|
+
arguments: WithdrawIncentiveArguments | [
|
|
733
777
|
version: RawTransactionArgument<string>,
|
|
734
778
|
registry: RawTransactionArgument<string>,
|
|
735
779
|
index: RawTransactionArgument<number | bigint>,
|
|
@@ -738,7 +782,7 @@ export interface WithdrawIncentiveV2Options {
|
|
|
738
782
|
typeArguments: [string];
|
|
739
783
|
}
|
|
740
784
|
/** [Authorized Function] Withdraws incentive tokens. */
|
|
741
|
-
export declare function
|
|
785
|
+
export declare function withdrawIncentive(options: WithdrawIncentiveOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
742
786
|
export interface StakeArguments {
|
|
743
787
|
version: RawTransactionArgument<string>;
|
|
744
788
|
registry: RawTransactionArgument<string>;
|
|
@@ -984,3 +1028,11 @@ export interface GetLastIncentivePriceIndexOptions {
|
|
|
984
1028
|
arguments: GetLastIncentivePriceIndexArguments | [stakePool: RawTransactionArgument<string>];
|
|
985
1029
|
}
|
|
986
1030
|
export declare function getLastIncentivePriceIndex(options: GetLastIncentivePriceIndexOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
1031
|
+
export interface CheckStakePoolActiveArguments {
|
|
1032
|
+
stakePool: RawTransactionArgument<string>;
|
|
1033
|
+
}
|
|
1034
|
+
export interface CheckStakePoolActiveOptions {
|
|
1035
|
+
package?: string;
|
|
1036
|
+
arguments: CheckStakePoolActiveArguments | [stakePool: RawTransactionArgument<string>];
|
|
1037
|
+
}
|
|
1038
|
+
export declare function checkStakePoolActive(options: CheckStakePoolActiveOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|