@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
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bcs,
|
|
3
|
-
BcsType,
|
|
4
|
-
TypeTag,
|
|
3
|
+
type BcsType,
|
|
4
|
+
type TypeTag,
|
|
5
5
|
TypeTagSerializer,
|
|
6
6
|
BcsStruct,
|
|
7
7
|
BcsEnum,
|
|
8
8
|
BcsTuple,
|
|
9
9
|
} from '@haneullabs/haneul/bcs';
|
|
10
|
-
import { normalizeHaneulAddress } from '@haneullabs/haneul/utils';
|
|
11
|
-
import { TransactionArgument, isArgument } from '@haneullabs/haneul/transactions';
|
|
12
|
-
import { ClientWithCoreApi, HaneulClientTypes } from '@haneullabs/haneul/client';
|
|
10
|
+
import { normalizeStructTag, normalizeHaneulAddress } from '@haneullabs/haneul/utils';
|
|
11
|
+
import { type TransactionArgument, isArgument } from '@haneullabs/haneul/transactions';
|
|
12
|
+
import { type ClientWithCoreApi, type HaneulClientTypes } from '@haneullabs/haneul/client';
|
|
13
13
|
|
|
14
14
|
const MOVE_STDLIB_ADDRESS = normalizeHaneulAddress('0x1');
|
|
15
15
|
const HANEUL_FRAMEWORK_ADDRESS = normalizeHaneulAddress('0x2');
|
|
16
16
|
|
|
17
17
|
export type RawTransactionArgument<T> = T | TransactionArgument;
|
|
18
18
|
|
|
19
|
-
export
|
|
20
|
-
Include
|
|
21
|
-
> extends HaneulClientTypes.GetObjectOptions<Include> {
|
|
22
|
-
client: ClientWithCoreApi;
|
|
23
|
-
}
|
|
19
|
+
export type GetOptions<Include extends Omit<HaneulClientTypes.ObjectInclude, 'content'> = {}> =
|
|
20
|
+
HaneulClientTypes.GetObjectOptions<Include> & { client: ClientWithCoreApi };
|
|
24
21
|
|
|
25
|
-
export
|
|
26
|
-
Include
|
|
27
|
-
> extends HaneulClientTypes.GetObjectsOptions<Include> {
|
|
28
|
-
client: ClientWithCoreApi;
|
|
29
|
-
}
|
|
22
|
+
export type GetManyOptions<Include extends Omit<HaneulClientTypes.ObjectInclude, 'content'> = {}> =
|
|
23
|
+
HaneulClientTypes.GetObjectsOptions<Include> & { client: ClientWithCoreApi };
|
|
30
24
|
|
|
31
25
|
export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {
|
|
32
26
|
const parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
|
|
@@ -63,7 +57,8 @@ export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null
|
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
if (structTag.module === 'option' && structTag.name === 'Option') {
|
|
66
|
-
const
|
|
60
|
+
const inner = structTag.typeParams[0];
|
|
61
|
+
const type = inner ? getPureBcsSchema(inner) : null;
|
|
67
62
|
return type ? bcs.option(type) : null;
|
|
68
63
|
}
|
|
69
64
|
}
|
|
@@ -95,7 +90,7 @@ export function normalizeMoveArguments(
|
|
|
95
90
|
const normalizedArgs: TransactionArgument[] = [];
|
|
96
91
|
|
|
97
92
|
let index = 0;
|
|
98
|
-
for (const
|
|
93
|
+
for (const argType of argTypes) {
|
|
99
94
|
if (argType === '0x2::clock::Clock') {
|
|
100
95
|
normalizedArgs.push((tx) => tx.object.clock());
|
|
101
96
|
continue;
|
|
@@ -143,28 +138,162 @@ export function normalizeMoveArguments(
|
|
|
143
138
|
continue;
|
|
144
139
|
}
|
|
145
140
|
|
|
146
|
-
const
|
|
147
|
-
const bcsType = type === null ? null : getPureBcsSchema(type);
|
|
141
|
+
const bcsType = argType === null ? null : getPureBcsSchema(argType);
|
|
148
142
|
|
|
149
143
|
if (bcsType) {
|
|
150
144
|
const bytes = bcsType.serialize(arg as never);
|
|
151
145
|
normalizedArgs.push((tx) => tx.pure(bytes));
|
|
152
146
|
continue;
|
|
153
|
-
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (typeof arg === 'string') {
|
|
154
150
|
normalizedArgs.push((tx) => tx.object(arg));
|
|
155
151
|
continue;
|
|
156
152
|
}
|
|
157
153
|
|
|
158
|
-
throw new Error(`Invalid argument ${stringify(arg)} for type ${
|
|
154
|
+
throw new Error(`Invalid argument ${stringify(arg)} for type ${argType}`);
|
|
159
155
|
}
|
|
160
156
|
|
|
161
157
|
return normalizedArgs;
|
|
162
158
|
}
|
|
163
159
|
|
|
160
|
+
/* -------------------------- Move type tags -------------------------- */
|
|
161
|
+
|
|
162
|
+
/** A type argument: a type tag string, or a BCS type whose name is a Move type. */
|
|
163
|
+
export type TypeArgument = string | BcsType<any>;
|
|
164
|
+
|
|
165
|
+
export interface TypeTagOptions {
|
|
166
|
+
package?: string;
|
|
167
|
+
typeArguments?: readonly TypeArgument[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `typeArguments` is required when the type's name contains unfilled
|
|
172
|
+
* `phantom X` parameters (at any depth). Everything else — argument arity,
|
|
173
|
+
* position contents, and tag validity — is validated at runtime.
|
|
174
|
+
*/
|
|
175
|
+
type TypeTagParams<Name extends string> = Name extends `${string}phantom ${string}`
|
|
176
|
+
? [options: TypeTagOptions & { typeArguments: readonly TypeArgument[] }]
|
|
177
|
+
: [options?: TypeTagOptions];
|
|
178
|
+
|
|
179
|
+
type ResolveTypeTagOptions<Name extends string> = {
|
|
180
|
+
client: ClientWithCoreApi;
|
|
181
|
+
} & (Name extends `${string}phantom ${string}`
|
|
182
|
+
? TypeTagOptions & { typeArguments: readonly TypeArgument[] }
|
|
183
|
+
: TypeTagOptions);
|
|
184
|
+
|
|
185
|
+
const HAS_PHANTOM_REGEX = /phantom [A-Za-z_$][A-Za-z0-9_$]*/;
|
|
186
|
+
|
|
187
|
+
function splitTopLevelTypeArgs(inner: string): string[] {
|
|
188
|
+
const parts: string[] = [];
|
|
189
|
+
let depth = 0;
|
|
190
|
+
let current = '';
|
|
191
|
+
for (const char of inner) {
|
|
192
|
+
if (char === ',' && depth === 0) {
|
|
193
|
+
parts.push(current.trim());
|
|
194
|
+
current = '';
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (char === '<') depth++;
|
|
198
|
+
if (char === '>') depth--;
|
|
199
|
+
current += char;
|
|
200
|
+
}
|
|
201
|
+
if (current) parts.push(current.trim());
|
|
202
|
+
return parts;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function buildTypeTag(name: string, options: TypeTagOptions | undefined): string {
|
|
206
|
+
const lt = name.indexOf('<');
|
|
207
|
+
const base = lt === -1 ? name : name.slice(0, lt);
|
|
208
|
+
|
|
209
|
+
if (base.split('::').length !== 3) {
|
|
210
|
+
throw new Error(`${name} is not a top-level Move type`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
let result = name;
|
|
214
|
+
|
|
215
|
+
if (options?.typeArguments) {
|
|
216
|
+
const baked = lt === -1 ? [] : splitTopLevelTypeArgs(name.slice(lt + 1, -1));
|
|
217
|
+
const supplied = options.typeArguments.map((arg) => {
|
|
218
|
+
if (typeof arg === 'string') {
|
|
219
|
+
return arg;
|
|
220
|
+
}
|
|
221
|
+
if (arg && typeof arg.serialize === 'function' && typeof arg.name === 'string') {
|
|
222
|
+
return arg.name;
|
|
223
|
+
}
|
|
224
|
+
throw new Error(`Invalid type argument ${stringify(arg)}`);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
if (supplied.length !== baked.length) {
|
|
228
|
+
throw new Error(
|
|
229
|
+
`Expected ${baked.length} type arguments for ${base}, got ${supplied.length}`,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
result = supplied.length === 0 ? base : `${base}<${supplied.join(', ')}>`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (HAS_PHANTOM_REGEX.test(result)) {
|
|
237
|
+
throw new Error(
|
|
238
|
+
options?.typeArguments
|
|
239
|
+
? `A type argument contains an unfilled phantom parameter in ${result}`
|
|
240
|
+
: `Missing type arguments for ${result}`,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (options?.package) {
|
|
245
|
+
const [, ...rest] = result.split('::');
|
|
246
|
+
result = [options.package, ...rest].join('::');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// fully validate address-only tags (MVR names can't be parsed as type tags)
|
|
250
|
+
if (!HAS_PHANTOM_REGEX.test(result) && !/[@/]/.test(result)) {
|
|
251
|
+
TypeTagSerializer.parseFromStr(result);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function resolveBuiltTypeTag(
|
|
258
|
+
name: string,
|
|
259
|
+
options: { client: ClientWithCoreApi } & TypeTagOptions,
|
|
260
|
+
): Promise<string> {
|
|
261
|
+
const { client, ...rest } = options;
|
|
262
|
+
const { type } = await client.core.mvr.resolveType({
|
|
263
|
+
type: buildTypeTag(name, rest),
|
|
264
|
+
});
|
|
265
|
+
return normalizeStructTag(type);
|
|
266
|
+
}
|
|
267
|
+
|
|
164
268
|
export class MoveStruct<
|
|
165
269
|
T extends Record<string, BcsType<any>>,
|
|
166
270
|
const Name extends string = string,
|
|
167
271
|
> extends BcsStruct<T, Name> {
|
|
272
|
+
/**
|
|
273
|
+
* Build the type tag for this struct.
|
|
274
|
+
*
|
|
275
|
+
* `typeArguments` is the full positional list, in Move declaration order, and
|
|
276
|
+
* is required when the struct has unfilled phantom parameters. The result may
|
|
277
|
+
* contain MVR names: those are valid in transaction `typeArguments`, but for
|
|
278
|
+
* queries or comparisons against on-chain data use `resolveTypeTag` instead.
|
|
279
|
+
*/
|
|
280
|
+
typeTag(...args: TypeTagParams<Name>): string {
|
|
281
|
+
return buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Build the type tag for this struct, then resolve any MVR names through the
|
|
286
|
+
* client (using its configured overrides and the MVR API) and return the
|
|
287
|
+
* normalized, address-only form suitable for queries and comparisons against
|
|
288
|
+
* on-chain data.
|
|
289
|
+
*/
|
|
290
|
+
async resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {
|
|
291
|
+
return resolveBuiltTypeTag(
|
|
292
|
+
this.name,
|
|
293
|
+
options as { client: ClientWithCoreApi } & TypeTagOptions,
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
168
297
|
async get<Include extends Omit<HaneulClientTypes.ObjectInclude, 'content' | 'json'> = {}>({
|
|
169
298
|
objectId,
|
|
170
299
|
...options
|
|
@@ -178,6 +307,10 @@ export class MoveStruct<
|
|
|
178
307
|
objectIds: [objectId],
|
|
179
308
|
});
|
|
180
309
|
|
|
310
|
+
if (!res) {
|
|
311
|
+
throw new Error(`No object found for id ${objectId}`);
|
|
312
|
+
}
|
|
313
|
+
|
|
181
314
|
return res;
|
|
182
315
|
}
|
|
183
316
|
|
|
@@ -215,16 +348,44 @@ export class MoveStruct<
|
|
|
215
348
|
export class MoveEnum<
|
|
216
349
|
T extends Record<string, BcsType<any> | null>,
|
|
217
350
|
const Name extends string,
|
|
218
|
-
> extends BcsEnum<T, Name> {
|
|
351
|
+
> extends BcsEnum<T, Name> {
|
|
352
|
+
/** Build the type tag for this enum. See `MoveStruct.typeTag` for semantics. */
|
|
353
|
+
typeTag(...args: TypeTagParams<Name>): string {
|
|
354
|
+
return buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** Build and resolve the type tag for this enum. See `MoveStruct.resolveTypeTag`. */
|
|
358
|
+
async resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {
|
|
359
|
+
return resolveBuiltTypeTag(
|
|
360
|
+
this.name,
|
|
361
|
+
options as { client: ClientWithCoreApi } & TypeTagOptions,
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
219
365
|
|
|
220
366
|
export class MoveTuple<
|
|
221
367
|
const T extends readonly BcsType<any>[],
|
|
222
368
|
const Name extends string,
|
|
223
|
-
> extends BcsTuple<T, Name> {
|
|
369
|
+
> extends BcsTuple<T, Name> {
|
|
370
|
+
/** Build the type tag for this struct. See `MoveStruct.typeTag` for semantics. */
|
|
371
|
+
typeTag(...args: TypeTagParams<Name>): string {
|
|
372
|
+
return buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Build and resolve the type tag for this struct. See `MoveStruct.resolveTypeTag`. */
|
|
376
|
+
async resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {
|
|
377
|
+
return resolveBuiltTypeTag(
|
|
378
|
+
this.name,
|
|
379
|
+
options as { client: ClientWithCoreApi } & TypeTagOptions,
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
224
383
|
|
|
225
384
|
function stringify(val: unknown) {
|
|
226
385
|
if (typeof val === 'object') {
|
|
227
|
-
return JSON.stringify(val, (
|
|
386
|
+
return JSON.stringify(val, (_key, value) =>
|
|
387
|
+
typeof value === 'bigint' ? value.toString() : value,
|
|
388
|
+
);
|
|
228
389
|
}
|
|
229
390
|
if (typeof val === 'bigint') {
|
|
230
391
|
return val.toString();
|