@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,412 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A module to support coupons for HaneulNS. This module allows secondary modules
|
|
7
|
+
* (e.g. Discord) to add or remove coupons too. This allows for separation of logic
|
|
8
|
+
* & ease of de-authorization in case we don't want some functionality anymore.
|
|
9
|
+
*
|
|
10
|
+
* Coupons are unique string codes, that can be used (based on the business rules)
|
|
11
|
+
* to claim discounts in the app. Each coupon is validated towards a list of rules.
|
|
12
|
+
* View `rules` module for explanation. The app is authorized on `HaneulNS` to be able
|
|
13
|
+
* to claim names and add earnings to the registry.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
17
|
+
import { bcs, type BcsType } from '@haneullabs/haneul/bcs';
|
|
18
|
+
import { type Transaction } from '@haneullabs/haneul/transactions';
|
|
19
|
+
import * as data from './data.js';
|
|
20
|
+
const $moduleName = '@haneulns/coupons::coupon_house';
|
|
21
|
+
export const CouponsApp = new MoveStruct({
|
|
22
|
+
name: `${$moduleName}::CouponsApp`,
|
|
23
|
+
fields: {
|
|
24
|
+
dummy_field: bcs.bool(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const AppKey = new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::AppKey<phantom A>`,
|
|
29
|
+
fields: {
|
|
30
|
+
dummy_field: bcs.bool(),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const CouponHouse = new MoveStruct({
|
|
34
|
+
name: `${$moduleName}::CouponHouse`,
|
|
35
|
+
fields: {
|
|
36
|
+
data: data.Data,
|
|
37
|
+
version: bcs.u8(),
|
|
38
|
+
storage: bcs.Address,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
export interface SetupArguments {
|
|
42
|
+
haneulns: RawTransactionArgument<string>;
|
|
43
|
+
cap: RawTransactionArgument<string>;
|
|
44
|
+
}
|
|
45
|
+
export interface SetupOptions {
|
|
46
|
+
package?: string;
|
|
47
|
+
arguments:
|
|
48
|
+
| SetupArguments
|
|
49
|
+
| [haneulns: RawTransactionArgument<string>, cap: RawTransactionArgument<string>];
|
|
50
|
+
}
|
|
51
|
+
/** Called once to setup the CouponHouse on HaneulNS. */
|
|
52
|
+
export function setup(options: SetupOptions) {
|
|
53
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
54
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
55
|
+
const parameterNames = ['haneulns', 'cap'];
|
|
56
|
+
return (tx: Transaction) =>
|
|
57
|
+
tx.moveCall({
|
|
58
|
+
package: packageAddress,
|
|
59
|
+
module: 'coupon_house',
|
|
60
|
+
function: 'setup',
|
|
61
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export interface ApplyCouponArguments {
|
|
65
|
+
haneulns: RawTransactionArgument<string>;
|
|
66
|
+
intent: RawTransactionArgument<string>;
|
|
67
|
+
couponCode: RawTransactionArgument<string>;
|
|
68
|
+
}
|
|
69
|
+
export interface ApplyCouponOptions {
|
|
70
|
+
package?: string;
|
|
71
|
+
arguments:
|
|
72
|
+
| ApplyCouponArguments
|
|
73
|
+
| [
|
|
74
|
+
haneulns: RawTransactionArgument<string>,
|
|
75
|
+
intent: RawTransactionArgument<string>,
|
|
76
|
+
couponCode: RawTransactionArgument<string>,
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
export function applyCoupon(options: ApplyCouponOptions) {
|
|
80
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
81
|
+
const argumentsTypes = [null, null, '0x1::string::String', '0x2::clock::Clock'] satisfies (
|
|
82
|
+
| string
|
|
83
|
+
| null
|
|
84
|
+
)[];
|
|
85
|
+
const parameterNames = ['haneulns', 'intent', 'couponCode'];
|
|
86
|
+
return (tx: Transaction) =>
|
|
87
|
+
tx.moveCall({
|
|
88
|
+
package: packageAddress,
|
|
89
|
+
module: 'coupon_house',
|
|
90
|
+
function: 'apply_coupon',
|
|
91
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export interface RegisterWithCouponArguments {
|
|
95
|
+
Suins: RawTransactionArgument<string>;
|
|
96
|
+
CouponCode: RawTransactionArgument<string>;
|
|
97
|
+
DomainName: RawTransactionArgument<string>;
|
|
98
|
+
NoYears: RawTransactionArgument<number>;
|
|
99
|
+
Payment: RawTransactionArgument<string>;
|
|
100
|
+
}
|
|
101
|
+
export interface RegisterWithCouponOptions {
|
|
102
|
+
package?: string;
|
|
103
|
+
arguments:
|
|
104
|
+
| RegisterWithCouponArguments
|
|
105
|
+
| [
|
|
106
|
+
Suins: RawTransactionArgument<string>,
|
|
107
|
+
CouponCode: RawTransactionArgument<string>,
|
|
108
|
+
DomainName: RawTransactionArgument<string>,
|
|
109
|
+
NoYears: RawTransactionArgument<number>,
|
|
110
|
+
Payment: RawTransactionArgument<string>,
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
export function registerWithCoupon(options: RegisterWithCouponOptions) {
|
|
114
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
115
|
+
const argumentsTypes = [
|
|
116
|
+
null,
|
|
117
|
+
'0x1::string::String',
|
|
118
|
+
'0x1::string::String',
|
|
119
|
+
'u8',
|
|
120
|
+
null,
|
|
121
|
+
'0x2::clock::Clock',
|
|
122
|
+
] satisfies (string | null)[];
|
|
123
|
+
const parameterNames = ['Suins', 'CouponCode', 'DomainName', 'NoYears', 'Payment'];
|
|
124
|
+
return (tx: Transaction) =>
|
|
125
|
+
tx.moveCall({
|
|
126
|
+
package: packageAddress,
|
|
127
|
+
module: 'coupon_house',
|
|
128
|
+
function: 'register_with_coupon',
|
|
129
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export interface CalculateSalePriceArguments {
|
|
133
|
+
Suins: RawTransactionArgument<string>;
|
|
134
|
+
Price: RawTransactionArgument<number | bigint>;
|
|
135
|
+
CouponCode: RawTransactionArgument<string>;
|
|
136
|
+
}
|
|
137
|
+
export interface CalculateSalePriceOptions {
|
|
138
|
+
package?: string;
|
|
139
|
+
arguments:
|
|
140
|
+
| CalculateSalePriceArguments
|
|
141
|
+
| [
|
|
142
|
+
Suins: RawTransactionArgument<string>,
|
|
143
|
+
Price: RawTransactionArgument<number | bigint>,
|
|
144
|
+
CouponCode: RawTransactionArgument<string>,
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
export function calculateSalePrice(options: CalculateSalePriceOptions) {
|
|
148
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
149
|
+
const argumentsTypes = [null, 'u64', '0x1::string::String'] satisfies (string | null)[];
|
|
150
|
+
const parameterNames = ['Suins', 'Price', 'CouponCode'];
|
|
151
|
+
return (tx: Transaction) =>
|
|
152
|
+
tx.moveCall({
|
|
153
|
+
package: packageAddress,
|
|
154
|
+
module: 'coupon_house',
|
|
155
|
+
function: 'calculate_sale_price',
|
|
156
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export interface AppDataMutArguments<A extends BcsType<any>> {
|
|
160
|
+
haneulns: RawTransactionArgument<string>;
|
|
161
|
+
_: RawTransactionArgument<A>;
|
|
162
|
+
}
|
|
163
|
+
export interface AppDataMutOptions<A extends BcsType<any>> {
|
|
164
|
+
package?: string;
|
|
165
|
+
arguments:
|
|
166
|
+
| AppDataMutArguments<A>
|
|
167
|
+
| [haneulns: RawTransactionArgument<string>, _: RawTransactionArgument<A>];
|
|
168
|
+
typeArguments: [string];
|
|
169
|
+
}
|
|
170
|
+
export function appDataMut<A extends BcsType<any>>(options: AppDataMutOptions<A>) {
|
|
171
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
172
|
+
const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
|
|
173
|
+
const parameterNames = ['haneulns', '_'];
|
|
174
|
+
return (tx: Transaction) =>
|
|
175
|
+
tx.moveCall({
|
|
176
|
+
package: packageAddress,
|
|
177
|
+
module: 'coupon_house',
|
|
178
|
+
function: 'app_data_mut',
|
|
179
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
180
|
+
typeArguments: options.typeArguments,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
export interface AuthorizeAppArguments {
|
|
184
|
+
_: RawTransactionArgument<string>;
|
|
185
|
+
haneulns: RawTransactionArgument<string>;
|
|
186
|
+
}
|
|
187
|
+
export interface AuthorizeAppOptions {
|
|
188
|
+
package?: string;
|
|
189
|
+
arguments:
|
|
190
|
+
| AuthorizeAppArguments
|
|
191
|
+
| [_: RawTransactionArgument<string>, haneulns: RawTransactionArgument<string>];
|
|
192
|
+
typeArguments: [string];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Authorize an app on the coupon house. This allows to a secondary module to
|
|
196
|
+
* add/remove coupons.
|
|
197
|
+
*/
|
|
198
|
+
export function authorizeApp(options: AuthorizeAppOptions) {
|
|
199
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
200
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
201
|
+
const parameterNames = ['_', 'haneulns'];
|
|
202
|
+
return (tx: Transaction) =>
|
|
203
|
+
tx.moveCall({
|
|
204
|
+
package: packageAddress,
|
|
205
|
+
module: 'coupon_house',
|
|
206
|
+
function: 'authorize_app',
|
|
207
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
208
|
+
typeArguments: options.typeArguments,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
export interface DeauthorizeAppArguments {
|
|
212
|
+
_: RawTransactionArgument<string>;
|
|
213
|
+
haneulns: RawTransactionArgument<string>;
|
|
214
|
+
}
|
|
215
|
+
export interface DeauthorizeAppOptions {
|
|
216
|
+
package?: string;
|
|
217
|
+
arguments:
|
|
218
|
+
| DeauthorizeAppArguments
|
|
219
|
+
| [_: RawTransactionArgument<string>, haneulns: RawTransactionArgument<string>];
|
|
220
|
+
typeArguments: [string];
|
|
221
|
+
}
|
|
222
|
+
/** De-authorize an app. The app can no longer add or remove */
|
|
223
|
+
export function deauthorizeApp(options: DeauthorizeAppOptions) {
|
|
224
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
225
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
226
|
+
const parameterNames = ['_', 'haneulns'];
|
|
227
|
+
return (tx: Transaction) =>
|
|
228
|
+
tx.moveCall({
|
|
229
|
+
package: packageAddress,
|
|
230
|
+
module: 'coupon_house',
|
|
231
|
+
function: 'deauthorize_app',
|
|
232
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
233
|
+
typeArguments: options.typeArguments,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
export interface SetVersionArguments {
|
|
237
|
+
_: RawTransactionArgument<string>;
|
|
238
|
+
haneulns: RawTransactionArgument<string>;
|
|
239
|
+
version: RawTransactionArgument<number>;
|
|
240
|
+
}
|
|
241
|
+
export interface SetVersionOptions {
|
|
242
|
+
package?: string;
|
|
243
|
+
arguments:
|
|
244
|
+
| SetVersionArguments
|
|
245
|
+
| [
|
|
246
|
+
_: RawTransactionArgument<string>,
|
|
247
|
+
haneulns: RawTransactionArgument<string>,
|
|
248
|
+
version: RawTransactionArgument<number>,
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* An admin helper to set the version of the shared object. Registrations are only
|
|
253
|
+
* possible if the latest version is being used.
|
|
254
|
+
*/
|
|
255
|
+
export function setVersion(options: SetVersionOptions) {
|
|
256
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
257
|
+
const argumentsTypes = [null, null, 'u8'] satisfies (string | null)[];
|
|
258
|
+
const parameterNames = ['_', 'haneulns', 'version'];
|
|
259
|
+
return (tx: Transaction) =>
|
|
260
|
+
tx.moveCall({
|
|
261
|
+
package: packageAddress,
|
|
262
|
+
module: 'coupon_house',
|
|
263
|
+
function: 'set_version',
|
|
264
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
export interface AssertVersionIsValidArguments {
|
|
268
|
+
self: RawTransactionArgument<string>;
|
|
269
|
+
}
|
|
270
|
+
export interface AssertVersionIsValidOptions {
|
|
271
|
+
package?: string;
|
|
272
|
+
arguments: AssertVersionIsValidArguments | [self: RawTransactionArgument<string>];
|
|
273
|
+
}
|
|
274
|
+
/** Validate that the version of the app is the latest. */
|
|
275
|
+
export function assertVersionIsValid(options: AssertVersionIsValidOptions) {
|
|
276
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
277
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
278
|
+
const parameterNames = ['self'];
|
|
279
|
+
return (tx: Transaction) =>
|
|
280
|
+
tx.moveCall({
|
|
281
|
+
package: packageAddress,
|
|
282
|
+
module: 'coupon_house',
|
|
283
|
+
function: 'assert_version_is_valid',
|
|
284
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
export interface AdminAddCouponArguments {
|
|
288
|
+
_: RawTransactionArgument<string>;
|
|
289
|
+
haneulns: RawTransactionArgument<string>;
|
|
290
|
+
code: RawTransactionArgument<string>;
|
|
291
|
+
kind: RawTransactionArgument<number>;
|
|
292
|
+
amount: RawTransactionArgument<number | bigint>;
|
|
293
|
+
rules: RawTransactionArgument<string>;
|
|
294
|
+
}
|
|
295
|
+
export interface AdminAddCouponOptions {
|
|
296
|
+
package?: string;
|
|
297
|
+
arguments:
|
|
298
|
+
| AdminAddCouponArguments
|
|
299
|
+
| [
|
|
300
|
+
_: RawTransactionArgument<string>,
|
|
301
|
+
haneulns: RawTransactionArgument<string>,
|
|
302
|
+
code: RawTransactionArgument<string>,
|
|
303
|
+
kind: RawTransactionArgument<number>,
|
|
304
|
+
amount: RawTransactionArgument<number | bigint>,
|
|
305
|
+
rules: RawTransactionArgument<string>,
|
|
306
|
+
];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* To create a coupon, you have to call the PTB in the specific order
|
|
310
|
+
*
|
|
311
|
+
* 1. (Optional) Call rules::new_domain_length_rule(type, length) // generate a
|
|
312
|
+
* length specific rule (e.g. only domains of size 5)
|
|
313
|
+
* 2. Call rules::coupon_rules(...) to create the coupon's ruleset.
|
|
314
|
+
*/
|
|
315
|
+
export function adminAddCoupon(options: AdminAddCouponOptions) {
|
|
316
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
317
|
+
const argumentsTypes = [null, null, '0x1::string::String', 'u8', 'u64', null] satisfies (
|
|
318
|
+
| string
|
|
319
|
+
| null
|
|
320
|
+
)[];
|
|
321
|
+
const parameterNames = ['_', 'haneulns', 'code', 'kind', 'amount', 'rules'];
|
|
322
|
+
return (tx: Transaction) =>
|
|
323
|
+
tx.moveCall({
|
|
324
|
+
package: packageAddress,
|
|
325
|
+
module: 'coupon_house',
|
|
326
|
+
function: 'admin_add_coupon',
|
|
327
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
export interface AdminRemoveCouponArguments {
|
|
331
|
+
_: RawTransactionArgument<string>;
|
|
332
|
+
haneulns: RawTransactionArgument<string>;
|
|
333
|
+
code: RawTransactionArgument<string>;
|
|
334
|
+
}
|
|
335
|
+
export interface AdminRemoveCouponOptions {
|
|
336
|
+
package?: string;
|
|
337
|
+
arguments:
|
|
338
|
+
| AdminRemoveCouponArguments
|
|
339
|
+
| [
|
|
340
|
+
_: RawTransactionArgument<string>,
|
|
341
|
+
haneulns: RawTransactionArgument<string>,
|
|
342
|
+
code: RawTransactionArgument<string>,
|
|
343
|
+
];
|
|
344
|
+
}
|
|
345
|
+
export function adminRemoveCoupon(options: AdminRemoveCouponOptions) {
|
|
346
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
347
|
+
const argumentsTypes = [null, null, '0x1::string::String'] satisfies (string | null)[];
|
|
348
|
+
const parameterNames = ['_', 'haneulns', 'code'];
|
|
349
|
+
return (tx: Transaction) =>
|
|
350
|
+
tx.moveCall({
|
|
351
|
+
package: packageAddress,
|
|
352
|
+
module: 'coupon_house',
|
|
353
|
+
function: 'admin_remove_coupon',
|
|
354
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
export interface AppAddCouponArguments {
|
|
358
|
+
data: RawTransactionArgument<string>;
|
|
359
|
+
code: RawTransactionArgument<string>;
|
|
360
|
+
kind: RawTransactionArgument<number>;
|
|
361
|
+
amount: RawTransactionArgument<number | bigint>;
|
|
362
|
+
rules: RawTransactionArgument<string>;
|
|
363
|
+
}
|
|
364
|
+
export interface AppAddCouponOptions {
|
|
365
|
+
package?: string;
|
|
366
|
+
arguments:
|
|
367
|
+
| AppAddCouponArguments
|
|
368
|
+
| [
|
|
369
|
+
data: RawTransactionArgument<string>,
|
|
370
|
+
code: RawTransactionArgument<string>,
|
|
371
|
+
kind: RawTransactionArgument<number>,
|
|
372
|
+
amount: RawTransactionArgument<number | bigint>,
|
|
373
|
+
rules: RawTransactionArgument<string>,
|
|
374
|
+
];
|
|
375
|
+
}
|
|
376
|
+
export function appAddCoupon(options: AppAddCouponOptions) {
|
|
377
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
378
|
+
const argumentsTypes = [null, '0x1::string::String', 'u8', 'u64', null] satisfies (
|
|
379
|
+
| string
|
|
380
|
+
| null
|
|
381
|
+
)[];
|
|
382
|
+
const parameterNames = ['data', 'code', 'kind', 'amount', 'rules'];
|
|
383
|
+
return (tx: Transaction) =>
|
|
384
|
+
tx.moveCall({
|
|
385
|
+
package: packageAddress,
|
|
386
|
+
module: 'coupon_house',
|
|
387
|
+
function: 'app_add_coupon',
|
|
388
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
export interface AppRemoveCouponArguments {
|
|
392
|
+
data: RawTransactionArgument<string>;
|
|
393
|
+
code: RawTransactionArgument<string>;
|
|
394
|
+
}
|
|
395
|
+
export interface AppRemoveCouponOptions {
|
|
396
|
+
package?: string;
|
|
397
|
+
arguments:
|
|
398
|
+
| AppRemoveCouponArguments
|
|
399
|
+
| [data: RawTransactionArgument<string>, code: RawTransactionArgument<string>];
|
|
400
|
+
}
|
|
401
|
+
export function appRemoveCoupon(options: AppRemoveCouponOptions) {
|
|
402
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
403
|
+
const argumentsTypes = [null, '0x1::string::String'] satisfies (string | null)[];
|
|
404
|
+
const parameterNames = ['data', 'code'];
|
|
405
|
+
return (tx: Transaction) =>
|
|
406
|
+
tx.moveCall({
|
|
407
|
+
package: packageAddress,
|
|
408
|
+
module: 'coupon_house',
|
|
409
|
+
function: 'app_remove_coupon',
|
|
410
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
411
|
+
});
|
|
412
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from '../utils/index.js';
|
|
5
|
+
import * as bag from './deps/haneul/bag.js';
|
|
6
|
+
const $moduleName = '@haneulns/coupons::data';
|
|
7
|
+
export const Data = new MoveStruct({
|
|
8
|
+
name: `${$moduleName}::Data`,
|
|
9
|
+
fields: {
|
|
10
|
+
coupons: bag.Bag,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A bag is a heterogeneous map-like collection. The collection is similar to
|
|
7
|
+
* `haneul::table` in that its keys and values are not stored within the `Bag` value,
|
|
8
|
+
* but instead are stored using Haneul's object system. The `Bag` struct acts only as
|
|
9
|
+
* a handle into the object system to retrieve those keys and values. Note that
|
|
10
|
+
* this means that `Bag` values with exactly the same key-value mapping will not be
|
|
11
|
+
* equal, with `==`, at runtime. For example
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* let bag1 = bag::new();
|
|
15
|
+
* let bag2 = bag::new();
|
|
16
|
+
* bag::add(&mut bag1, 0, false);
|
|
17
|
+
* bag::add(&mut bag1, 1, true);
|
|
18
|
+
* bag::add(&mut bag2, 0, false);
|
|
19
|
+
* bag::add(&mut bag2, 1, true);
|
|
20
|
+
* // bag1 does not equal bag2, despite having the same entries
|
|
21
|
+
* assert!(&bag1 != &bag2);
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* At it's core, `haneul::bag` is a wrapper around `UID` that allows for access to
|
|
25
|
+
* `haneul::dynamic_field` while preventing accidentally stranding field values. A
|
|
26
|
+
* `UID` can be deleted, even if it has dynamic fields associated with it, but a
|
|
27
|
+
* bag, on the other hand, must be empty to be destroyed.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
31
|
+
import { bcs } from '@haneullabs/haneul/bcs';
|
|
32
|
+
const $moduleName = '0x2::bag';
|
|
33
|
+
export const Bag = new MoveStruct({
|
|
34
|
+
name: `${$moduleName}::Bag`,
|
|
35
|
+
fields: {
|
|
36
|
+
/** the ID of this bag */
|
|
37
|
+
id: bcs.Address,
|
|
38
|
+
/** the number of key-value pairs in the bag */
|
|
39
|
+
size: bcs.u64(),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/** A module to introduce `range` checks for the rules. */
|
|
6
|
+
|
|
7
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
8
|
+
import { bcs } from '@haneullabs/haneul/bcs';
|
|
9
|
+
import { type Transaction } from '@haneullabs/haneul/transactions';
|
|
10
|
+
const $moduleName = '@haneulns/coupons::range';
|
|
11
|
+
export const Range = new MoveStruct({
|
|
12
|
+
name: `${$moduleName}::Range`,
|
|
13
|
+
fields: {
|
|
14
|
+
vec: bcs.vector(bcs.u8()),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export interface NewArguments {
|
|
18
|
+
from: RawTransactionArgument<number>;
|
|
19
|
+
to: RawTransactionArgument<number>;
|
|
20
|
+
}
|
|
21
|
+
export interface NewOptions {
|
|
22
|
+
package?: string;
|
|
23
|
+
arguments:
|
|
24
|
+
| NewArguments
|
|
25
|
+
| [from: RawTransactionArgument<number>, to: RawTransactionArgument<number>];
|
|
26
|
+
}
|
|
27
|
+
/** a new Range constructor[from, to] */
|
|
28
|
+
export function _new(options: NewOptions) {
|
|
29
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
30
|
+
const argumentsTypes = ['u8', 'u8'] satisfies (string | null)[];
|
|
31
|
+
const parameterNames = ['from', 'to'];
|
|
32
|
+
return (tx: Transaction) =>
|
|
33
|
+
tx.moveCall({
|
|
34
|
+
package: packageAddress,
|
|
35
|
+
module: 'range',
|
|
36
|
+
function: 'new',
|
|
37
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export interface IsInRangeArguments {
|
|
41
|
+
range: RawTransactionArgument<string>;
|
|
42
|
+
number: RawTransactionArgument<number>;
|
|
43
|
+
}
|
|
44
|
+
export interface IsInRangeOptions {
|
|
45
|
+
package?: string;
|
|
46
|
+
arguments:
|
|
47
|
+
| IsInRangeArguments
|
|
48
|
+
| [range: RawTransactionArgument<string>, number: RawTransactionArgument<number>];
|
|
49
|
+
}
|
|
50
|
+
export function isInRange(options: IsInRangeOptions) {
|
|
51
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
52
|
+
const argumentsTypes = [null, 'u8'] satisfies (string | null)[];
|
|
53
|
+
const parameterNames = ['range', 'number'];
|
|
54
|
+
return (tx: Transaction) =>
|
|
55
|
+
tx.moveCall({
|
|
56
|
+
package: packageAddress,
|
|
57
|
+
module: 'range',
|
|
58
|
+
function: 'is_in_range',
|
|
59
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export interface FromArguments {
|
|
63
|
+
range: RawTransactionArgument<string>;
|
|
64
|
+
}
|
|
65
|
+
export interface FromOptions {
|
|
66
|
+
package?: string;
|
|
67
|
+
arguments: FromArguments | [range: RawTransactionArgument<string>];
|
|
68
|
+
}
|
|
69
|
+
/** Get floor limit for the range. */
|
|
70
|
+
export function _from(options: FromOptions) {
|
|
71
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
72
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
73
|
+
const parameterNames = ['range'];
|
|
74
|
+
return (tx: Transaction) =>
|
|
75
|
+
tx.moveCall({
|
|
76
|
+
package: packageAddress,
|
|
77
|
+
module: 'range',
|
|
78
|
+
function: 'from',
|
|
79
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export interface ToArguments {
|
|
83
|
+
range: RawTransactionArgument<string>;
|
|
84
|
+
}
|
|
85
|
+
export interface ToOptions {
|
|
86
|
+
package?: string;
|
|
87
|
+
arguments: ToArguments | [range: RawTransactionArgument<string>];
|
|
88
|
+
}
|
|
89
|
+
/** Get upper limit for the range. */
|
|
90
|
+
export function to(options: ToOptions) {
|
|
91
|
+
const packageAddress = options.package ?? '@haneulns/coupons';
|
|
92
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
93
|
+
const parameterNames = ['range'];
|
|
94
|
+
return (tx: Transaction) =>
|
|
95
|
+
tx.moveCall({
|
|
96
|
+
package: packageAddress,
|
|
97
|
+
module: 'range',
|
|
98
|
+
function: 'to',
|
|
99
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
100
|
+
});
|
|
101
|
+
}
|