@haneullabs/haneulns 0.1.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -53
- package/README.md +3 -3
- package/dist/constants.d.mts +16 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +90 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/contracts/haneulns/controller.mjs +62 -0
- package/dist/contracts/haneulns/controller.mjs.map +1 -0
- package/dist/contracts/haneulns/deps/haneul/balance.mjs +21 -0
- package/dist/contracts/haneulns/deps/haneul/balance.mjs.map +1 -0
- package/dist/contracts/haneulns/deps/haneul/vec_map.mjs +37 -0
- package/dist/contracts/haneulns/deps/haneul/vec_map.mjs.map +1 -0
- package/dist/contracts/haneulns/deps/std/type_name.mjs +17 -0
- package/dist/contracts/haneulns/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/haneulns/domain.mjs +23 -0
- package/dist/contracts/haneulns/domain.mjs.map +1 -0
- package/dist/contracts/haneulns/haneulns.mjs +68 -0
- package/dist/contracts/haneulns/haneulns.mjs.map +1 -0
- package/dist/contracts/haneulns/name_record.mjs +27 -0
- package/dist/contracts/haneulns/name_record.mjs.map +1 -0
- package/dist/contracts/haneulns/payment.mjs +162 -0
- package/dist/contracts/haneulns/payment.mjs.map +1 -0
- package/dist/contracts/haneulns/pricing_config.mjs +25 -0
- package/dist/contracts/haneulns/pricing_config.mjs.map +1 -0
- package/dist/contracts/haneulns_coupons/coupon_house.mjs +59 -0
- package/dist/contracts/haneulns_coupons/coupon_house.mjs.map +1 -0
- package/dist/contracts/haneulns_coupons/data.mjs +16 -0
- package/dist/contracts/haneulns_coupons/data.mjs.map +1 -0
- package/dist/contracts/haneulns_coupons/deps/haneul/bag.mjs +43 -0
- package/dist/contracts/haneulns_coupons/deps/haneul/bag.mjs.map +1 -0
- package/dist/contracts/haneulns_discounts/deps/haneul/linked_table.mjs +27 -0
- package/dist/contracts/haneulns_discounts/deps/haneul/linked_table.mjs.map +1 -0
- package/dist/contracts/haneulns_discounts/deps/haneulns/pricing_config.mjs +16 -0
- package/dist/contracts/haneulns_discounts/deps/haneulns/pricing_config.mjs.map +1 -0
- package/dist/contracts/haneulns_discounts/discounts.mjs +51 -0
- package/dist/contracts/haneulns_discounts/discounts.mjs.map +1 -0
- package/dist/contracts/haneulns_discounts/free_claims.mjs +60 -0
- package/dist/contracts/haneulns_discounts/free_claims.mjs.map +1 -0
- package/dist/contracts/haneulns_payments/deps/haneul/vec_map.mjs +37 -0
- package/dist/contracts/haneulns_payments/deps/haneul/vec_map.mjs.map +1 -0
- package/dist/contracts/haneulns_payments/deps/std/type_name.mjs +17 -0
- package/dist/contracts/haneulns_payments/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/haneulns_payments/payments.mjs +145 -0
- package/dist/contracts/haneulns_payments/payments.mjs.map +1 -0
- package/dist/contracts/pyth/data_source.mjs +20 -0
- package/dist/contracts/pyth/data_source.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs.map +1 -0
- package/dist/contracts/pyth/state.mjs +28 -0
- package/dist/contracts/pyth/state.mjs.map +1 -0
- package/dist/contracts/utils/index.mjs +120 -0
- package/dist/contracts/utils/index.mjs.map +1 -0
- package/dist/contracts/wormhole/bytes32.mjs +16 -0
- package/dist/contracts/wormhole/bytes32.mjs.map +1 -0
- package/dist/contracts/wormhole/consumed_vaas.mjs +16 -0
- package/dist/contracts/wormhole/consumed_vaas.mjs.map +1 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs +16 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs.map +1 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
- package/dist/contracts/wormhole/external_address.mjs +16 -0
- package/dist/contracts/wormhole/external_address.mjs.map +1 -0
- package/dist/contracts/wormhole/fee_collector.mjs +20 -0
- package/dist/contracts/wormhole/fee_collector.mjs.map +1 -0
- package/dist/contracts/wormhole/set.mjs +16 -0
- package/dist/contracts/wormhole/set.mjs.map +1 -0
- package/dist/contracts/wormhole/state.mjs +31 -0
- package/dist/contracts/wormhole/state.mjs.map +1 -0
- package/dist/haneulns-client.d.mts +76 -0
- package/dist/haneulns-client.d.mts.map +1 -0
- package/dist/haneulns-client.mjs +205 -0
- package/dist/haneulns-client.mjs.map +1 -0
- package/dist/haneulns-transaction.d.mts +144 -0
- package/dist/haneulns-transaction.d.mts.map +1 -0
- package/dist/haneulns-transaction.mjs +384 -0
- package/dist/haneulns-transaction.mjs.map +1 -0
- package/dist/helpers.d.mts +22 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +45 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -0
- package/dist/pyth/PriceServiceConnection.mjs +35 -0
- package/dist/pyth/PriceServiceConnection.mjs.map +1 -0
- package/dist/pyth/pyth-helpers.mjs +18 -0
- package/dist/pyth/pyth-helpers.mjs.map +1 -0
- package/dist/pyth/pyth.mjs +219 -0
- package/dist/pyth/pyth.mjs.map +1 -0
- package/dist/types.d.mts +88 -0
- package/dist/types.d.mts.map +1 -0
- package/package.json +27 -23
- package/src/contracts/haneulns/admin.ts +114 -0
- package/src/contracts/haneulns/auction.ts +341 -0
- package/src/contracts/haneulns/config.ts +225 -0
- package/src/contracts/haneulns/constants.ts +167 -0
- package/src/contracts/haneulns/controller.ts +269 -0
- package/src/contracts/haneulns/core_config.ts +208 -0
- package/src/contracts/haneulns/deps/haneul/balance.ts +19 -0
- package/src/contracts/haneulns/deps/haneul/coin.ts +20 -0
- package/src/contracts/haneulns/deps/haneul/linked_table.ts +27 -0
- package/src/contracts/haneulns/deps/haneul/table.ts +36 -0
- package/src/contracts/haneulns/deps/haneul/vec_map.ts +33 -0
- package/src/contracts/haneulns/deps/haneul/vec_set.ts +22 -0
- package/src/contracts/haneulns/deps/std/type_name.ts +24 -0
- package/src/contracts/haneulns/domain.ts +230 -0
- package/src/contracts/haneulns/haneulns.ts +456 -0
- package/src/contracts/haneulns/haneulns_registration.ts +200 -0
- package/src/contracts/haneulns/name_record.ts +315 -0
- package/src/contracts/haneulns/payment.ts +444 -0
- package/src/contracts/haneulns/pricing_config.ts +190 -0
- package/src/contracts/haneulns/registry.ts +514 -0
- package/src/contracts/haneulns/subdomain_registration.ts +63 -0
- package/src/contracts/haneulns/update_image.ts +15 -0
- package/src/contracts/haneulns_coupons/constants.ts +45 -0
- package/src/contracts/haneulns_coupons/coupon.ts +15 -0
- package/src/contracts/haneulns_coupons/coupon_house.ts +412 -0
- package/src/contracts/haneulns_coupons/data.ts +12 -0
- package/src/contracts/haneulns_coupons/deps/haneul/bag.ts +41 -0
- package/src/contracts/haneulns_coupons/range.ts +101 -0
- package/src/contracts/haneulns_coupons/rules.ts +342 -0
- package/src/contracts/haneulns_discounts/deps/haneul/linked_table.ts +27 -0
- package/src/contracts/haneulns_discounts/deps/haneulns/pricing_config.ts +10 -0
- package/src/contracts/haneulns_discounts/discounts.ts +156 -0
- package/src/contracts/haneulns_discounts/free_claims.ts +161 -0
- package/src/contracts/haneulns_discounts/house.ts +47 -0
- package/src/contracts/haneulns_payments/deps/haneul/vec_map.ts +33 -0
- package/src/contracts/haneulns_payments/deps/std/type_name.ts +24 -0
- package/src/contracts/haneulns_payments/payments.ts +257 -0
- package/src/contracts/haneulns_temp_subdomain_proxy/subdomain_proxy.ts +343 -0
- package/src/contracts/pyth/data_source.ts +15 -0
- package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
- package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.ts +12 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.ts +13 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.ts +13 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.ts +12 -0
- package/src/contracts/pyth/state.ts +22 -0
- package/src/contracts/utils/index.ts +234 -0
- package/src/contracts/wormhole/bytes32.ts +12 -0
- package/src/contracts/wormhole/consumed_vaas.ts +13 -0
- package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.ts +12 -0
- package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
- package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
- package/src/contracts/wormhole/external_address.ts +13 -0
- package/src/contracts/wormhole/fee_collector.ts +15 -0
- package/src/contracts/wormhole/set.ts +12 -0
- package/src/contracts/wormhole/state.ts +25 -0
- package/src/haneulns-client.ts +115 -160
- package/src/haneulns-transaction.ts +142 -116
- package/src/index.ts +3 -3
- package/src/pyth/pyth.ts +55 -71
- package/src/types.ts +5 -7
- package/dist/cjs/constants.d.ts +0 -11
- package/dist/cjs/constants.js +0 -120
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/haneulns-client.d.ts +0 -40
- package/dist/cjs/haneulns-client.js +0 -261
- package/dist/cjs/haneulns-client.js.map +0 -7
- package/dist/cjs/haneulns-transaction.d.ts +0 -105
- package/dist/cjs/haneulns-transaction.js +0 -465
- package/dist/cjs/haneulns-transaction.js.map +0 -7
- package/dist/cjs/helpers.d.ts +0 -18
- package/dist/cjs/helpers.js +0 -63
- package/dist/cjs/helpers.js.map +0 -7
- package/dist/cjs/index.d.ts +0 -5
- package/dist/cjs/index.js +0 -39
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/package.json +0 -5
- package/dist/cjs/pyth/PriceServiceConnection.d.ts +0 -26
- package/dist/cjs/pyth/PriceServiceConnection.js +0 -68
- package/dist/cjs/pyth/PriceServiceConnection.js.map +0 -7
- package/dist/cjs/pyth/pyth-helpers.d.ts +0 -7
- package/dist/cjs/pyth/pyth-helpers.js +0 -36
- package/dist/cjs/pyth/pyth-helpers.js.map +0 -7
- package/dist/cjs/pyth/pyth.d.ts +0 -66
- package/dist/cjs/pyth/pyth.js +0 -270
- package/dist/cjs/pyth/pyth.js.map +0 -7
- package/dist/cjs/types.d.ts +0 -89
- package/dist/cjs/types.js +0 -17
- package/dist/cjs/types.js.map +0 -7
- package/dist/esm/constants.d.ts +0 -11
- package/dist/esm/constants.js +0 -100
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/haneulns-client.d.ts +0 -40
- package/dist/esm/haneulns-client.js +0 -249
- package/dist/esm/haneulns-client.js.map +0 -7
- package/dist/esm/haneulns-transaction.d.ts +0 -105
- package/dist/esm/haneulns-transaction.js +0 -445
- package/dist/esm/haneulns-transaction.js.map +0 -7
- package/dist/esm/helpers.d.ts +0 -18
- package/dist/esm/helpers.js +0 -43
- package/dist/esm/helpers.js.map +0 -7
- package/dist/esm/index.d.ts +0 -5
- package/dist/esm/index.js +0 -28
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/package.json +0 -5
- package/dist/esm/pyth/PriceServiceConnection.d.ts +0 -26
- package/dist/esm/pyth/PriceServiceConnection.js +0 -38
- package/dist/esm/pyth/PriceServiceConnection.js.map +0 -7
- package/dist/esm/pyth/pyth-helpers.d.ts +0 -7
- package/dist/esm/pyth/pyth-helpers.js +0 -16
- package/dist/esm/pyth/pyth-helpers.js.map +0 -7
- package/dist/esm/pyth/pyth.d.ts +0 -66
- package/dist/esm/pyth/pyth.js +0 -250
- package/dist/esm/pyth/pyth.js.map +0 -7
- package/dist/esm/types.d.ts +0 -89
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -7
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Similar to `haneul::table` but the values are linked together, allowing for ordered
|
|
7
|
+
* insertion and removal
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { type BcsType, bcs } from '@haneullabs/haneul/bcs';
|
|
11
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
12
|
+
const $moduleName = '0x2::linked_table';
|
|
13
|
+
export function LinkedTable<K extends BcsType<any>>(...typeParameters: [K]) {
|
|
14
|
+
return new MoveStruct({
|
|
15
|
+
name: `${$moduleName}::LinkedTable<${typeParameters[0].name as K['name']}, phantom V>`,
|
|
16
|
+
fields: {
|
|
17
|
+
/** the ID of this table */
|
|
18
|
+
id: bcs.Address,
|
|
19
|
+
/** the number of key-value pairs in the table */
|
|
20
|
+
size: bcs.u64(),
|
|
21
|
+
/** the front of the table, i.e. the key of the first entry */
|
|
22
|
+
head: bcs.option(typeParameters[0]),
|
|
23
|
+
/** the back of the table, i.e. the key of the last entry */
|
|
24
|
+
tail: bcs.option(typeParameters[0]),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A table is a map-like collection. But unlike a traditional collection, it's keys
|
|
7
|
+
* and values are not stored within the `Table` value, but instead are stored using
|
|
8
|
+
* Haneul's object system. The `Table` struct acts only as a handle into the object
|
|
9
|
+
* system to retrieve those keys and values. Note that this means that `Table`
|
|
10
|
+
* values with exactly the same key-value mapping will not be equal, with `==`, at
|
|
11
|
+
* runtime. For example
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* let table1 = table::new<u64, bool>();
|
|
15
|
+
* let table2 = table::new<u64, bool>();
|
|
16
|
+
* table::add(&mut table1, 0, false);
|
|
17
|
+
* table::add(&mut table1, 1, true);
|
|
18
|
+
* table::add(&mut table2, 0, false);
|
|
19
|
+
* table::add(&mut table2, 1, true);
|
|
20
|
+
* // table1 does not equal table2, despite having the same entries
|
|
21
|
+
* assert!(&table1 != &table2);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
26
|
+
import { bcs } from '@haneullabs/haneul/bcs';
|
|
27
|
+
const $moduleName = '0x2::table';
|
|
28
|
+
export const Table = new MoveStruct({
|
|
29
|
+
name: `${$moduleName}::Table<phantom K, phantom V>`,
|
|
30
|
+
fields: {
|
|
31
|
+
/** the ID of this table */
|
|
32
|
+
id: bcs.Address,
|
|
33
|
+
/** the number of key-value pairs in the table */
|
|
34
|
+
size: bcs.u64(),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@haneullabs/haneul/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
9
|
+
return new MoveStruct({
|
|
10
|
+
name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
11
|
+
fields: {
|
|
12
|
+
key: typeParameters[0],
|
|
13
|
+
value: typeParameters[1],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
+
* of this data structure is only to provide the convenience of programming against
|
|
22
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
+
* also be handwritten.
|
|
25
|
+
*/
|
|
26
|
+
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
27
|
+
return new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
29
|
+
fields: {
|
|
30
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@haneullabs/haneul/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<K extends BcsType<any>>(...typeParameters: [K]) {
|
|
16
|
+
return new MoveStruct({
|
|
17
|
+
name: `${$moduleName}::VecSet<${typeParameters[0].name as K['name']}>`,
|
|
18
|
+
fields: {
|
|
19
|
+
contents: bcs.vector(typeParameters[0]),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/** Functionality for converting Move types into values. Use with care! */
|
|
6
|
+
|
|
7
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
8
|
+
import { bcs } from '@haneullabs/haneul/bcs';
|
|
9
|
+
const $moduleName = 'std::type_name';
|
|
10
|
+
export const TypeName = new MoveStruct({
|
|
11
|
+
name: `${$moduleName}::TypeName`,
|
|
12
|
+
fields: {
|
|
13
|
+
/**
|
|
14
|
+
* String representation of the type. All types are represented using their source
|
|
15
|
+
* syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
|
|
16
|
+
* Struct types are represented as fully qualified type names; e.g.
|
|
17
|
+
* `00000000000000000000000000000001::string::String` or
|
|
18
|
+
* `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
|
|
19
|
+
* Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
|
|
20
|
+
* 32 depending on the Move platform)
|
|
21
|
+
*/
|
|
22
|
+
name: bcs.string(),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines the `Domain` type and helper functions.
|
|
7
|
+
*
|
|
8
|
+
* Domains are structured similar to their web2 counterpart and the rules
|
|
9
|
+
* determining what a valid domain is can be found here:
|
|
10
|
+
* https://en.wikipedia.org/wiki/Domain_name#Domain_name_syntax
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
14
|
+
import { bcs } from '@haneullabs/haneul/bcs';
|
|
15
|
+
import { type Transaction } from '@haneullabs/haneul/transactions';
|
|
16
|
+
const $moduleName = '@haneulns/core::domain';
|
|
17
|
+
export const Domain = new MoveStruct({
|
|
18
|
+
name: `${$moduleName}::Domain`,
|
|
19
|
+
fields: {
|
|
20
|
+
/**
|
|
21
|
+
* Vector of labels that make up a domain.
|
|
22
|
+
*
|
|
23
|
+
* Labels are stored in reverse order such that the TLD is always in position `0`.
|
|
24
|
+
* e.g. domain "pay.name.haneul" will be stored in the vector as ["haneul", "name",
|
|
25
|
+
* "pay"].
|
|
26
|
+
*/
|
|
27
|
+
labels: bcs.vector(bcs.string()),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export interface NewArguments {
|
|
31
|
+
domain: RawTransactionArgument<string>;
|
|
32
|
+
}
|
|
33
|
+
export interface NewOptions {
|
|
34
|
+
package?: string;
|
|
35
|
+
arguments: NewArguments | [domain: RawTransactionArgument<string>];
|
|
36
|
+
}
|
|
37
|
+
export function _new(options: NewOptions) {
|
|
38
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
39
|
+
const argumentsTypes = ['0x1::string::String'] satisfies (string | null)[];
|
|
40
|
+
const parameterNames = ['domain'];
|
|
41
|
+
return (tx: Transaction) =>
|
|
42
|
+
tx.moveCall({
|
|
43
|
+
package: packageAddress,
|
|
44
|
+
module: 'domain',
|
|
45
|
+
function: 'new',
|
|
46
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export interface ToStringArguments {
|
|
50
|
+
self: RawTransactionArgument<string>;
|
|
51
|
+
}
|
|
52
|
+
export interface ToStringOptions {
|
|
53
|
+
package?: string;
|
|
54
|
+
arguments: ToStringArguments | [self: RawTransactionArgument<string>];
|
|
55
|
+
}
|
|
56
|
+
/** Converts a domain into a fully-qualified string representation. */
|
|
57
|
+
export function toString(options: ToStringOptions) {
|
|
58
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
59
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
60
|
+
const parameterNames = ['self'];
|
|
61
|
+
return (tx: Transaction) =>
|
|
62
|
+
tx.moveCall({
|
|
63
|
+
package: packageAddress,
|
|
64
|
+
module: 'domain',
|
|
65
|
+
function: 'to_string',
|
|
66
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export interface LabelArguments {
|
|
70
|
+
self: RawTransactionArgument<string>;
|
|
71
|
+
level: RawTransactionArgument<number | bigint>;
|
|
72
|
+
}
|
|
73
|
+
export interface LabelOptions {
|
|
74
|
+
package?: string;
|
|
75
|
+
arguments:
|
|
76
|
+
| LabelArguments
|
|
77
|
+
| [self: RawTransactionArgument<string>, level: RawTransactionArgument<number | bigint>];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the `label` in a domain specified by `level`.
|
|
81
|
+
*
|
|
82
|
+
* Given the domain "pay.name.haneul" the individual labels have the following levels:
|
|
83
|
+
*
|
|
84
|
+
* - "pay" - `2`
|
|
85
|
+
* - "name" - `1`
|
|
86
|
+
* - "haneul" - `0`
|
|
87
|
+
*
|
|
88
|
+
* This means that the TLD will always be at level `0`.
|
|
89
|
+
*/
|
|
90
|
+
export function label(options: LabelOptions) {
|
|
91
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
92
|
+
const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
|
|
93
|
+
const parameterNames = ['self', 'level'];
|
|
94
|
+
return (tx: Transaction) =>
|
|
95
|
+
tx.moveCall({
|
|
96
|
+
package: packageAddress,
|
|
97
|
+
module: 'domain',
|
|
98
|
+
function: 'label',
|
|
99
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export interface TldArguments {
|
|
103
|
+
self: RawTransactionArgument<string>;
|
|
104
|
+
}
|
|
105
|
+
export interface TldOptions {
|
|
106
|
+
package?: string;
|
|
107
|
+
arguments: TldArguments | [self: RawTransactionArgument<string>];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns the TLD (Top-Level Domain) of a `Domain`.
|
|
111
|
+
*
|
|
112
|
+
* "name.haneul" -> "haneul"
|
|
113
|
+
*/
|
|
114
|
+
export function tld(options: TldOptions) {
|
|
115
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
116
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
117
|
+
const parameterNames = ['self'];
|
|
118
|
+
return (tx: Transaction) =>
|
|
119
|
+
tx.moveCall({
|
|
120
|
+
package: packageAddress,
|
|
121
|
+
module: 'domain',
|
|
122
|
+
function: 'tld',
|
|
123
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export interface SldArguments {
|
|
127
|
+
self: RawTransactionArgument<string>;
|
|
128
|
+
}
|
|
129
|
+
export interface SldOptions {
|
|
130
|
+
package?: string;
|
|
131
|
+
arguments: SldArguments | [self: RawTransactionArgument<string>];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Returns the SLD (Second-Level Domain) of a `Domain`.
|
|
135
|
+
*
|
|
136
|
+
* "name.haneul" -> "haneul"
|
|
137
|
+
*/
|
|
138
|
+
export function sld(options: SldOptions) {
|
|
139
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
140
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
141
|
+
const parameterNames = ['self'];
|
|
142
|
+
return (tx: Transaction) =>
|
|
143
|
+
tx.moveCall({
|
|
144
|
+
package: packageAddress,
|
|
145
|
+
module: 'domain',
|
|
146
|
+
function: 'sld',
|
|
147
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export interface NumberOfLevelsArguments {
|
|
151
|
+
self: RawTransactionArgument<string>;
|
|
152
|
+
}
|
|
153
|
+
export interface NumberOfLevelsOptions {
|
|
154
|
+
package?: string;
|
|
155
|
+
arguments: NumberOfLevelsArguments | [self: RawTransactionArgument<string>];
|
|
156
|
+
}
|
|
157
|
+
export function numberOfLevels(options: NumberOfLevelsOptions) {
|
|
158
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
159
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
160
|
+
const parameterNames = ['self'];
|
|
161
|
+
return (tx: Transaction) =>
|
|
162
|
+
tx.moveCall({
|
|
163
|
+
package: packageAddress,
|
|
164
|
+
module: 'domain',
|
|
165
|
+
function: 'number_of_levels',
|
|
166
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
export interface IsSubdomainArguments {
|
|
170
|
+
domain: RawTransactionArgument<string>;
|
|
171
|
+
}
|
|
172
|
+
export interface IsSubdomainOptions {
|
|
173
|
+
package?: string;
|
|
174
|
+
arguments: IsSubdomainArguments | [domain: RawTransactionArgument<string>];
|
|
175
|
+
}
|
|
176
|
+
export function isSubdomain(options: IsSubdomainOptions) {
|
|
177
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
178
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
179
|
+
const parameterNames = ['domain'];
|
|
180
|
+
return (tx: Transaction) =>
|
|
181
|
+
tx.moveCall({
|
|
182
|
+
package: packageAddress,
|
|
183
|
+
module: 'domain',
|
|
184
|
+
function: 'is_subdomain',
|
|
185
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
export interface ParentArguments {
|
|
189
|
+
domain: RawTransactionArgument<string>;
|
|
190
|
+
}
|
|
191
|
+
export interface ParentOptions {
|
|
192
|
+
package?: string;
|
|
193
|
+
arguments: ParentArguments | [domain: RawTransactionArgument<string>];
|
|
194
|
+
}
|
|
195
|
+
/** Derive the parent of a subdomain. e.g. `subdomain.example.haneul` -> `example.haneul` */
|
|
196
|
+
export function parent(options: ParentOptions) {
|
|
197
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
198
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
199
|
+
const parameterNames = ['domain'];
|
|
200
|
+
return (tx: Transaction) =>
|
|
201
|
+
tx.moveCall({
|
|
202
|
+
package: packageAddress,
|
|
203
|
+
module: 'domain',
|
|
204
|
+
function: 'parent',
|
|
205
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
export interface IsParentOfArguments {
|
|
209
|
+
parent: RawTransactionArgument<string>;
|
|
210
|
+
child: RawTransactionArgument<string>;
|
|
211
|
+
}
|
|
212
|
+
export interface IsParentOfOptions {
|
|
213
|
+
package?: string;
|
|
214
|
+
arguments:
|
|
215
|
+
| IsParentOfArguments
|
|
216
|
+
| [parent: RawTransactionArgument<string>, child: RawTransactionArgument<string>];
|
|
217
|
+
}
|
|
218
|
+
/** Checks if `parent` domain is a valid parent for `child`. */
|
|
219
|
+
export function isParentOf(options: IsParentOfOptions) {
|
|
220
|
+
const packageAddress = options.package ?? '@haneulns/core';
|
|
221
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
222
|
+
const parameterNames = ['parent', 'child'];
|
|
223
|
+
return (tx: Transaction) =>
|
|
224
|
+
tx.moveCall({
|
|
225
|
+
package: packageAddress,
|
|
226
|
+
module: 'domain',
|
|
227
|
+
function: 'is_parent_of',
|
|
228
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
229
|
+
});
|
|
230
|
+
}
|