@haneullabs/haneulns 1.0.3 → 1.2.5
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 +108 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +20 -20
- package/dist/constants.mjs.map +1 -1
- package/dist/contracts/haneulns/controller.mjs +11 -4
- package/dist/contracts/haneulns/controller.mjs.map +1 -1
- package/dist/contracts/haneulns/deps/haneul/balance.mjs +2 -13
- package/dist/contracts/haneulns/deps/haneul/balance.mjs.map +1 -1
- package/dist/contracts/haneulns/deps/haneul/vec_map.mjs +1 -2
- package/dist/contracts/haneulns/deps/haneul/vec_map.mjs.map +1 -1
- package/dist/contracts/haneulns/deps/std/type_name.mjs +13 -10
- package/dist/contracts/haneulns/deps/std/type_name.mjs.map +1 -1
- package/dist/contracts/haneulns/domain.mjs +11 -16
- package/dist/contracts/haneulns/domain.mjs.map +1 -1
- package/dist/contracts/haneulns/haneulns.mjs +11 -8
- package/dist/contracts/haneulns/haneulns.mjs.map +1 -1
- package/dist/contracts/haneulns/name_record.mjs +14 -13
- package/dist/contracts/haneulns/name_record.mjs.map +1 -1
- package/dist/contracts/haneulns/payment.mjs +16 -17
- package/dist/contracts/haneulns/payment.mjs.map +1 -1
- package/dist/contracts/haneulns/pricing_config.mjs +1 -2
- package/dist/contracts/haneulns/pricing_config.mjs.map +1 -1
- package/dist/contracts/haneulns_coupons/coupon_house.mjs +4 -5
- package/dist/contracts/haneulns_coupons/coupon_house.mjs.map +1 -1
- package/dist/contracts/haneulns_coupons/data.mjs +2 -8
- package/dist/contracts/haneulns_coupons/data.mjs.map +1 -1
- package/dist/contracts/haneulns_coupons/deps/haneul/bag.mjs +4 -32
- package/dist/contracts/haneulns_coupons/deps/haneul/bag.mjs.map +1 -1
- package/dist/contracts/haneulns_discounts/deps/haneul/linked_table.mjs +5 -2
- package/dist/contracts/haneulns_discounts/deps/haneul/linked_table.mjs.map +1 -1
- package/dist/contracts/haneulns_discounts/deps/haneulns/pricing_config.mjs +2 -8
- package/dist/contracts/haneulns_discounts/deps/haneulns/pricing_config.mjs.map +1 -1
- package/dist/contracts/haneulns_discounts/discounts.mjs +3 -4
- package/dist/contracts/haneulns_discounts/discounts.mjs.map +1 -1
- package/dist/contracts/haneulns_discounts/free_claims.mjs +4 -5
- package/dist/contracts/haneulns_discounts/free_claims.mjs.map +1 -1
- package/dist/contracts/haneulns_payments/deps/haneul/vec_map.mjs +1 -2
- package/dist/contracts/haneulns_payments/deps/haneul/vec_map.mjs.map +1 -1
- package/dist/contracts/haneulns_payments/deps/std/type_name.mjs +13 -10
- package/dist/contracts/haneulns_payments/deps/std/type_name.mjs.map +1 -1
- package/dist/contracts/haneulns_payments/payments.mjs +4 -3
- package/dist/contracts/haneulns_payments/payments.mjs.map +1 -1
- package/dist/contracts/pyth/data_source.mjs +2 -8
- package/dist/contracts/pyth/data_source.mjs.map +1 -1
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +2 -8
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -1
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +2 -8
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -1
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs +2 -8
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs.map +1 -1
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs +2 -8
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs.map +1 -1
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs +2 -8
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs.map +1 -1
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs +2 -8
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs.map +1 -1
- package/dist/contracts/pyth/state.mjs +2 -8
- package/dist/contracts/pyth/state.mjs.map +1 -1
- package/dist/contracts/utils/index.mjs +97 -12
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/contracts/wormhole/bytes32.mjs +2 -8
- package/dist/contracts/wormhole/bytes32.mjs.map +1 -1
- package/dist/contracts/wormhole/consumed_vaas.mjs +2 -8
- package/dist/contracts/wormhole/consumed_vaas.mjs.map +1 -1
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs +2 -8
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs.map +1 -1
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +2 -8
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -1
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +2 -8
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -1
- package/dist/contracts/wormhole/external_address.mjs +2 -8
- package/dist/contracts/wormhole/external_address.mjs.map +1 -1
- package/dist/contracts/wormhole/fee_collector.mjs +2 -8
- package/dist/contracts/wormhole/fee_collector.mjs.map +1 -1
- package/dist/contracts/wormhole/set.mjs +2 -8
- package/dist/contracts/wormhole/set.mjs.map +1 -1
- package/dist/contracts/wormhole/state.mjs +2 -8
- package/dist/contracts/wormhole/state.mjs.map +1 -1
- package/dist/haneulns-client.d.mts.map +1 -1
- package/dist/haneulns-client.mjs +1 -2
- package/dist/haneulns-client.mjs.map +1 -1
- package/dist/haneulns-transaction.d.mts +1 -2
- package/dist/haneulns-transaction.d.mts.map +1 -1
- package/dist/haneulns-transaction.mjs +1 -2
- package/dist/haneulns-transaction.mjs.map +1 -1
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +1 -2
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/pyth/PriceServiceConnection.mjs +1 -2
- package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
- package/dist/pyth/pyth-helpers.mjs +1 -1
- package/dist/pyth/pyth-helpers.mjs.map +1 -1
- package/dist/pyth/pyth.mjs +8 -6
- package/dist/pyth/pyth.mjs.map +1 -1
- package/dist/types.d.mts.map +1 -1
- package/package.json +8 -9
- package/src/constants.ts +19 -19
- package/src/contracts/haneulns/admin.ts +2 -2
- package/src/contracts/haneulns/config.ts +18 -18
- package/src/contracts/haneulns/controller.ts +95 -1
- package/src/contracts/haneulns/core_config.ts +19 -19
- package/src/contracts/haneulns/domain.ts +18 -20
- package/src/contracts/haneulns/haneulns.ts +5 -5
- package/src/contracts/haneulns/name_record.ts +22 -27
- package/src/contracts/haneulns/payment.ts +23 -23
- package/src/contracts/haneulns/pricing_config.ts +16 -16
- package/src/contracts/haneulns/registry.ts +53 -67
- package/src/contracts/haneulns_coupons/coupon_house.ts +13 -13
- package/src/contracts/haneulns_coupons/range.ts +7 -7
- package/src/contracts/haneulns_coupons/rules.ts +27 -27
- package/src/contracts/haneulns_discounts/discounts.ts +7 -7
- package/src/contracts/haneulns_discounts/free_claims.ts +7 -7
- package/src/contracts/haneulns_payments/payments.ts +13 -13
- package/src/contracts/utils/index.ts +185 -24
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
12
12
|
import { bcs } from '@haneullabs/haneul/bcs';
|
|
13
|
-
import { type Transaction } from '@haneullabs/haneul/transactions';
|
|
13
|
+
import { type Transaction, type TransactionArgument } from '@haneullabs/haneul/transactions';
|
|
14
14
|
import * as vec_map from './deps/haneul/vec_map.js';
|
|
15
15
|
const $moduleName = '@haneulns/core::name_record';
|
|
16
16
|
export const NameRecord = new MoveStruct({
|
|
@@ -90,14 +90,12 @@ export function newLeaf(options: NewLeafOptions) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
export interface SetDataArguments {
|
|
93
|
-
self:
|
|
94
|
-
data:
|
|
93
|
+
self: TransactionArgument;
|
|
94
|
+
data: TransactionArgument;
|
|
95
95
|
}
|
|
96
96
|
export interface SetDataOptions {
|
|
97
97
|
package?: string;
|
|
98
|
-
arguments:
|
|
99
|
-
| SetDataArguments
|
|
100
|
-
| [self: RawTransactionArgument<string>, data: RawTransactionArgument<string>];
|
|
98
|
+
arguments: SetDataArguments | [self: TransactionArgument, data: TransactionArgument];
|
|
101
99
|
}
|
|
102
100
|
/**
|
|
103
101
|
* Set data as a vec_map directly overriding the data set in the registration self.
|
|
@@ -126,14 +124,14 @@ export function setData(options: SetDataOptions) {
|
|
|
126
124
|
});
|
|
127
125
|
}
|
|
128
126
|
export interface SetTargetAddressArguments {
|
|
129
|
-
self:
|
|
127
|
+
self: TransactionArgument;
|
|
130
128
|
newAddress: RawTransactionArgument<string | null>;
|
|
131
129
|
}
|
|
132
130
|
export interface SetTargetAddressOptions {
|
|
133
131
|
package?: string;
|
|
134
132
|
arguments:
|
|
135
133
|
| SetTargetAddressArguments
|
|
136
|
-
| [self:
|
|
134
|
+
| [self: TransactionArgument, newAddress: RawTransactionArgument<string | null>];
|
|
137
135
|
}
|
|
138
136
|
/** Set the `target_address` field of the `NameRecord`. */
|
|
139
137
|
export function setTargetAddress(options: SetTargetAddressOptions) {
|
|
@@ -149,17 +147,14 @@ export function setTargetAddress(options: SetTargetAddressOptions) {
|
|
|
149
147
|
});
|
|
150
148
|
}
|
|
151
149
|
export interface SetExpirationTimestampMsArguments {
|
|
152
|
-
self:
|
|
150
|
+
self: TransactionArgument;
|
|
153
151
|
expirationTimestampMs: RawTransactionArgument<number | bigint>;
|
|
154
152
|
}
|
|
155
153
|
export interface SetExpirationTimestampMsOptions {
|
|
156
154
|
package?: string;
|
|
157
155
|
arguments:
|
|
158
156
|
| SetExpirationTimestampMsArguments
|
|
159
|
-
| [
|
|
160
|
-
self: RawTransactionArgument<string>,
|
|
161
|
-
expirationTimestampMs: RawTransactionArgument<number | bigint>,
|
|
162
|
-
];
|
|
157
|
+
| [self: TransactionArgument, expirationTimestampMs: RawTransactionArgument<number | bigint>];
|
|
163
158
|
}
|
|
164
159
|
export function setExpirationTimestampMs(options: SetExpirationTimestampMsOptions) {
|
|
165
160
|
const packageAddress = options.package ?? '@haneulns/core';
|
|
@@ -174,11 +169,11 @@ export function setExpirationTimestampMs(options: SetExpirationTimestampMsOption
|
|
|
174
169
|
});
|
|
175
170
|
}
|
|
176
171
|
export interface HasExpiredArguments {
|
|
177
|
-
self:
|
|
172
|
+
self: TransactionArgument;
|
|
178
173
|
}
|
|
179
174
|
export interface HasExpiredOptions {
|
|
180
175
|
package?: string;
|
|
181
|
-
arguments: HasExpiredArguments | [self:
|
|
176
|
+
arguments: HasExpiredArguments | [self: TransactionArgument];
|
|
182
177
|
}
|
|
183
178
|
/** Check if the record has expired. */
|
|
184
179
|
export function hasExpired(options: HasExpiredOptions) {
|
|
@@ -194,11 +189,11 @@ export function hasExpired(options: HasExpiredOptions) {
|
|
|
194
189
|
});
|
|
195
190
|
}
|
|
196
191
|
export interface HasExpiredPastGracePeriodArguments {
|
|
197
|
-
self:
|
|
192
|
+
self: TransactionArgument;
|
|
198
193
|
}
|
|
199
194
|
export interface HasExpiredPastGracePeriodOptions {
|
|
200
195
|
package?: string;
|
|
201
|
-
arguments: HasExpiredPastGracePeriodArguments | [self:
|
|
196
|
+
arguments: HasExpiredPastGracePeriodArguments | [self: TransactionArgument];
|
|
202
197
|
}
|
|
203
198
|
/** Check if the record has expired, taking into account the grace period. */
|
|
204
199
|
export function hasExpiredPastGracePeriod(options: HasExpiredPastGracePeriodOptions) {
|
|
@@ -214,11 +209,11 @@ export function hasExpiredPastGracePeriod(options: HasExpiredPastGracePeriodOpti
|
|
|
214
209
|
});
|
|
215
210
|
}
|
|
216
211
|
export interface IsLeafRecordArguments {
|
|
217
|
-
self:
|
|
212
|
+
self: TransactionArgument;
|
|
218
213
|
}
|
|
219
214
|
export interface IsLeafRecordOptions {
|
|
220
215
|
package?: string;
|
|
221
|
-
arguments: IsLeafRecordArguments | [self:
|
|
216
|
+
arguments: IsLeafRecordArguments | [self: TransactionArgument];
|
|
222
217
|
}
|
|
223
218
|
/** Checks whether a name_record is a `leaf` record. */
|
|
224
219
|
export function isLeafRecord(options: IsLeafRecordOptions) {
|
|
@@ -234,11 +229,11 @@ export function isLeafRecord(options: IsLeafRecordOptions) {
|
|
|
234
229
|
});
|
|
235
230
|
}
|
|
236
231
|
export interface DataArguments {
|
|
237
|
-
self:
|
|
232
|
+
self: TransactionArgument;
|
|
238
233
|
}
|
|
239
234
|
export interface DataOptions {
|
|
240
235
|
package?: string;
|
|
241
|
-
arguments: DataArguments | [self:
|
|
236
|
+
arguments: DataArguments | [self: TransactionArgument];
|
|
242
237
|
}
|
|
243
238
|
/** Read the `data` field from the `NameRecord`. */
|
|
244
239
|
export function data(options: DataOptions) {
|
|
@@ -254,11 +249,11 @@ export function data(options: DataOptions) {
|
|
|
254
249
|
});
|
|
255
250
|
}
|
|
256
251
|
export interface TargetAddressArguments {
|
|
257
|
-
self:
|
|
252
|
+
self: TransactionArgument;
|
|
258
253
|
}
|
|
259
254
|
export interface TargetAddressOptions {
|
|
260
255
|
package?: string;
|
|
261
|
-
arguments: TargetAddressArguments | [self:
|
|
256
|
+
arguments: TargetAddressArguments | [self: TransactionArgument];
|
|
262
257
|
}
|
|
263
258
|
/** Read the `target_address` field from the `NameRecord`. */
|
|
264
259
|
export function targetAddress(options: TargetAddressOptions) {
|
|
@@ -274,11 +269,11 @@ export function targetAddress(options: TargetAddressOptions) {
|
|
|
274
269
|
});
|
|
275
270
|
}
|
|
276
271
|
export interface NftIdArguments {
|
|
277
|
-
self:
|
|
272
|
+
self: TransactionArgument;
|
|
278
273
|
}
|
|
279
274
|
export interface NftIdOptions {
|
|
280
275
|
package?: string;
|
|
281
|
-
arguments: NftIdArguments | [self:
|
|
276
|
+
arguments: NftIdArguments | [self: TransactionArgument];
|
|
282
277
|
}
|
|
283
278
|
/** Read the `nft_id` field from the `NameRecord`. */
|
|
284
279
|
export function nftId(options: NftIdOptions) {
|
|
@@ -294,11 +289,11 @@ export function nftId(options: NftIdOptions) {
|
|
|
294
289
|
});
|
|
295
290
|
}
|
|
296
291
|
export interface ExpirationTimestampMsArguments {
|
|
297
|
-
self:
|
|
292
|
+
self: TransactionArgument;
|
|
298
293
|
}
|
|
299
294
|
export interface ExpirationTimestampMsOptions {
|
|
300
295
|
package?: string;
|
|
301
|
-
arguments: ExpirationTimestampMsArguments | [self:
|
|
296
|
+
arguments: ExpirationTimestampMsArguments | [self: TransactionArgument];
|
|
302
297
|
}
|
|
303
298
|
/** Read the `expiration_timestamp_ms` field from the `NameRecord`. */
|
|
304
299
|
export function expirationTimestampMs(options: ExpirationTimestampMsOptions) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type RawTransactionArgument,
|
|
9
9
|
} from '../utils/index.js';
|
|
10
10
|
import { bcs, type BcsType } from '@haneullabs/haneul/bcs';
|
|
11
|
-
import { type Transaction } from '@haneullabs/haneul/transactions';
|
|
11
|
+
import { type Transaction, type TransactionArgument } from '@haneullabs/haneul/transactions';
|
|
12
12
|
import * as domain_1 from './domain.js';
|
|
13
13
|
import * as vec_map from './deps/haneul/vec_map.js';
|
|
14
14
|
import * as type_name from './deps/std/type_name.js';
|
|
@@ -92,7 +92,7 @@ export const Receipt = new MoveEnum({
|
|
|
92
92
|
},
|
|
93
93
|
});
|
|
94
94
|
export interface ApplyPercentageDiscountArguments<A extends BcsType<any>> {
|
|
95
|
-
intent:
|
|
95
|
+
intent: TransactionArgument;
|
|
96
96
|
haneulns: RawTransactionArgument<string>;
|
|
97
97
|
_: RawTransactionArgument<A>;
|
|
98
98
|
discountKey: RawTransactionArgument<string>;
|
|
@@ -104,7 +104,7 @@ export interface ApplyPercentageDiscountOptions<A extends BcsType<any>> {
|
|
|
104
104
|
arguments:
|
|
105
105
|
| ApplyPercentageDiscountArguments<A>
|
|
106
106
|
| [
|
|
107
|
-
intent:
|
|
107
|
+
intent: TransactionArgument,
|
|
108
108
|
haneulns: RawTransactionArgument<string>,
|
|
109
109
|
_: RawTransactionArgument<A>,
|
|
110
110
|
discountKey: RawTransactionArgument<string>,
|
|
@@ -148,7 +148,7 @@ export function applyPercentageDiscount<A extends BcsType<any>>(
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
export interface FinalizePaymentArguments<A extends BcsType<any>> {
|
|
151
|
-
intent:
|
|
151
|
+
intent: TransactionArgument;
|
|
152
152
|
haneulns: RawTransactionArgument<string>;
|
|
153
153
|
app: RawTransactionArgument<A>;
|
|
154
154
|
coin: RawTransactionArgument<string>;
|
|
@@ -158,7 +158,7 @@ export interface FinalizePaymentOptions<A extends BcsType<any>> {
|
|
|
158
158
|
arguments:
|
|
159
159
|
| FinalizePaymentArguments<A>
|
|
160
160
|
| [
|
|
161
|
-
intent:
|
|
161
|
+
intent: TransactionArgument,
|
|
162
162
|
haneulns: RawTransactionArgument<string>,
|
|
163
163
|
app: RawTransactionArgument<A>,
|
|
164
164
|
coin: RawTransactionArgument<string>,
|
|
@@ -246,14 +246,14 @@ export function initRenewal(options: InitRenewalOptions) {
|
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
export interface RegisterArguments {
|
|
249
|
-
receipt:
|
|
249
|
+
receipt: TransactionArgument;
|
|
250
250
|
haneulns: RawTransactionArgument<string>;
|
|
251
251
|
}
|
|
252
252
|
export interface RegisterOptions {
|
|
253
253
|
package?: string;
|
|
254
254
|
arguments:
|
|
255
255
|
| RegisterArguments
|
|
256
|
-
| [receipt:
|
|
256
|
+
| [receipt: TransactionArgument, haneulns: RawTransactionArgument<string>];
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
259
|
* Register a domain with the given receipt. This is a hot-potato and can only be
|
|
@@ -272,7 +272,7 @@ export function register(options: RegisterOptions) {
|
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
274
|
export interface RenewArguments {
|
|
275
|
-
receipt:
|
|
275
|
+
receipt: TransactionArgument;
|
|
276
276
|
haneulns: RawTransactionArgument<string>;
|
|
277
277
|
nft: RawTransactionArgument<string>;
|
|
278
278
|
}
|
|
@@ -281,7 +281,7 @@ export interface RenewOptions {
|
|
|
281
281
|
arguments:
|
|
282
282
|
| RenewArguments
|
|
283
283
|
| [
|
|
284
|
-
receipt:
|
|
284
|
+
receipt: TransactionArgument,
|
|
285
285
|
haneulns: RawTransactionArgument<string>,
|
|
286
286
|
nft: RawTransactionArgument<string>,
|
|
287
287
|
];
|
|
@@ -303,11 +303,11 @@ export function renew(options: RenewOptions) {
|
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
305
|
export interface RequestDataArguments {
|
|
306
|
-
intent:
|
|
306
|
+
intent: TransactionArgument;
|
|
307
307
|
}
|
|
308
308
|
export interface RequestDataOptions {
|
|
309
309
|
package?: string;
|
|
310
|
-
arguments: RequestDataArguments | [intent:
|
|
310
|
+
arguments: RequestDataArguments | [intent: TransactionArgument];
|
|
311
311
|
}
|
|
312
312
|
/** Getters */
|
|
313
313
|
export function requestData(options: RequestDataOptions) {
|
|
@@ -323,11 +323,11 @@ export function requestData(options: RequestDataOptions) {
|
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
export interface YearsArguments {
|
|
326
|
-
self:
|
|
326
|
+
self: TransactionArgument;
|
|
327
327
|
}
|
|
328
328
|
export interface YearsOptions {
|
|
329
329
|
package?: string;
|
|
330
|
-
arguments: YearsArguments | [self:
|
|
330
|
+
arguments: YearsArguments | [self: TransactionArgument];
|
|
331
331
|
}
|
|
332
332
|
export function years(options: YearsOptions) {
|
|
333
333
|
const packageAddress = options.package ?? '@haneulns/core';
|
|
@@ -342,11 +342,11 @@ export function years(options: YearsOptions) {
|
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
344
|
export interface BaseAmountArguments {
|
|
345
|
-
self:
|
|
345
|
+
self: TransactionArgument;
|
|
346
346
|
}
|
|
347
347
|
export interface BaseAmountOptions {
|
|
348
348
|
package?: string;
|
|
349
|
-
arguments: BaseAmountArguments | [self:
|
|
349
|
+
arguments: BaseAmountArguments | [self: TransactionArgument];
|
|
350
350
|
}
|
|
351
351
|
export function baseAmount(options: BaseAmountOptions) {
|
|
352
352
|
const packageAddress = options.package ?? '@haneulns/core';
|
|
@@ -361,11 +361,11 @@ export function baseAmount(options: BaseAmountOptions) {
|
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
363
|
export interface DomainArguments {
|
|
364
|
-
self:
|
|
364
|
+
self: TransactionArgument;
|
|
365
365
|
}
|
|
366
366
|
export interface DomainOptions {
|
|
367
367
|
package?: string;
|
|
368
|
-
arguments: DomainArguments | [self:
|
|
368
|
+
arguments: DomainArguments | [self: TransactionArgument];
|
|
369
369
|
}
|
|
370
370
|
export function domain(options: DomainOptions) {
|
|
371
371
|
const packageAddress = options.package ?? '@haneulns/core';
|
|
@@ -380,11 +380,11 @@ export function domain(options: DomainOptions) {
|
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
382
|
export interface DiscountAppliedArguments {
|
|
383
|
-
self:
|
|
383
|
+
self: TransactionArgument;
|
|
384
384
|
}
|
|
385
385
|
export interface DiscountAppliedOptions {
|
|
386
386
|
package?: string;
|
|
387
|
-
arguments: DiscountAppliedArguments | [self:
|
|
387
|
+
arguments: DiscountAppliedArguments | [self: TransactionArgument];
|
|
388
388
|
}
|
|
389
389
|
/** Returns true if at least one discount has been applied to the payment intent. */
|
|
390
390
|
export function discountApplied(options: DiscountAppliedOptions) {
|
|
@@ -400,11 +400,11 @@ export function discountApplied(options: DiscountAppliedOptions) {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
export interface DiscountsAppliedArguments {
|
|
403
|
-
self:
|
|
403
|
+
self: TransactionArgument;
|
|
404
404
|
}
|
|
405
405
|
export interface DiscountsAppliedOptions {
|
|
406
406
|
package?: string;
|
|
407
|
-
arguments: DiscountsAppliedArguments | [self:
|
|
407
|
+
arguments: DiscountsAppliedArguments | [self: TransactionArgument];
|
|
408
408
|
}
|
|
409
409
|
/** A list of discounts that have been applied to the payment intent. */
|
|
410
410
|
export function discountsApplied(options: DiscountsAppliedOptions) {
|
|
@@ -420,14 +420,14 @@ export function discountsApplied(options: DiscountsAppliedOptions) {
|
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
422
|
export interface CalculateTotalAfterDiscountArguments {
|
|
423
|
-
data:
|
|
423
|
+
data: TransactionArgument;
|
|
424
424
|
discount: RawTransactionArgument<number>;
|
|
425
425
|
}
|
|
426
426
|
export interface CalculateTotalAfterDiscountOptions {
|
|
427
427
|
package?: string;
|
|
428
428
|
arguments:
|
|
429
429
|
| CalculateTotalAfterDiscountArguments
|
|
430
|
-
| [data:
|
|
430
|
+
| [data: TransactionArgument, discount: RawTransactionArgument<number>];
|
|
431
431
|
}
|
|
432
432
|
/** Public helper to calculate price after a percentage discount has been applied. */
|
|
433
433
|
export function calculateTotalAfterDiscount(options: CalculateTotalAfterDiscountOptions) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type RawTransactionArgument,
|
|
9
9
|
} from '../utils/index.js';
|
|
10
10
|
import { bcs } from '@haneullabs/haneul/bcs';
|
|
11
|
-
import { type Transaction } from '@haneullabs/haneul/transactions';
|
|
11
|
+
import { type Transaction, type TransactionArgument } from '@haneullabs/haneul/transactions';
|
|
12
12
|
import * as vec_map from './deps/haneul/vec_map.js';
|
|
13
13
|
const $moduleName = '@haneulns/core::pricing_config';
|
|
14
14
|
export const Range = new MoveTuple({
|
|
@@ -28,14 +28,14 @@ export const RenewalConfig = new MoveStruct({
|
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
30
|
export interface CalculateBasePriceArguments {
|
|
31
|
-
config:
|
|
31
|
+
config: TransactionArgument;
|
|
32
32
|
length: RawTransactionArgument<number | bigint>;
|
|
33
33
|
}
|
|
34
34
|
export interface CalculateBasePriceOptions {
|
|
35
35
|
package?: string;
|
|
36
36
|
arguments:
|
|
37
37
|
| CalculateBasePriceArguments
|
|
38
|
-
| [config:
|
|
38
|
+
| [config: TransactionArgument, length: RawTransactionArgument<number | bigint>];
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Calculates the base price for a given length.
|
|
@@ -58,14 +58,14 @@ export function calculateBasePrice(options: CalculateBasePriceOptions) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
export interface NewArguments {
|
|
61
|
-
ranges:
|
|
62
|
-
prices: RawTransactionArgument<number | bigint
|
|
61
|
+
ranges: TransactionArgument;
|
|
62
|
+
prices: RawTransactionArgument<Array<number | bigint>>;
|
|
63
63
|
}
|
|
64
64
|
export interface NewOptions {
|
|
65
65
|
package?: string;
|
|
66
66
|
arguments:
|
|
67
67
|
| NewArguments
|
|
68
|
-
| [ranges:
|
|
68
|
+
| [ranges: TransactionArgument, prices: RawTransactionArgument<Array<number | bigint>>];
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Creates a new PricingConfig with the given ranges and prices.
|
|
@@ -88,14 +88,14 @@ export function _new(options: NewOptions) {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
export interface IsBetweenInclusiveArguments {
|
|
91
|
-
range:
|
|
91
|
+
range: TransactionArgument;
|
|
92
92
|
length: RawTransactionArgument<number | bigint>;
|
|
93
93
|
}
|
|
94
94
|
export interface IsBetweenInclusiveOptions {
|
|
95
95
|
package?: string;
|
|
96
96
|
arguments:
|
|
97
97
|
| IsBetweenInclusiveArguments
|
|
98
|
-
| [range:
|
|
98
|
+
| [range: TransactionArgument, length: RawTransactionArgument<number | bigint>];
|
|
99
99
|
}
|
|
100
100
|
/** Checks if the value is between the range (inclusive). */
|
|
101
101
|
export function isBetweenInclusive(options: IsBetweenInclusiveOptions) {
|
|
@@ -111,11 +111,11 @@ export function isBetweenInclusive(options: IsBetweenInclusiveOptions) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
export interface PricingArguments {
|
|
114
|
-
config:
|
|
114
|
+
config: TransactionArgument;
|
|
115
115
|
}
|
|
116
116
|
export interface PricingOptions {
|
|
117
117
|
package?: string;
|
|
118
|
-
arguments: PricingArguments | [config:
|
|
118
|
+
arguments: PricingArguments | [config: TransactionArgument];
|
|
119
119
|
}
|
|
120
120
|
/** Returns the pricing config for usage in external apps. */
|
|
121
121
|
export function pricing(options: PricingOptions) {
|
|
@@ -131,11 +131,11 @@ export function pricing(options: PricingOptions) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
export interface NewRenewalConfigArguments {
|
|
134
|
-
config:
|
|
134
|
+
config: TransactionArgument;
|
|
135
135
|
}
|
|
136
136
|
export interface NewRenewalConfigOptions {
|
|
137
137
|
package?: string;
|
|
138
|
-
arguments: NewRenewalConfigArguments | [config:
|
|
138
|
+
arguments: NewRenewalConfigArguments | [config: TransactionArgument];
|
|
139
139
|
}
|
|
140
140
|
/** Constructor for Renewal<T> that initializes it with a PricingConfig. */
|
|
141
141
|
export function newRenewalConfig(options: NewRenewalConfigOptions) {
|
|
@@ -151,11 +151,11 @@ export function newRenewalConfig(options: NewRenewalConfigOptions) {
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
export interface NewRangeArguments {
|
|
154
|
-
range: RawTransactionArgument<number | bigint
|
|
154
|
+
range: RawTransactionArgument<Array<number | bigint>>;
|
|
155
155
|
}
|
|
156
156
|
export interface NewRangeOptions {
|
|
157
157
|
package?: string;
|
|
158
|
-
arguments: NewRangeArguments | [range: RawTransactionArgument<number | bigint
|
|
158
|
+
arguments: NewRangeArguments | [range: RawTransactionArgument<Array<number | bigint>>];
|
|
159
159
|
}
|
|
160
160
|
export function newRange(options: NewRangeOptions) {
|
|
161
161
|
const packageAddress = options.package ?? '@haneulns/core';
|
|
@@ -170,11 +170,11 @@ export function newRange(options: NewRangeOptions) {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
export interface ConfigArguments {
|
|
173
|
-
renewal:
|
|
173
|
+
renewal: TransactionArgument;
|
|
174
174
|
}
|
|
175
175
|
export interface ConfigOptions {
|
|
176
176
|
package?: string;
|
|
177
|
-
arguments: ConfigArguments | [renewal:
|
|
177
|
+
arguments: ConfigArguments | [renewal: TransactionArgument];
|
|
178
178
|
}
|
|
179
179
|
export function config(options: ConfigOptions) {
|
|
180
180
|
const packageAddress = options.package ?? '@haneulns/core';
|