@typus/typus-perp-sdk 1.0.51 → 1.0.52-upgrade
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/dist/src/_dependencies/source/0x2/bag/structs.d.ts +61 -0
- package/dist/src/_dependencies/source/0x2/bag/structs.js +229 -0
- package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +88 -0
- package/dist/src/_dependencies/source/0x2/balance/structs.js +386 -0
- package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +460 -0
- package/dist/src/_dependencies/source/0x2/coin/structs.js +1247 -0
- package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +153 -0
- package/dist/src/_dependencies/source/0x2/linked-table/structs.js +438 -0
- package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +46 -0
- package/dist/src/_dependencies/source/0x2/sui/structs.js +222 -0
- package/dist/src/_dependencies/source/0x2/table/structs.d.ts +61 -0
- package/dist/src/_dependencies/source/0x2/table/structs.js +248 -0
- package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +68 -0
- package/dist/src/_dependencies/source/0x2/table-vec/structs.js +274 -0
- package/dist/src/_dependencies/source/0x2/token/structs.d.ts +449 -0
- package/dist/src/_dependencies/source/0x2/token/structs.js +1095 -0
- package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +370 -0
- package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +1091 -0
- package/dist/src/_dependencies/source/0x2/url/structs.d.ts +53 -0
- package/dist/src/_dependencies/source/0x2/url/structs.js +223 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +489 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +1084 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +147 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +456 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +239 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +653 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +405 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +899 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +8 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +11 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +102 -0
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/keyed-big-vector/structs.d.ts +70 -70
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/keyed-big-vector/structs.js +174 -174
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +699 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +1459 -0
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/linked-object-table/structs.d.ts +62 -62
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/linked-object-table/structs.js +170 -170
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +147 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +430 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +1071 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +2261 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +279 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +733 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +328 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +892 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +88 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +263 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +347 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +591 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +73 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +258 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +876 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +1721 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +46 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +222 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +3 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +6 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +89 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +155 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +444 -0
- package/dist/src/_dependencies/source/{0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded → 0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274}/vault/structs.d.ts +84 -84
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +446 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +844 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +6 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +9 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +69 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +94 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +376 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +454 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +881 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +68 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +274 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +1117 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +2387 -0
- package/dist/src/api/sentio.js +4 -1
- package/dist/src/fetch.d.ts +1 -1
- package/dist/src/fetch.js +1 -1
- package/dist/src/index.js +17 -17
- package/dist/src/typus_perp/admin/structs.d.ts +67 -5
- package/dist/src/typus_perp/admin/structs.js +155 -1
- package/dist/src/typus_perp/escrow/functions.js +1 -1
- package/dist/src/typus_perp/escrow/structs.d.ts +2 -2
- package/dist/src/typus_perp/escrow/structs.js +1 -1
- package/dist/src/typus_perp/lp-pool/structs.d.ts +28 -28
- package/dist/src/typus_perp/position/functions.js +1 -1
- package/dist/src/typus_perp/position/structs.d.ts +6 -6
- package/dist/src/typus_perp/symbol/structs.d.ts +1 -1
- package/dist/src/typus_perp/tlp/structs.d.ts +2 -2
- package/dist/src/typus_perp/trading/functions.js +1 -1
- package/dist/src/typus_perp/trading/structs.d.ts +32 -32
- package/dist/src/typus_perp/trading/structs.js +2 -2
- package/dist/src/typus_perp/treasury-caps/structs.d.ts +1 -1
- package/dist/src/typus_stake_pool/admin/functions.d.ts +25 -25
- package/dist/src/typus_stake_pool/admin/functions.js +66 -53
- package/dist/src/typus_stake_pool/admin/structs.d.ts +191 -191
- package/dist/src/typus_stake_pool/admin/structs.js +179 -179
- package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +50 -44
- package/dist/src/typus_stake_pool/stake-pool/functions.js +127 -88
- package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +202 -202
- package/dist/src/typus_stake_pool/stake-pool/structs.js +432 -432
- package/package.json +1 -1
- package/dist/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.d.ts +0 -8
- package/dist/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.js +0 -11
- package/dist/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.d.ts +0 -3
- package/dist/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.js +0 -6
- package/dist/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.d.ts +0 -3
- package/dist/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.js +0 -6
- /package/dist/src/_dependencies/source/{0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded → 0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274}/vault/structs.js +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeArgument, ToTypeStr, TypeArgument } from "../../../../_framework/reified";
|
|
2
|
+
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
3
|
+
import { Option } from "../../0x1/option/structs";
|
|
4
|
+
import { PKG_V26 } from "../index";
|
|
5
|
+
import { UID } from "../object/structs";
|
|
6
|
+
import { BcsType } from "@mysten/sui/bcs";
|
|
7
|
+
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
8
|
+
export declare function isLinkedTable(type: string): boolean;
|
|
9
|
+
export interface LinkedTableFields<K extends TypeArgument, V extends PhantomTypeArgument> {
|
|
10
|
+
id: ToField<UID>;
|
|
11
|
+
size: ToField<"u64">;
|
|
12
|
+
head: ToField<Option<K>>;
|
|
13
|
+
tail: ToField<Option<K>>;
|
|
14
|
+
}
|
|
15
|
+
export type LinkedTableReified<K extends TypeArgument, V extends PhantomTypeArgument> = Reified<LinkedTable<K, V>, LinkedTableFields<K, V>>;
|
|
16
|
+
export declare class LinkedTable<K extends TypeArgument, V extends PhantomTypeArgument> implements StructClass {
|
|
17
|
+
__StructClass: true;
|
|
18
|
+
static readonly $typeName = "0x2::linked_table::LinkedTable";
|
|
19
|
+
static readonly $numTypeParams = 2;
|
|
20
|
+
static readonly $isPhantom: readonly [false, true];
|
|
21
|
+
readonly $typeName = "0x2::linked_table::LinkedTable";
|
|
22
|
+
readonly $fullTypeName: `${typeof PKG_V26}::linked_table::LinkedTable<${ToTypeStr<K>}, ${PhantomToTypeStr<V>}>`;
|
|
23
|
+
readonly $typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
24
|
+
readonly $isPhantom: readonly [false, true];
|
|
25
|
+
readonly id: ToField<UID>;
|
|
26
|
+
readonly size: ToField<"u64">;
|
|
27
|
+
readonly head: ToField<Option<K>>;
|
|
28
|
+
readonly tail: ToField<Option<K>>;
|
|
29
|
+
private constructor();
|
|
30
|
+
static reified<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(K: K, V: V): LinkedTableReified<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
31
|
+
static get r(): typeof LinkedTable.reified;
|
|
32
|
+
static phantom<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(K: K, V: V): PhantomReified<ToTypeStr<LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>>;
|
|
33
|
+
static get p(): typeof LinkedTable.phantom;
|
|
34
|
+
static get bcs(): <K extends BcsType<any>>(K: K) => BcsType<{
|
|
35
|
+
id: {
|
|
36
|
+
id: {
|
|
37
|
+
bytes: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
size: string;
|
|
41
|
+
head: {
|
|
42
|
+
vec: any[];
|
|
43
|
+
};
|
|
44
|
+
tail: {
|
|
45
|
+
vec: any[];
|
|
46
|
+
};
|
|
47
|
+
}, {
|
|
48
|
+
id: {
|
|
49
|
+
id: {
|
|
50
|
+
bytes: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
size: string | number | bigint;
|
|
54
|
+
head: {
|
|
55
|
+
vec: Iterable<any> & {
|
|
56
|
+
length: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
tail: {
|
|
60
|
+
vec: Iterable<any> & {
|
|
61
|
+
length: number;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
static fromFields<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], fields: Record<string, any>): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
66
|
+
static fromFieldsWithTypes<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], item: FieldsWithTypes): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
67
|
+
static fromBcs<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: Uint8Array): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
68
|
+
toJSONField(): {
|
|
69
|
+
id: string;
|
|
70
|
+
size: string;
|
|
71
|
+
head: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
72
|
+
tail: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
73
|
+
};
|
|
74
|
+
toJSON(): {
|
|
75
|
+
id: string;
|
|
76
|
+
size: string;
|
|
77
|
+
head: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
78
|
+
tail: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
79
|
+
$typeName: string;
|
|
80
|
+
$typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
81
|
+
};
|
|
82
|
+
static fromJSONField<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], field: any): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
83
|
+
static fromJSON<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], json: Record<string, any>): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
84
|
+
static fromSuiParsedData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], content: SuiParsedData): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
85
|
+
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: SuiObjectData): LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
86
|
+
static fetch<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(client: SuiClient, typeArgs: [K, V], id: string): Promise<LinkedTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>;
|
|
87
|
+
}
|
|
88
|
+
export declare function isNode(type: string): boolean;
|
|
89
|
+
export interface NodeFields<K extends TypeArgument, V extends TypeArgument> {
|
|
90
|
+
prev: ToField<Option<K>>;
|
|
91
|
+
next: ToField<Option<K>>;
|
|
92
|
+
value: ToField<V>;
|
|
93
|
+
}
|
|
94
|
+
export type NodeReified<K extends TypeArgument, V extends TypeArgument> = Reified<Node<K, V>, NodeFields<K, V>>;
|
|
95
|
+
export declare class Node<K extends TypeArgument, V extends TypeArgument> implements StructClass {
|
|
96
|
+
__StructClass: true;
|
|
97
|
+
static readonly $typeName = "0x2::linked_table::Node";
|
|
98
|
+
static readonly $numTypeParams = 2;
|
|
99
|
+
static readonly $isPhantom: readonly [false, false];
|
|
100
|
+
readonly $typeName = "0x2::linked_table::Node";
|
|
101
|
+
readonly $fullTypeName: `${typeof PKG_V26}::linked_table::Node<${ToTypeStr<K>}, ${ToTypeStr<V>}>`;
|
|
102
|
+
readonly $typeArgs: [ToTypeStr<K>, ToTypeStr<V>];
|
|
103
|
+
readonly $isPhantom: readonly [false, false];
|
|
104
|
+
readonly prev: ToField<Option<K>>;
|
|
105
|
+
readonly next: ToField<Option<K>>;
|
|
106
|
+
readonly value: ToField<V>;
|
|
107
|
+
private constructor();
|
|
108
|
+
static reified<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(K: K, V: V): NodeReified<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
109
|
+
static get r(): typeof Node.reified;
|
|
110
|
+
static phantom<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(K: K, V: V): PhantomReified<ToTypeStr<Node<ToTypeArgument<K>, ToTypeArgument<V>>>>;
|
|
111
|
+
static get p(): typeof Node.phantom;
|
|
112
|
+
static get bcs(): <K extends BcsType<any>, V extends BcsType<any>>(K: K, V: V) => BcsType<{
|
|
113
|
+
prev: {
|
|
114
|
+
vec: any[];
|
|
115
|
+
};
|
|
116
|
+
next: {
|
|
117
|
+
vec: any[];
|
|
118
|
+
};
|
|
119
|
+
value: V extends BcsType<infer U, any> ? U : never;
|
|
120
|
+
}, {
|
|
121
|
+
prev: {
|
|
122
|
+
vec: Iterable<any> & {
|
|
123
|
+
length: number;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
next: {
|
|
127
|
+
vec: Iterable<any> & {
|
|
128
|
+
length: number;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
value: V extends BcsType<any, infer U_1> ? U_1 : never;
|
|
132
|
+
}>;
|
|
133
|
+
static fromFields<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], fields: Record<string, any>): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
134
|
+
static fromFieldsWithTypes<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], item: FieldsWithTypes): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
135
|
+
static fromBcs<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], data: Uint8Array): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
136
|
+
toJSONField(): {
|
|
137
|
+
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
138
|
+
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
139
|
+
value: import("../../../../_framework/reified").ToJSON<V>;
|
|
140
|
+
};
|
|
141
|
+
toJSON(): {
|
|
142
|
+
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
143
|
+
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
144
|
+
value: import("../../../../_framework/reified").ToJSON<V>;
|
|
145
|
+
$typeName: string;
|
|
146
|
+
$typeArgs: [ToTypeStr<K>, ToTypeStr<V>];
|
|
147
|
+
};
|
|
148
|
+
static fromJSONField<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], field: any): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
149
|
+
static fromJSON<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], json: Record<string, any>): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
150
|
+
static fromSuiParsedData<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], content: SuiParsedData): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
151
|
+
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], data: SuiObjectData): Node<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
152
|
+
static fetch<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(client: SuiClient, typeArgs: [K, V], id: string): Promise<Node<ToTypeArgument<K>, ToTypeArgument<V>>>;
|
|
153
|
+
}
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
+
if (ar || !(i in from)) {
|
|
68
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
+
ar[i] = from[i];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
+
};
|
|
74
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
+
exports.Node = exports.LinkedTable = void 0;
|
|
76
|
+
exports.isLinkedTable = isLinkedTable;
|
|
77
|
+
exports.isNode = isNode;
|
|
78
|
+
var reified_1 = require("../../../../_framework/reified");
|
|
79
|
+
var util_1 = require("../../../../_framework/util");
|
|
80
|
+
var structs_1 = require("../../0x1/option/structs");
|
|
81
|
+
var index_1 = require("../index");
|
|
82
|
+
var structs_2 = require("../object/structs");
|
|
83
|
+
var bcs_1 = require("@mysten/sui/bcs");
|
|
84
|
+
var utils_1 = require("@mysten/sui/utils");
|
|
85
|
+
/* ============================== LinkedTable =============================== */
|
|
86
|
+
function isLinkedTable(type) {
|
|
87
|
+
type = (0, util_1.compressSuiType)(type);
|
|
88
|
+
return type.startsWith("".concat(index_1.PKG_V26, "::linked_table::LinkedTable") + "<");
|
|
89
|
+
}
|
|
90
|
+
var LinkedTable = /** @class */ (function () {
|
|
91
|
+
function LinkedTable(typeArgs, fields) {
|
|
92
|
+
this.__StructClass = true;
|
|
93
|
+
this.$typeName = LinkedTable.$typeName;
|
|
94
|
+
this.$isPhantom = LinkedTable.$isPhantom;
|
|
95
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([LinkedTable.$typeName], __read(typeArgs), false));
|
|
96
|
+
this.$typeArgs = typeArgs;
|
|
97
|
+
this.id = fields.id;
|
|
98
|
+
this.size = fields.size;
|
|
99
|
+
this.head = fields.head;
|
|
100
|
+
this.tail = fields.tail;
|
|
101
|
+
}
|
|
102
|
+
LinkedTable.reified = function (K, V) {
|
|
103
|
+
var _this = this;
|
|
104
|
+
return {
|
|
105
|
+
typeName: LinkedTable.$typeName,
|
|
106
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([LinkedTable.$typeName], [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], false)),
|
|
107
|
+
typeArgs: [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)],
|
|
108
|
+
isPhantom: LinkedTable.$isPhantom,
|
|
109
|
+
reifiedTypeArgs: [K, V],
|
|
110
|
+
fromFields: function (fields) { return LinkedTable.fromFields([K, V], fields); },
|
|
111
|
+
fromFieldsWithTypes: function (item) { return LinkedTable.fromFieldsWithTypes([K, V], item); },
|
|
112
|
+
fromBcs: function (data) { return LinkedTable.fromBcs([K, V], data); },
|
|
113
|
+
bcs: LinkedTable.bcs((0, reified_1.toBcs)(K)),
|
|
114
|
+
fromJSONField: function (field) { return LinkedTable.fromJSONField([K, V], field); },
|
|
115
|
+
fromJSON: function (json) { return LinkedTable.fromJSON([K, V], json); },
|
|
116
|
+
fromSuiParsedData: function (content) { return LinkedTable.fromSuiParsedData([K, V], content); },
|
|
117
|
+
fromSuiObjectData: function (content) { return LinkedTable.fromSuiObjectData([K, V], content); },
|
|
118
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
119
|
+
return [2 /*return*/, LinkedTable.fetch(client, [K, V], id)];
|
|
120
|
+
}); }); },
|
|
121
|
+
new: function (fields) {
|
|
122
|
+
return new LinkedTable([(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], fields);
|
|
123
|
+
},
|
|
124
|
+
kind: "StructClassReified",
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
Object.defineProperty(LinkedTable, "r", {
|
|
128
|
+
get: function () {
|
|
129
|
+
return LinkedTable.reified;
|
|
130
|
+
},
|
|
131
|
+
enumerable: false,
|
|
132
|
+
configurable: true
|
|
133
|
+
});
|
|
134
|
+
LinkedTable.phantom = function (K, V) {
|
|
135
|
+
return (0, reified_1.phantom)(LinkedTable.reified(K, V));
|
|
136
|
+
};
|
|
137
|
+
Object.defineProperty(LinkedTable, "p", {
|
|
138
|
+
get: function () {
|
|
139
|
+
return LinkedTable.phantom;
|
|
140
|
+
},
|
|
141
|
+
enumerable: false,
|
|
142
|
+
configurable: true
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(LinkedTable, "bcs", {
|
|
145
|
+
get: function () {
|
|
146
|
+
return function (K) {
|
|
147
|
+
return bcs_1.bcs.struct("LinkedTable<".concat(K.name, ">"), {
|
|
148
|
+
id: structs_2.UID.bcs,
|
|
149
|
+
size: bcs_1.bcs.u64(),
|
|
150
|
+
head: structs_1.Option.bcs(K),
|
|
151
|
+
tail: structs_1.Option.bcs(K),
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
enumerable: false,
|
|
156
|
+
configurable: true
|
|
157
|
+
});
|
|
158
|
+
LinkedTable.fromFields = function (typeArgs, fields) {
|
|
159
|
+
return LinkedTable.reified(typeArgs[0], typeArgs[1]).new({
|
|
160
|
+
id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
|
|
161
|
+
size: (0, reified_1.decodeFromFields)("u64", fields.size),
|
|
162
|
+
head: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.head),
|
|
163
|
+
tail: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.tail),
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
LinkedTable.fromFieldsWithTypes = function (typeArgs, item) {
|
|
167
|
+
if (!isLinkedTable(item.type)) {
|
|
168
|
+
throw new Error("not a LinkedTable type");
|
|
169
|
+
}
|
|
170
|
+
(0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
|
|
171
|
+
return LinkedTable.reified(typeArgs[0], typeArgs[1]).new({
|
|
172
|
+
id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
|
|
173
|
+
size: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.size),
|
|
174
|
+
head: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.head),
|
|
175
|
+
tail: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.tail),
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
LinkedTable.fromBcs = function (typeArgs, data) {
|
|
179
|
+
return LinkedTable.fromFields(typeArgs, LinkedTable.bcs((0, reified_1.toBcs)(typeArgs[0])).parse(data));
|
|
180
|
+
};
|
|
181
|
+
LinkedTable.prototype.toJSONField = function () {
|
|
182
|
+
return {
|
|
183
|
+
id: this.id,
|
|
184
|
+
size: this.size.toString(),
|
|
185
|
+
head: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.head),
|
|
186
|
+
tail: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.tail),
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
LinkedTable.prototype.toJSON = function () {
|
|
190
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
191
|
+
};
|
|
192
|
+
LinkedTable.fromJSONField = function (typeArgs, field) {
|
|
193
|
+
return LinkedTable.reified(typeArgs[0], typeArgs[1]).new({
|
|
194
|
+
id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
|
|
195
|
+
size: (0, reified_1.decodeFromJSONField)("u64", field.size),
|
|
196
|
+
head: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.head),
|
|
197
|
+
tail: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.tail),
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
LinkedTable.fromJSON = function (typeArgs, json) {
|
|
201
|
+
if (json.$typeName !== LinkedTable.$typeName) {
|
|
202
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
203
|
+
}
|
|
204
|
+
(0, reified_1.assertReifiedTypeArgsMatch)(util_1.composeSuiType.apply(void 0, __spreadArray([LinkedTable.$typeName], __read(typeArgs.map(reified_1.extractType)), false)), json.$typeArgs, typeArgs);
|
|
205
|
+
return LinkedTable.fromJSONField(typeArgs, json);
|
|
206
|
+
};
|
|
207
|
+
LinkedTable.fromSuiParsedData = function (typeArgs, content) {
|
|
208
|
+
if (content.dataType !== "moveObject") {
|
|
209
|
+
throw new Error("not an object");
|
|
210
|
+
}
|
|
211
|
+
if (!isLinkedTable(content.type)) {
|
|
212
|
+
throw new Error("object at ".concat(content.fields.id, " is not a LinkedTable object"));
|
|
213
|
+
}
|
|
214
|
+
return LinkedTable.fromFieldsWithTypes(typeArgs, content);
|
|
215
|
+
};
|
|
216
|
+
LinkedTable.fromSuiObjectData = function (typeArgs, data) {
|
|
217
|
+
if (data.bcs) {
|
|
218
|
+
if (data.bcs.dataType !== "moveObject" || !isLinkedTable(data.bcs.type)) {
|
|
219
|
+
throw new Error("object at is not a LinkedTable object");
|
|
220
|
+
}
|
|
221
|
+
var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
|
|
222
|
+
if (gotTypeArgs.length !== 2) {
|
|
223
|
+
throw new Error("type argument mismatch: expected 2 type arguments but got ".concat(gotTypeArgs.length));
|
|
224
|
+
}
|
|
225
|
+
for (var i = 0; i < 2; i++) {
|
|
226
|
+
var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
|
|
227
|
+
var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
|
|
228
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
229
|
+
throw new Error("type argument mismatch at position ".concat(i, ": expected '").concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return LinkedTable.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
233
|
+
}
|
|
234
|
+
if (data.content) {
|
|
235
|
+
return LinkedTable.fromSuiParsedData(typeArgs, data.content);
|
|
236
|
+
}
|
|
237
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
238
|
+
};
|
|
239
|
+
LinkedTable.fetch = function (client, typeArgs, id) {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
241
|
+
var res;
|
|
242
|
+
var _a, _b;
|
|
243
|
+
return __generator(this, function (_c) {
|
|
244
|
+
switch (_c.label) {
|
|
245
|
+
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
246
|
+
case 1:
|
|
247
|
+
res = _c.sent();
|
|
248
|
+
if (res.error) {
|
|
249
|
+
throw new Error("error fetching LinkedTable object at id ".concat(id, ": ").concat(res.error.code));
|
|
250
|
+
}
|
|
251
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isLinkedTable(res.data.bcs.type)) {
|
|
252
|
+
throw new Error("object at id ".concat(id, " is not a LinkedTable object"));
|
|
253
|
+
}
|
|
254
|
+
return [2 /*return*/, LinkedTable.fromSuiObjectData(typeArgs, res.data)];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
LinkedTable.$typeName = "".concat(index_1.PKG_V26, "::linked_table::LinkedTable");
|
|
260
|
+
LinkedTable.$numTypeParams = 2;
|
|
261
|
+
LinkedTable.$isPhantom = [false, true];
|
|
262
|
+
return LinkedTable;
|
|
263
|
+
}());
|
|
264
|
+
exports.LinkedTable = LinkedTable;
|
|
265
|
+
/* ============================== Node =============================== */
|
|
266
|
+
function isNode(type) {
|
|
267
|
+
type = (0, util_1.compressSuiType)(type);
|
|
268
|
+
return type.startsWith("".concat(index_1.PKG_V26, "::linked_table::Node") + "<");
|
|
269
|
+
}
|
|
270
|
+
var Node = /** @class */ (function () {
|
|
271
|
+
function Node(typeArgs, fields) {
|
|
272
|
+
this.__StructClass = true;
|
|
273
|
+
this.$typeName = Node.$typeName;
|
|
274
|
+
this.$isPhantom = Node.$isPhantom;
|
|
275
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], __read(typeArgs), false));
|
|
276
|
+
this.$typeArgs = typeArgs;
|
|
277
|
+
this.prev = fields.prev;
|
|
278
|
+
this.next = fields.next;
|
|
279
|
+
this.value = fields.value;
|
|
280
|
+
}
|
|
281
|
+
Node.reified = function (K, V) {
|
|
282
|
+
var _this = this;
|
|
283
|
+
return {
|
|
284
|
+
typeName: Node.$typeName,
|
|
285
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], false)),
|
|
286
|
+
typeArgs: [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)],
|
|
287
|
+
isPhantom: Node.$isPhantom,
|
|
288
|
+
reifiedTypeArgs: [K, V],
|
|
289
|
+
fromFields: function (fields) { return Node.fromFields([K, V], fields); },
|
|
290
|
+
fromFieldsWithTypes: function (item) { return Node.fromFieldsWithTypes([K, V], item); },
|
|
291
|
+
fromBcs: function (data) { return Node.fromBcs([K, V], data); },
|
|
292
|
+
bcs: Node.bcs((0, reified_1.toBcs)(K), (0, reified_1.toBcs)(V)),
|
|
293
|
+
fromJSONField: function (field) { return Node.fromJSONField([K, V], field); },
|
|
294
|
+
fromJSON: function (json) { return Node.fromJSON([K, V], json); },
|
|
295
|
+
fromSuiParsedData: function (content) { return Node.fromSuiParsedData([K, V], content); },
|
|
296
|
+
fromSuiObjectData: function (content) { return Node.fromSuiObjectData([K, V], content); },
|
|
297
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
298
|
+
return [2 /*return*/, Node.fetch(client, [K, V], id)];
|
|
299
|
+
}); }); },
|
|
300
|
+
new: function (fields) {
|
|
301
|
+
return new Node([(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], fields);
|
|
302
|
+
},
|
|
303
|
+
kind: "StructClassReified",
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
Object.defineProperty(Node, "r", {
|
|
307
|
+
get: function () {
|
|
308
|
+
return Node.reified;
|
|
309
|
+
},
|
|
310
|
+
enumerable: false,
|
|
311
|
+
configurable: true
|
|
312
|
+
});
|
|
313
|
+
Node.phantom = function (K, V) {
|
|
314
|
+
return (0, reified_1.phantom)(Node.reified(K, V));
|
|
315
|
+
};
|
|
316
|
+
Object.defineProperty(Node, "p", {
|
|
317
|
+
get: function () {
|
|
318
|
+
return Node.phantom;
|
|
319
|
+
},
|
|
320
|
+
enumerable: false,
|
|
321
|
+
configurable: true
|
|
322
|
+
});
|
|
323
|
+
Object.defineProperty(Node, "bcs", {
|
|
324
|
+
get: function () {
|
|
325
|
+
return function (K, V) {
|
|
326
|
+
return bcs_1.bcs.struct("Node<".concat(K.name, ", ").concat(V.name, ">"), {
|
|
327
|
+
prev: structs_1.Option.bcs(K),
|
|
328
|
+
next: structs_1.Option.bcs(K),
|
|
329
|
+
value: V,
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
enumerable: false,
|
|
334
|
+
configurable: true
|
|
335
|
+
});
|
|
336
|
+
Node.fromFields = function (typeArgs, fields) {
|
|
337
|
+
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
338
|
+
prev: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.prev),
|
|
339
|
+
next: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.next),
|
|
340
|
+
value: (0, reified_1.decodeFromFields)(typeArgs[1], fields.value),
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
Node.fromFieldsWithTypes = function (typeArgs, item) {
|
|
344
|
+
if (!isNode(item.type)) {
|
|
345
|
+
throw new Error("not a Node type");
|
|
346
|
+
}
|
|
347
|
+
(0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
|
|
348
|
+
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
349
|
+
prev: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.prev),
|
|
350
|
+
next: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.next),
|
|
351
|
+
value: (0, reified_1.decodeFromFieldsWithTypes)(typeArgs[1], item.fields.value),
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
Node.fromBcs = function (typeArgs, data) {
|
|
355
|
+
return Node.fromFields(typeArgs, Node.bcs((0, reified_1.toBcs)(typeArgs[0]), (0, reified_1.toBcs)(typeArgs[1])).parse(data));
|
|
356
|
+
};
|
|
357
|
+
Node.prototype.toJSONField = function () {
|
|
358
|
+
return {
|
|
359
|
+
prev: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.prev),
|
|
360
|
+
next: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.next),
|
|
361
|
+
value: (0, reified_1.fieldToJSON)(this.$typeArgs[1], this.value),
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
Node.prototype.toJSON = function () {
|
|
365
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
366
|
+
};
|
|
367
|
+
Node.fromJSONField = function (typeArgs, field) {
|
|
368
|
+
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
369
|
+
prev: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.prev),
|
|
370
|
+
next: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.next),
|
|
371
|
+
value: (0, reified_1.decodeFromJSONField)(typeArgs[1], field.value),
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
Node.fromJSON = function (typeArgs, json) {
|
|
375
|
+
if (json.$typeName !== Node.$typeName) {
|
|
376
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
377
|
+
}
|
|
378
|
+
(0, reified_1.assertReifiedTypeArgsMatch)(util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], __read(typeArgs.map(reified_1.extractType)), false)), json.$typeArgs, typeArgs);
|
|
379
|
+
return Node.fromJSONField(typeArgs, json);
|
|
380
|
+
};
|
|
381
|
+
Node.fromSuiParsedData = function (typeArgs, content) {
|
|
382
|
+
if (content.dataType !== "moveObject") {
|
|
383
|
+
throw new Error("not an object");
|
|
384
|
+
}
|
|
385
|
+
if (!isNode(content.type)) {
|
|
386
|
+
throw new Error("object at ".concat(content.fields.id, " is not a Node object"));
|
|
387
|
+
}
|
|
388
|
+
return Node.fromFieldsWithTypes(typeArgs, content);
|
|
389
|
+
};
|
|
390
|
+
Node.fromSuiObjectData = function (typeArgs, data) {
|
|
391
|
+
if (data.bcs) {
|
|
392
|
+
if (data.bcs.dataType !== "moveObject" || !isNode(data.bcs.type)) {
|
|
393
|
+
throw new Error("object at is not a Node object");
|
|
394
|
+
}
|
|
395
|
+
var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
|
|
396
|
+
if (gotTypeArgs.length !== 2) {
|
|
397
|
+
throw new Error("type argument mismatch: expected 2 type arguments but got ".concat(gotTypeArgs.length));
|
|
398
|
+
}
|
|
399
|
+
for (var i = 0; i < 2; i++) {
|
|
400
|
+
var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
|
|
401
|
+
var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
|
|
402
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
403
|
+
throw new Error("type argument mismatch at position ".concat(i, ": expected '").concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return Node.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
407
|
+
}
|
|
408
|
+
if (data.content) {
|
|
409
|
+
return Node.fromSuiParsedData(typeArgs, data.content);
|
|
410
|
+
}
|
|
411
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
412
|
+
};
|
|
413
|
+
Node.fetch = function (client, typeArgs, id) {
|
|
414
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
415
|
+
var res;
|
|
416
|
+
var _a, _b;
|
|
417
|
+
return __generator(this, function (_c) {
|
|
418
|
+
switch (_c.label) {
|
|
419
|
+
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
420
|
+
case 1:
|
|
421
|
+
res = _c.sent();
|
|
422
|
+
if (res.error) {
|
|
423
|
+
throw new Error("error fetching Node object at id ".concat(id, ": ").concat(res.error.code));
|
|
424
|
+
}
|
|
425
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isNode(res.data.bcs.type)) {
|
|
426
|
+
throw new Error("object at id ".concat(id, " is not a Node object"));
|
|
427
|
+
}
|
|
428
|
+
return [2 /*return*/, Node.fromSuiObjectData(typeArgs, res.data)];
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
Node.$typeName = "".concat(index_1.PKG_V26, "::linked_table::Node");
|
|
434
|
+
Node.$numTypeParams = 2;
|
|
435
|
+
Node.$isPhantom = [false, false];
|
|
436
|
+
return Node;
|
|
437
|
+
}());
|
|
438
|
+
exports.Node = Node;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../../../_framework/reified";
|
|
2
|
+
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
3
|
+
import { PKG_V26 } from "../index";
|
|
4
|
+
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
5
|
+
export declare function isSUI(type: string): boolean;
|
|
6
|
+
export interface SUIFields {
|
|
7
|
+
dummyField: ToField<"bool">;
|
|
8
|
+
}
|
|
9
|
+
export type SUIReified = Reified<SUI, SUIFields>;
|
|
10
|
+
export declare class SUI implements StructClass {
|
|
11
|
+
__StructClass: true;
|
|
12
|
+
static readonly $typeName = "0x2::sui::SUI";
|
|
13
|
+
static readonly $numTypeParams = 0;
|
|
14
|
+
static readonly $isPhantom: readonly [];
|
|
15
|
+
readonly $typeName = "0x2::sui::SUI";
|
|
16
|
+
readonly $fullTypeName: `${typeof PKG_V26}::sui::SUI`;
|
|
17
|
+
readonly $typeArgs: [];
|
|
18
|
+
readonly $isPhantom: readonly [];
|
|
19
|
+
readonly dummyField: ToField<"bool">;
|
|
20
|
+
private constructor();
|
|
21
|
+
static reified(): SUIReified;
|
|
22
|
+
static get r(): import("../../../../_framework/reified").StructClassReified<SUI, SUIFields>;
|
|
23
|
+
static phantom(): PhantomReified<ToTypeStr<SUI>>;
|
|
24
|
+
static get p(): PhantomReified<"0x2::sui::SUI">;
|
|
25
|
+
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
26
|
+
dummy_field: boolean;
|
|
27
|
+
}, {
|
|
28
|
+
dummy_field: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
static fromFields(fields: Record<string, any>): SUI;
|
|
31
|
+
static fromFieldsWithTypes(item: FieldsWithTypes): SUI;
|
|
32
|
+
static fromBcs(data: Uint8Array): SUI;
|
|
33
|
+
toJSONField(): {
|
|
34
|
+
dummyField: boolean;
|
|
35
|
+
};
|
|
36
|
+
toJSON(): {
|
|
37
|
+
dummyField: boolean;
|
|
38
|
+
$typeName: string;
|
|
39
|
+
$typeArgs: [];
|
|
40
|
+
};
|
|
41
|
+
static fromJSONField(field: any): SUI;
|
|
42
|
+
static fromJSON(json: Record<string, any>): SUI;
|
|
43
|
+
static fromSuiParsedData(content: SuiParsedData): SUI;
|
|
44
|
+
static fromSuiObjectData(data: SuiObjectData): SUI;
|
|
45
|
+
static fetch(client: SuiClient, id: string): Promise<SUI>;
|
|
46
|
+
}
|