@waterx/predict-sdk 0.1.0
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/LICENSE +22 -0
- package/README.md +67 -0
- package/dist/src/account.d.ts +64 -0
- package/dist/src/account.js +134 -0
- package/dist/src/admin.d.ts +47 -0
- package/dist/src/admin.js +104 -0
- package/dist/src/bcs.d.ts +20 -0
- package/dist/src/bcs.js +209 -0
- package/dist/src/client.d.ts +60 -0
- package/dist/src/client.js +59 -0
- package/dist/src/constants.d.ts +61 -0
- package/dist/src/constants.js +62 -0
- package/dist/src/fetch.d.ts +53 -0
- package/dist/src/fetch.js +187 -0
- package/dist/src/generated/bucket_v2_framework/account.d.ts +100 -0
- package/dist/src/generated/bucket_v2_framework/account.js +129 -0
- package/dist/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +6 -0
- package/dist/src/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +10 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/bucket_v2_framework/double.d.ts +382 -0
- package/dist/src/generated/bucket_v2_framework/double.js +466 -0
- package/dist/src/generated/bucket_v2_framework/float.d.ts +362 -0
- package/dist/src/generated/bucket_v2_framework/float.js +440 -0
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +193 -0
- package/dist/src/generated/bucket_v2_framework/liability.js +205 -0
- package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
- package/dist/src/generated/bucket_v2_framework/linked_table.js +382 -0
- package/dist/src/generated/bucket_v2_framework/sheet.d.ts +344 -0
- package/dist/src/generated/bucket_v2_framework/sheet.js +344 -0
- package/dist/src/generated/utils/index.d.ts +30 -0
- package/dist/src/generated/utils/index.js +157 -0
- package/dist/src/generated/waterx_account/account.d.ts +1326 -0
- package/dist/src/generated/waterx_account/account.js +1487 -0
- package/dist/src/generated/waterx_account/deps/std/type_name.d.ts +6 -0
- package/dist/src/generated/waterx_account/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_account/deps/sui/balance.d.ts +10 -0
- package/dist/src/generated/waterx_account/deps/sui/balance.js +14 -0
- package/dist/src/generated/waterx_account/deps/sui/table.d.ts +24 -0
- package/dist/src/generated/waterx_account/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_account/direct_rule.d.ts +72 -0
- package/dist/src/generated/waterx_account/direct_rule.js +75 -0
- package/dist/src/generated/waterx_account/events.d.ts +30 -0
- package/dist/src/generated/waterx_account/events.js +145 -0
- package/dist/src/generated/waterx_account/version.d.ts +10 -0
- package/dist/src/generated/waterx_account/version.js +8 -0
- package/dist/src/generated/waterx_prediction/account_data.d.ts +321 -0
- package/dist/src/generated/waterx_prediction/account_data.js +399 -0
- package/dist/src/generated/waterx_prediction/admin.d.ts +5 -0
- package/dist/src/generated/waterx_prediction/admin.js +9 -0
- package/dist/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +18 -0
- package/dist/src/generated/waterx_prediction/deps/sui/balance.d.ts +10 -0
- package/dist/src/generated/waterx_prediction/deps/sui/balance.js +14 -0
- package/dist/src/generated/waterx_prediction/deps/sui/table.d.ts +24 -0
- package/dist/src/generated/waterx_prediction/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_prediction/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_prediction/events.d.ts +19 -0
- package/dist/src/generated/waterx_prediction/events.js +99 -0
- package/dist/src/generated/waterx_prediction/global_config.d.ts +68 -0
- package/dist/src/generated/waterx_prediction/global_config.js +83 -0
- package/dist/src/generated/waterx_prediction/order.d.ts +170 -0
- package/dist/src/generated/waterx_prediction/order.js +237 -0
- package/dist/src/generated/waterx_prediction/outcome.d.ts +58 -0
- package/dist/src/generated/waterx_prediction/outcome.js +73 -0
- package/dist/src/generated/waterx_prediction/position.d.ts +150 -0
- package/dist/src/generated/waterx_prediction/position.js +200 -0
- package/dist/src/generated/waterx_prediction/view.d.ts +353 -0
- package/dist/src/generated/waterx_prediction/view.js +426 -0
- package/dist/src/generated/waterx_prediction/waterx_prediction.d.ts +1520 -0
- package/dist/src/generated/waterx_prediction/waterx_prediction.js +1550 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.js +17 -0
- package/dist/src/prediction.d.ts +81 -0
- package/dist/src/prediction.js +220 -0
- package/dist/src/types.d.ts +81 -0
- package/dist/src/types.js +1 -0
- package/dist/src/user/account.d.ts +2 -0
- package/dist/src/user/account.js +1 -0
- package/dist/src/user/admin.d.ts +4 -0
- package/dist/src/user/admin.js +2 -0
- package/dist/src/user/index.d.ts +4 -0
- package/dist/src/user/index.js +2 -0
- package/dist/src/user/keeper.d.ts +2 -0
- package/dist/src/user/keeper.js +1 -0
- package/dist/src/user/order.d.ts +2 -0
- package/dist/src/user/order.js +1 -0
- package/dist/src/user/position.d.ts +2 -0
- package/dist/src/user/position.js +1 -0
- package/dist/src/utils/bcs.d.ts +1 -0
- package/dist/src/utils/bcs.js +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils.d.ts +29 -0
- package/dist/src/utils.js +170 -0
- package/package.json +62 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Functionality for converting Move types into values. Use with care! */
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
export declare const TypeName: MoveStruct<any, any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/** Functionality for converting Move types into values. Use with care! */
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
7
|
+
const $moduleName = 'std::type_name';
|
|
8
|
+
export const TypeName = new MoveStruct({ name: `${$moduleName}::TypeName`, fields: {
|
|
9
|
+
/**
|
|
10
|
+
* String representation of the type. All types are represented using their source
|
|
11
|
+
* syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
|
|
12
|
+
* Struct types are represented as fully qualified type names; e.g.
|
|
13
|
+
* `00000000000000000000000000000001::string::String` or
|
|
14
|
+
* `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
|
|
15
|
+
* Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
|
|
16
|
+
* 32 depending on the Move platform)
|
|
17
|
+
*/
|
|
18
|
+
name: bcs.string()
|
|
19
|
+
} });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* A storable handler for Balances in general. Is used in the `Coin` module to
|
|
6
|
+
* allow balance operations and can be used to implement custom coins with `Supply`
|
|
7
|
+
* and `Balance`s.
|
|
8
|
+
*/
|
|
9
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
10
|
+
export declare const Balance: MoveStruct<any, any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* A storable handler for Balances in general. Is used in the `Coin` module to
|
|
6
|
+
* allow balance operations and can be used to implement custom coins with `Supply`
|
|
7
|
+
* and `Balance`s.
|
|
8
|
+
*/
|
|
9
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
10
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
11
|
+
const $moduleName = '0x2::balance';
|
|
12
|
+
export const Balance = new MoveStruct({ name: `${$moduleName}::Balance<phantom T>`, fields: {
|
|
13
|
+
value: bcs.u64()
|
|
14
|
+
} });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* A table is a map-like collection. But unlike a traditional collection, it's keys
|
|
6
|
+
* and values are not stored within the `Table` value, but instead are stored using
|
|
7
|
+
* Sui's object system. The `Table` struct acts only as a handle into the object
|
|
8
|
+
* system to retrieve those keys and values. Note that this means that `Table`
|
|
9
|
+
* values with exactly the same key-value mapping will not be equal, with `==`, at
|
|
10
|
+
* runtime. For example
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* let table1 = table::new<u64, bool>();
|
|
14
|
+
* let table2 = table::new<u64, bool>();
|
|
15
|
+
* table::add(&mut table1, 0, false);
|
|
16
|
+
* table::add(&mut table1, 1, true);
|
|
17
|
+
* table::add(&mut table2, 0, false);
|
|
18
|
+
* table::add(&mut table2, 1, true);
|
|
19
|
+
* // table1 does not equal table2, despite having the same entries
|
|
20
|
+
* assert!(&table1 != &table2);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
24
|
+
export declare const Table: MoveStruct<any, any>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* A table is a map-like collection. But unlike a traditional collection, it's keys
|
|
6
|
+
* and values are not stored within the `Table` value, but instead are stored using
|
|
7
|
+
* Sui's object system. The `Table` struct acts only as a handle into the object
|
|
8
|
+
* system to retrieve those keys and values. Note that this means that `Table`
|
|
9
|
+
* values with exactly the same key-value mapping will not be equal, with `==`, at
|
|
10
|
+
* runtime. For example
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* let table1 = table::new<u64, bool>();
|
|
14
|
+
* let table2 = table::new<u64, bool>();
|
|
15
|
+
* table::add(&mut table1, 0, false);
|
|
16
|
+
* table::add(&mut table1, 1, true);
|
|
17
|
+
* table::add(&mut table2, 0, false);
|
|
18
|
+
* table::add(&mut table2, 1, true);
|
|
19
|
+
* // table1 does not equal table2, despite having the same entries
|
|
20
|
+
* assert!(&table1 != &table2);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
24
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
25
|
+
const $moduleName = '0x2::table';
|
|
26
|
+
export const Table = new MoveStruct({ name: `${$moduleName}::Table<phantom K, phantom V>`, fields: {
|
|
27
|
+
/** the ID of this table */
|
|
28
|
+
id: bcs.Address,
|
|
29
|
+
/** the number of key-value pairs in the table */
|
|
30
|
+
size: bcs.u64()
|
|
31
|
+
} });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
/** An entry in the map */
|
|
7
|
+
export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
8
|
+
K,
|
|
9
|
+
V
|
|
10
|
+
]): MoveStruct<{
|
|
11
|
+
key: K;
|
|
12
|
+
value: V;
|
|
13
|
+
}, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
|
|
14
|
+
/**
|
|
15
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
16
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
17
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
18
|
+
* of this data structure is only to provide the convenience of programming against
|
|
19
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
20
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
21
|
+
* also be handwritten.
|
|
22
|
+
*/
|
|
23
|
+
export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
24
|
+
K,
|
|
25
|
+
V
|
|
26
|
+
]): MoveStruct<{
|
|
27
|
+
contents: BcsType<{
|
|
28
|
+
key: K extends BcsType<infer U, any, string> ? U : never;
|
|
29
|
+
value: V extends BcsType<infer U, any, string> ? U : never;
|
|
30
|
+
}[], Iterable<{
|
|
31
|
+
key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
|
|
32
|
+
value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
|
|
33
|
+
}> & {
|
|
34
|
+
length: number;
|
|
35
|
+
}, string>;
|
|
36
|
+
}, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry(...typeParameters) {
|
|
9
|
+
return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
|
|
10
|
+
key: typeParameters[0],
|
|
11
|
+
value: typeParameters[1]
|
|
12
|
+
} });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
16
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
17
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
18
|
+
* of this data structure is only to provide the convenience of programming against
|
|
19
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
20
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
21
|
+
* also be handwritten.
|
|
22
|
+
*/
|
|
23
|
+
export function VecMap(...typeParameters) {
|
|
24
|
+
return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
|
|
25
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
|
|
26
|
+
} });
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
/**
|
|
7
|
+
* A set data structure backed by a vector. The set is guaranteed not to contain
|
|
8
|
+
* duplicate keys. All operations are O(N) in the size of the set
|
|
9
|
+
*
|
|
10
|
+
* - the intention of this data structure is only to provide the convenience of
|
|
11
|
+
* programming against a set API. Sets that need sorted iteration rather than
|
|
12
|
+
* insertion order iteration should be handwritten.
|
|
13
|
+
*/
|
|
14
|
+
export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
|
|
15
|
+
K
|
|
16
|
+
]): MoveStruct<any, any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
const $moduleName = '0x2::vec_set';
|
|
7
|
+
/**
|
|
8
|
+
* A set data structure backed by a vector. The set is guaranteed not to contain
|
|
9
|
+
* duplicate keys. All operations are O(N) in the size of the set
|
|
10
|
+
*
|
|
11
|
+
* - the intention of this data structure is only to provide the convenience of
|
|
12
|
+
* programming against a set API. Sets that need sorted iteration rather than
|
|
13
|
+
* insertion order iteration should be handwritten.
|
|
14
|
+
*/
|
|
15
|
+
export function VecSet(...typeParameters) {
|
|
16
|
+
return new MoveStruct({ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`, fields: {
|
|
17
|
+
contents: bcs.vector(typeParameters[0])
|
|
18
|
+
} });
|
|
19
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Default identity (passthrough) deposit / withdraw policy.
|
|
6
|
+
*
|
|
7
|
+
* Folds `Coin<T>` directly into the account's stored `Balance<T>` on deposit, and
|
|
8
|
+
* pays `Coin<T>` straight to the request's recipient on withdraw — no swap, no
|
|
9
|
+
* conversion. This is the "no-op" policy that most CoinTypes will use; PSM-style
|
|
10
|
+
* policies (T_IN → T_OUT) are still authored per-protocol.
|
|
11
|
+
*
|
|
12
|
+
* Deploy setup (one-time):
|
|
13
|
+
*
|
|
14
|
+
* ```move
|
|
15
|
+
* // Once at deploy:
|
|
16
|
+
* registry.whitelist_protocol<DirectRule>(&admin_cap);
|
|
17
|
+
* // Per CoinType T that should flow direct:
|
|
18
|
+
* registry.register_deposit_policy<T, DirectRule>(&admin_cap);
|
|
19
|
+
* registry.register_withdraw_policy<T, DirectRule>(&admin_cap);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* User flow inside a single PTB:
|
|
23
|
+
*
|
|
24
|
+
* ```move
|
|
25
|
+
* let req = registry.request_deposit<T>(account_id, coin, extra_data);
|
|
26
|
+
* direct_rule::consume_deposit_direct<T>(&mut registry, req);
|
|
27
|
+
* // ...later:
|
|
28
|
+
* let wreq = registry.request_withdraw<T>(&sender_req, account_id, amount, recipient, extra_data, &clock);
|
|
29
|
+
* direct_rule::consume_withdraw_direct<T>(&mut registry, wreq, ctx);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
|
|
33
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
34
|
+
export declare const DirectRule: MoveStruct<any, any>;
|
|
35
|
+
export interface ConsumeDepositDirectArguments {
|
|
36
|
+
registry: RawTransactionArgument<string>;
|
|
37
|
+
req: RawTransactionArgument<string>;
|
|
38
|
+
}
|
|
39
|
+
export interface ConsumeDepositDirectOptions {
|
|
40
|
+
package?: string;
|
|
41
|
+
arguments: ConsumeDepositDirectArguments | [
|
|
42
|
+
registry: RawTransactionArgument<string>,
|
|
43
|
+
req: RawTransactionArgument<string>
|
|
44
|
+
];
|
|
45
|
+
typeArguments: [
|
|
46
|
+
string
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Consume a `DepositRequest<T>` that was registered against `DirectRule` and
|
|
51
|
+
* credit the entire `Balance<T>` to the account's stored balance.
|
|
52
|
+
*/
|
|
53
|
+
export declare function consumeDepositDirect(options: ConsumeDepositDirectOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
54
|
+
export interface ConsumeWithdrawDirectArguments {
|
|
55
|
+
registry: RawTransactionArgument<string>;
|
|
56
|
+
req: RawTransactionArgument<string>;
|
|
57
|
+
}
|
|
58
|
+
export interface ConsumeWithdrawDirectOptions {
|
|
59
|
+
package?: string;
|
|
60
|
+
arguments: ConsumeWithdrawDirectArguments | [
|
|
61
|
+
registry: RawTransactionArgument<string>,
|
|
62
|
+
req: RawTransactionArgument<string>
|
|
63
|
+
];
|
|
64
|
+
typeArguments: [
|
|
65
|
+
string
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Consume a `WithdrawRequest<T>` that was registered against `DirectRule` and pay
|
|
70
|
+
* out `Coin<T>` to the request's recipient.
|
|
71
|
+
*/
|
|
72
|
+
export declare function consumeWithdrawDirect(options: ConsumeWithdrawDirectOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
/**
|
|
5
|
+
* Default identity (passthrough) deposit / withdraw policy.
|
|
6
|
+
*
|
|
7
|
+
* Folds `Coin<T>` directly into the account's stored `Balance<T>` on deposit, and
|
|
8
|
+
* pays `Coin<T>` straight to the request's recipient on withdraw — no swap, no
|
|
9
|
+
* conversion. This is the "no-op" policy that most CoinTypes will use; PSM-style
|
|
10
|
+
* policies (T_IN → T_OUT) are still authored per-protocol.
|
|
11
|
+
*
|
|
12
|
+
* Deploy setup (one-time):
|
|
13
|
+
*
|
|
14
|
+
* ```move
|
|
15
|
+
* // Once at deploy:
|
|
16
|
+
* registry.whitelist_protocol<DirectRule>(&admin_cap);
|
|
17
|
+
* // Per CoinType T that should flow direct:
|
|
18
|
+
* registry.register_deposit_policy<T, DirectRule>(&admin_cap);
|
|
19
|
+
* registry.register_withdraw_policy<T, DirectRule>(&admin_cap);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* User flow inside a single PTB:
|
|
23
|
+
*
|
|
24
|
+
* ```move
|
|
25
|
+
* let req = registry.request_deposit<T>(account_id, coin, extra_data);
|
|
26
|
+
* direct_rule::consume_deposit_direct<T>(&mut registry, req);
|
|
27
|
+
* // ...later:
|
|
28
|
+
* let wreq = registry.request_withdraw<T>(&sender_req, account_id, amount, recipient, extra_data, &clock);
|
|
29
|
+
* direct_rule::consume_withdraw_direct<T>(&mut registry, wreq, ctx);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
33
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
34
|
+
const $moduleName = '@waterx/account::direct_rule';
|
|
35
|
+
export const DirectRule = new MoveStruct({ name: `${$moduleName}::DirectRule`, fields: {
|
|
36
|
+
dummy_field: bcs.bool()
|
|
37
|
+
} });
|
|
38
|
+
/**
|
|
39
|
+
* Consume a `DepositRequest<T>` that was registered against `DirectRule` and
|
|
40
|
+
* credit the entire `Balance<T>` to the account's stored balance.
|
|
41
|
+
*/
|
|
42
|
+
export function consumeDepositDirect(options) {
|
|
43
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
44
|
+
const argumentsTypes = [
|
|
45
|
+
null,
|
|
46
|
+
null
|
|
47
|
+
];
|
|
48
|
+
const parameterNames = ["registry", "req"];
|
|
49
|
+
return (tx) => tx.moveCall({
|
|
50
|
+
package: packageAddress,
|
|
51
|
+
module: 'direct_rule',
|
|
52
|
+
function: 'consume_deposit_direct',
|
|
53
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
54
|
+
typeArguments: options.typeArguments
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Consume a `WithdrawRequest<T>` that was registered against `DirectRule` and pay
|
|
59
|
+
* out `Coin<T>` to the request's recipient.
|
|
60
|
+
*/
|
|
61
|
+
export function consumeWithdrawDirect(options) {
|
|
62
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
63
|
+
const argumentsTypes = [
|
|
64
|
+
null,
|
|
65
|
+
null
|
|
66
|
+
];
|
|
67
|
+
const parameterNames = ["registry", "req"];
|
|
68
|
+
return (tx) => tx.moveCall({
|
|
69
|
+
package: packageAddress,
|
|
70
|
+
module: 'direct_rule',
|
|
71
|
+
function: 'consume_withdraw_direct',
|
|
72
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
73
|
+
typeArguments: options.typeArguments
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from '../utils/index.ts';
|
|
5
|
+
export declare const AccountCreated: MoveStruct<any, any>;
|
|
6
|
+
export declare const SubAccountCreated: MoveStruct<any, any>;
|
|
7
|
+
export declare const AccountAliasUpdated: MoveStruct<any, any>;
|
|
8
|
+
export declare const DelegateAdded: MoveStruct<any, any>;
|
|
9
|
+
export declare const DelegateRemoved: MoveStruct<any, any>;
|
|
10
|
+
export declare const DelegateUpdated: MoveStruct<any, any>;
|
|
11
|
+
export declare const DelegateProtocolPermissionSet: MoveStruct<any, any>;
|
|
12
|
+
export declare const DelegateProtocolPermissionUnset: MoveStruct<any, any>;
|
|
13
|
+
export declare const ProtocolWhitelisted: MoveStruct<any, any>;
|
|
14
|
+
export declare const ProtocolDelisted: MoveStruct<any, any>;
|
|
15
|
+
export declare const DepositPolicyRegistered: MoveStruct<any, any>;
|
|
16
|
+
export declare const DepositPolicyUnregistered: MoveStruct<any, any>;
|
|
17
|
+
export declare const WithdrawPolicyRegistered: MoveStruct<any, any>;
|
|
18
|
+
export declare const WithdrawPolicyUnregistered: MoveStruct<any, any>;
|
|
19
|
+
export declare const DepositRequested: MoveStruct<any, any>;
|
|
20
|
+
export declare const DepositConsumed: MoveStruct<any, any>;
|
|
21
|
+
export declare const WithdrawRequested: MoveStruct<any, any>;
|
|
22
|
+
export declare const WithdrawConsumed: MoveStruct<any, any>;
|
|
23
|
+
export declare const TakenByProtocol: MoveStruct<any, any>;
|
|
24
|
+
export declare const ReturnedByProtocol: MoveStruct<any, any>;
|
|
25
|
+
export declare const ManagerAdded: MoveStruct<any, any>;
|
|
26
|
+
export declare const ManagerRemoved: MoveStruct<any, any>;
|
|
27
|
+
export declare const Paused: MoveStruct<any, any>;
|
|
28
|
+
export declare const Unpaused: MoveStruct<any, any>;
|
|
29
|
+
export declare const VersionAllowed: MoveStruct<any, any>;
|
|
30
|
+
export declare const VersionDisallowed: MoveStruct<any, any>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from "../utils/index.js";
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import * as type_name from "./deps/std/type_name.js";
|
|
7
|
+
import * as type_name_1 from "./deps/std/type_name.js";
|
|
8
|
+
import * as type_name_2 from "./deps/std/type_name.js";
|
|
9
|
+
import * as type_name_3 from "./deps/std/type_name.js";
|
|
10
|
+
import * as type_name_4 from "./deps/std/type_name.js";
|
|
11
|
+
import * as type_name_5 from "./deps/std/type_name.js";
|
|
12
|
+
import * as type_name_6 from "./deps/std/type_name.js";
|
|
13
|
+
import * as type_name_7 from "./deps/std/type_name.js";
|
|
14
|
+
import * as type_name_8 from "./deps/std/type_name.js";
|
|
15
|
+
import * as type_name_9 from "./deps/std/type_name.js";
|
|
16
|
+
import * as type_name_10 from "./deps/std/type_name.js";
|
|
17
|
+
import * as type_name_11 from "./deps/std/type_name.js";
|
|
18
|
+
import * as type_name_12 from "./deps/std/type_name.js";
|
|
19
|
+
import * as type_name_13 from "./deps/std/type_name.js";
|
|
20
|
+
import * as type_name_14 from "./deps/std/type_name.js";
|
|
21
|
+
import * as type_name_15 from "./deps/std/type_name.js";
|
|
22
|
+
import * as type_name_16 from "./deps/std/type_name.js";
|
|
23
|
+
import * as type_name_17 from "./deps/std/type_name.js";
|
|
24
|
+
import * as type_name_18 from "./deps/std/type_name.js";
|
|
25
|
+
import * as type_name_19 from "./deps/std/type_name.js";
|
|
26
|
+
const $moduleName = '@waterx/account::events';
|
|
27
|
+
export const AccountCreated = new MoveStruct({ name: `${$moduleName}::AccountCreated`, fields: {
|
|
28
|
+
owner: bcs.Address,
|
|
29
|
+
account_object_address: bcs.Address,
|
|
30
|
+
alias: bcs.string()
|
|
31
|
+
} });
|
|
32
|
+
export const SubAccountCreated = new MoveStruct({ name: `${$moduleName}::SubAccountCreated`, fields: {
|
|
33
|
+
owner: bcs.Address,
|
|
34
|
+
account_object_address: bcs.Address,
|
|
35
|
+
alias: bcs.string(),
|
|
36
|
+
index: bcs.u64()
|
|
37
|
+
} });
|
|
38
|
+
export const AccountAliasUpdated = new MoveStruct({ name: `${$moduleName}::AccountAliasUpdated`, fields: {
|
|
39
|
+
account_object_address: bcs.Address,
|
|
40
|
+
alias: bcs.string()
|
|
41
|
+
} });
|
|
42
|
+
export const DelegateAdded = new MoveStruct({ name: `${$moduleName}::DelegateAdded`, fields: {
|
|
43
|
+
account_object_address: bcs.Address,
|
|
44
|
+
delegate: bcs.Address,
|
|
45
|
+
alias: bcs.string(),
|
|
46
|
+
permissions: bcs.u32(),
|
|
47
|
+
expires_at_ms: bcs.option(bcs.u64())
|
|
48
|
+
} });
|
|
49
|
+
export const DelegateRemoved = new MoveStruct({ name: `${$moduleName}::DelegateRemoved`, fields: {
|
|
50
|
+
account_object_address: bcs.Address,
|
|
51
|
+
delegate: bcs.Address
|
|
52
|
+
} });
|
|
53
|
+
export const DelegateUpdated = new MoveStruct({ name: `${$moduleName}::DelegateUpdated`, fields: {
|
|
54
|
+
account_object_address: bcs.Address,
|
|
55
|
+
delegate: bcs.Address,
|
|
56
|
+
alias: bcs.string(),
|
|
57
|
+
permissions: bcs.u32(),
|
|
58
|
+
expires_at_ms: bcs.option(bcs.u64())
|
|
59
|
+
} });
|
|
60
|
+
export const DelegateProtocolPermissionSet = new MoveStruct({ name: `${$moduleName}::DelegateProtocolPermissionSet`, fields: {
|
|
61
|
+
account_object_address: bcs.Address,
|
|
62
|
+
delegate: bcs.Address,
|
|
63
|
+
protocol: type_name.TypeName,
|
|
64
|
+
permissions: bcs.u32()
|
|
65
|
+
} });
|
|
66
|
+
export const DelegateProtocolPermissionUnset = new MoveStruct({ name: `${$moduleName}::DelegateProtocolPermissionUnset`, fields: {
|
|
67
|
+
account_object_address: bcs.Address,
|
|
68
|
+
delegate: bcs.Address,
|
|
69
|
+
protocol: type_name_1.TypeName
|
|
70
|
+
} });
|
|
71
|
+
export const ProtocolWhitelisted = new MoveStruct({ name: `${$moduleName}::ProtocolWhitelisted`, fields: {
|
|
72
|
+
protocol: type_name_2.TypeName
|
|
73
|
+
} });
|
|
74
|
+
export const ProtocolDelisted = new MoveStruct({ name: `${$moduleName}::ProtocolDelisted`, fields: {
|
|
75
|
+
protocol: type_name_3.TypeName
|
|
76
|
+
} });
|
|
77
|
+
export const DepositPolicyRegistered = new MoveStruct({ name: `${$moduleName}::DepositPolicyRegistered`, fields: {
|
|
78
|
+
token_type: type_name_4.TypeName,
|
|
79
|
+
policy: type_name_5.TypeName
|
|
80
|
+
} });
|
|
81
|
+
export const DepositPolicyUnregistered = new MoveStruct({ name: `${$moduleName}::DepositPolicyUnregistered`, fields: {
|
|
82
|
+
token_type: type_name_6.TypeName
|
|
83
|
+
} });
|
|
84
|
+
export const WithdrawPolicyRegistered = new MoveStruct({ name: `${$moduleName}::WithdrawPolicyRegistered`, fields: {
|
|
85
|
+
token_type: type_name_7.TypeName,
|
|
86
|
+
policy: type_name_8.TypeName
|
|
87
|
+
} });
|
|
88
|
+
export const WithdrawPolicyUnregistered = new MoveStruct({ name: `${$moduleName}::WithdrawPolicyUnregistered`, fields: {
|
|
89
|
+
token_type: type_name_9.TypeName
|
|
90
|
+
} });
|
|
91
|
+
export const DepositRequested = new MoveStruct({ name: `${$moduleName}::DepositRequested`, fields: {
|
|
92
|
+
account_object_address: bcs.Address,
|
|
93
|
+
token_type: type_name_10.TypeName,
|
|
94
|
+
amount: bcs.u64()
|
|
95
|
+
} });
|
|
96
|
+
export const DepositConsumed = new MoveStruct({ name: `${$moduleName}::DepositConsumed`, fields: {
|
|
97
|
+
account_object_address: bcs.Address,
|
|
98
|
+
token_type: type_name_11.TypeName,
|
|
99
|
+
policy: type_name_12.TypeName,
|
|
100
|
+
amount: bcs.u64()
|
|
101
|
+
} });
|
|
102
|
+
export const WithdrawRequested = new MoveStruct({ name: `${$moduleName}::WithdrawRequested`, fields: {
|
|
103
|
+
account_object_address: bcs.Address,
|
|
104
|
+
token_type: type_name_13.TypeName,
|
|
105
|
+
amount: bcs.u64(),
|
|
106
|
+
requested_by: bcs.Address,
|
|
107
|
+
recipient: bcs.Address
|
|
108
|
+
} });
|
|
109
|
+
export const WithdrawConsumed = new MoveStruct({ name: `${$moduleName}::WithdrawConsumed`, fields: {
|
|
110
|
+
account_object_address: bcs.Address,
|
|
111
|
+
token_type: type_name_14.TypeName,
|
|
112
|
+
policy: type_name_15.TypeName,
|
|
113
|
+
amount: bcs.u64(),
|
|
114
|
+
recipient: bcs.Address
|
|
115
|
+
} });
|
|
116
|
+
export const TakenByProtocol = new MoveStruct({ name: `${$moduleName}::TakenByProtocol`, fields: {
|
|
117
|
+
account_object_address: bcs.Address,
|
|
118
|
+
protocol: type_name_16.TypeName,
|
|
119
|
+
token_type: type_name_17.TypeName,
|
|
120
|
+
amount: bcs.u64()
|
|
121
|
+
} });
|
|
122
|
+
export const ReturnedByProtocol = new MoveStruct({ name: `${$moduleName}::ReturnedByProtocol`, fields: {
|
|
123
|
+
account_object_address: bcs.Address,
|
|
124
|
+
protocol: type_name_18.TypeName,
|
|
125
|
+
token_type: type_name_19.TypeName,
|
|
126
|
+
amount: bcs.u64()
|
|
127
|
+
} });
|
|
128
|
+
export const ManagerAdded = new MoveStruct({ name: `${$moduleName}::ManagerAdded`, fields: {
|
|
129
|
+
manager: bcs.Address
|
|
130
|
+
} });
|
|
131
|
+
export const ManagerRemoved = new MoveStruct({ name: `${$moduleName}::ManagerRemoved`, fields: {
|
|
132
|
+
manager: bcs.Address
|
|
133
|
+
} });
|
|
134
|
+
export const Paused = new MoveStruct({ name: `${$moduleName}::Paused`, fields: {
|
|
135
|
+
paused_by: bcs.Address
|
|
136
|
+
} });
|
|
137
|
+
export const Unpaused = new MoveStruct({ name: `${$moduleName}::Unpaused`, fields: {
|
|
138
|
+
dummy_field: bcs.bool()
|
|
139
|
+
} });
|
|
140
|
+
export const VersionAllowed = new MoveStruct({ name: `${$moduleName}::VersionAllowed`, fields: {
|
|
141
|
+
version: bcs.u16()
|
|
142
|
+
} });
|
|
143
|
+
export const VersionDisallowed = new MoveStruct({ name: `${$moduleName}::VersionDisallowed`, fields: {
|
|
144
|
+
version: bcs.u16()
|
|
145
|
+
} });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
5
|
+
export interface PackageVersionOptions {
|
|
6
|
+
package?: string;
|
|
7
|
+
arguments?: [
|
|
8
|
+
];
|
|
9
|
+
}
|
|
10
|
+
export declare function packageVersion(options?: PackageVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|