@typus/typus-perp-sdk 1.0.52 → 1.0.53-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/fetch.d.ts +1 -1
- package/dist/src/fetch.js +1 -1
- package/dist/src/index.js +18 -18
- 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/dist/src/user/history.js +6 -4
- package/dist/src/user/order.js +34 -34
- 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
|
@@ -5,66 +5,6 @@ import { UID } from "../../0x2/object/structs";
|
|
|
5
5
|
import { PKG_V1 } from "../index";
|
|
6
6
|
import { BcsType } from "@mysten/sui/bcs";
|
|
7
7
|
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
8
|
-
export declare function isNode(type: string): boolean;
|
|
9
|
-
export interface NodeFields<K extends TypeArgument, V extends PhantomTypeArgument> {
|
|
10
|
-
prev: ToField<Option<K>>;
|
|
11
|
-
next: ToField<Option<K>>;
|
|
12
|
-
}
|
|
13
|
-
export type NodeReified<K extends TypeArgument, V extends PhantomTypeArgument> = Reified<Node<K, V>, NodeFields<K, V>>;
|
|
14
|
-
export declare class Node<K extends TypeArgument, V extends PhantomTypeArgument> implements StructClass {
|
|
15
|
-
__StructClass: true;
|
|
16
|
-
static readonly $typeName = "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::linked_object_table::Node";
|
|
17
|
-
static readonly $numTypeParams = 2;
|
|
18
|
-
static readonly $isPhantom: readonly [false, true];
|
|
19
|
-
readonly $typeName = "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::linked_object_table::Node";
|
|
20
|
-
readonly $fullTypeName: `${typeof PKG_V1}::linked_object_table::Node<${ToTypeStr<K>}, ${PhantomToTypeStr<V>}>`;
|
|
21
|
-
readonly $typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
22
|
-
readonly $isPhantom: readonly [false, true];
|
|
23
|
-
readonly prev: ToField<Option<K>>;
|
|
24
|
-
readonly next: ToField<Option<K>>;
|
|
25
|
-
private constructor();
|
|
26
|
-
static reified<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(K: K, V: V): NodeReified<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
27
|
-
static get r(): typeof Node.reified;
|
|
28
|
-
static phantom<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(K: K, V: V): PhantomReified<ToTypeStr<Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>>;
|
|
29
|
-
static get p(): typeof Node.phantom;
|
|
30
|
-
static get bcs(): <K extends BcsType<any>>(K: K) => BcsType<{
|
|
31
|
-
prev: {
|
|
32
|
-
vec: any[];
|
|
33
|
-
};
|
|
34
|
-
next: {
|
|
35
|
-
vec: any[];
|
|
36
|
-
};
|
|
37
|
-
}, {
|
|
38
|
-
prev: {
|
|
39
|
-
vec: Iterable<any> & {
|
|
40
|
-
length: number;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
next: {
|
|
44
|
-
vec: Iterable<any> & {
|
|
45
|
-
length: number;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
}>;
|
|
49
|
-
static fromFields<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], fields: Record<string, any>): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
50
|
-
static fromFieldsWithTypes<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], item: FieldsWithTypes): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
51
|
-
static fromBcs<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: Uint8Array): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
52
|
-
toJSONField(): {
|
|
53
|
-
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
54
|
-
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
55
|
-
};
|
|
56
|
-
toJSON(): {
|
|
57
|
-
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
58
|
-
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
59
|
-
$typeName: string;
|
|
60
|
-
$typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
61
|
-
};
|
|
62
|
-
static fromJSONField<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], field: any): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
63
|
-
static fromJSON<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], json: Record<string, any>): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
64
|
-
static fromSuiParsedData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], content: SuiParsedData): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
65
|
-
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: SuiObjectData): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
66
|
-
static fetch<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(client: SuiClient, typeArgs: [K, V], id: string): Promise<Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>;
|
|
67
|
-
}
|
|
68
8
|
export declare function isLinkedObjectTable(type: string): boolean;
|
|
69
9
|
export interface LinkedObjectTableFields<K extends TypeArgument, V extends PhantomTypeArgument> {
|
|
70
10
|
id: ToField<UID>;
|
|
@@ -76,10 +16,10 @@ export interface LinkedObjectTableFields<K extends TypeArgument, V extends Phant
|
|
|
76
16
|
export type LinkedObjectTableReified<K extends TypeArgument, V extends PhantomTypeArgument> = Reified<LinkedObjectTable<K, V>, LinkedObjectTableFields<K, V>>;
|
|
77
17
|
export declare class LinkedObjectTable<K extends TypeArgument, V extends PhantomTypeArgument> implements StructClass {
|
|
78
18
|
__StructClass: true;
|
|
79
|
-
static readonly $typeName = "
|
|
19
|
+
static readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_object_table::LinkedObjectTable";
|
|
80
20
|
static readonly $numTypeParams = 2;
|
|
81
21
|
static readonly $isPhantom: readonly [false, true];
|
|
82
|
-
readonly $typeName = "
|
|
22
|
+
readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_object_table::LinkedObjectTable";
|
|
83
23
|
readonly $fullTypeName: `${typeof PKG_V1}::linked_object_table::LinkedObjectTable<${ToTypeStr<K>}, ${PhantomToTypeStr<V>}>`;
|
|
84
24
|
readonly $typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
85
25
|
readonly $isPhantom: readonly [false, true];
|
|
@@ -159,3 +99,63 @@ export declare class LinkedObjectTable<K extends TypeArgument, V extends Phantom
|
|
|
159
99
|
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: SuiObjectData): LinkedObjectTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
160
100
|
static fetch<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(client: SuiClient, typeArgs: [K, V], id: string): Promise<LinkedObjectTable<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>;
|
|
161
101
|
}
|
|
102
|
+
export declare function isNode(type: string): boolean;
|
|
103
|
+
export interface NodeFields<K extends TypeArgument, V extends PhantomTypeArgument> {
|
|
104
|
+
prev: ToField<Option<K>>;
|
|
105
|
+
next: ToField<Option<K>>;
|
|
106
|
+
}
|
|
107
|
+
export type NodeReified<K extends TypeArgument, V extends PhantomTypeArgument> = Reified<Node<K, V>, NodeFields<K, V>>;
|
|
108
|
+
export declare class Node<K extends TypeArgument, V extends PhantomTypeArgument> implements StructClass {
|
|
109
|
+
__StructClass: true;
|
|
110
|
+
static readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_object_table::Node";
|
|
111
|
+
static readonly $numTypeParams = 2;
|
|
112
|
+
static readonly $isPhantom: readonly [false, true];
|
|
113
|
+
readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_object_table::Node";
|
|
114
|
+
readonly $fullTypeName: `${typeof PKG_V1}::linked_object_table::Node<${ToTypeStr<K>}, ${PhantomToTypeStr<V>}>`;
|
|
115
|
+
readonly $typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
116
|
+
readonly $isPhantom: readonly [false, true];
|
|
117
|
+
readonly prev: ToField<Option<K>>;
|
|
118
|
+
readonly next: ToField<Option<K>>;
|
|
119
|
+
private constructor();
|
|
120
|
+
static reified<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(K: K, V: V): NodeReified<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
121
|
+
static get r(): typeof Node.reified;
|
|
122
|
+
static phantom<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(K: K, V: V): PhantomReified<ToTypeStr<Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>>;
|
|
123
|
+
static get p(): typeof Node.phantom;
|
|
124
|
+
static get bcs(): <K extends BcsType<any>>(K: K) => BcsType<{
|
|
125
|
+
prev: {
|
|
126
|
+
vec: any[];
|
|
127
|
+
};
|
|
128
|
+
next: {
|
|
129
|
+
vec: any[];
|
|
130
|
+
};
|
|
131
|
+
}, {
|
|
132
|
+
prev: {
|
|
133
|
+
vec: Iterable<any> & {
|
|
134
|
+
length: number;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
next: {
|
|
138
|
+
vec: Iterable<any> & {
|
|
139
|
+
length: number;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
}>;
|
|
143
|
+
static fromFields<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], fields: Record<string, any>): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
144
|
+
static fromFieldsWithTypes<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], item: FieldsWithTypes): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
145
|
+
static fromBcs<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: Uint8Array): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
146
|
+
toJSONField(): {
|
|
147
|
+
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
148
|
+
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
149
|
+
};
|
|
150
|
+
toJSON(): {
|
|
151
|
+
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
152
|
+
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
153
|
+
$typeName: string;
|
|
154
|
+
$typeArgs: [ToTypeStr<K>, PhantomToTypeStr<V>];
|
|
155
|
+
};
|
|
156
|
+
static fromJSONField<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], field: any): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
157
|
+
static fromJSON<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], json: Record<string, any>): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
158
|
+
static fromSuiParsedData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], content: SuiParsedData): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
159
|
+
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(typeArgs: [K, V], data: SuiObjectData): Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>;
|
|
160
|
+
static fetch<K extends Reified<TypeArgument, any>, V extends PhantomReified<PhantomTypeArgument>>(client: SuiClient, typeArgs: [K, V], id: string): Promise<Node<ToTypeArgument<K>, ToPhantomTypeArgument<V>>>;
|
|
161
|
+
}
|
|
@@ -72,9 +72,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
72
72
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
73
|
};
|
|
74
74
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
exports.
|
|
76
|
-
exports.isNode = isNode;
|
|
75
|
+
exports.Node = exports.LinkedObjectTable = void 0;
|
|
77
76
|
exports.isLinkedObjectTable = isLinkedObjectTable;
|
|
77
|
+
exports.isNode = isNode;
|
|
78
78
|
var reified_1 = require("../../../../_framework/reified");
|
|
79
79
|
var util_1 = require("../../../../_framework/util");
|
|
80
80
|
var structs_1 = require("../../0x1/option/structs");
|
|
@@ -82,174 +82,6 @@ var structs_2 = require("../../0x2/object/structs");
|
|
|
82
82
|
var index_1 = require("../index");
|
|
83
83
|
var bcs_1 = require("@mysten/sui/bcs");
|
|
84
84
|
var utils_1 = require("@mysten/sui/utils");
|
|
85
|
-
/* ============================== Node =============================== */
|
|
86
|
-
function isNode(type) {
|
|
87
|
-
type = (0, util_1.compressSuiType)(type);
|
|
88
|
-
return type.startsWith("".concat(index_1.PKG_V1, "::linked_object_table::Node") + "<");
|
|
89
|
-
}
|
|
90
|
-
var Node = /** @class */ (function () {
|
|
91
|
-
function Node(typeArgs, fields) {
|
|
92
|
-
this.__StructClass = true;
|
|
93
|
-
this.$typeName = Node.$typeName;
|
|
94
|
-
this.$isPhantom = Node.$isPhantom;
|
|
95
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], __read(typeArgs), false));
|
|
96
|
-
this.$typeArgs = typeArgs;
|
|
97
|
-
this.prev = fields.prev;
|
|
98
|
-
this.next = fields.next;
|
|
99
|
-
}
|
|
100
|
-
Node.reified = function (K, V) {
|
|
101
|
-
var _this = this;
|
|
102
|
-
return {
|
|
103
|
-
typeName: Node.$typeName,
|
|
104
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], false)),
|
|
105
|
-
typeArgs: [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)],
|
|
106
|
-
isPhantom: Node.$isPhantom,
|
|
107
|
-
reifiedTypeArgs: [K, V],
|
|
108
|
-
fromFields: function (fields) { return Node.fromFields([K, V], fields); },
|
|
109
|
-
fromFieldsWithTypes: function (item) { return Node.fromFieldsWithTypes([K, V], item); },
|
|
110
|
-
fromBcs: function (data) { return Node.fromBcs([K, V], data); },
|
|
111
|
-
bcs: Node.bcs((0, reified_1.toBcs)(K)),
|
|
112
|
-
fromJSONField: function (field) { return Node.fromJSONField([K, V], field); },
|
|
113
|
-
fromJSON: function (json) { return Node.fromJSON([K, V], json); },
|
|
114
|
-
fromSuiParsedData: function (content) { return Node.fromSuiParsedData([K, V], content); },
|
|
115
|
-
fromSuiObjectData: function (content) { return Node.fromSuiObjectData([K, V], content); },
|
|
116
|
-
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
117
|
-
return [2 /*return*/, Node.fetch(client, [K, V], id)];
|
|
118
|
-
}); }); },
|
|
119
|
-
new: function (fields) {
|
|
120
|
-
return new Node([(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], fields);
|
|
121
|
-
},
|
|
122
|
-
kind: "StructClassReified",
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
Object.defineProperty(Node, "r", {
|
|
126
|
-
get: function () {
|
|
127
|
-
return Node.reified;
|
|
128
|
-
},
|
|
129
|
-
enumerable: false,
|
|
130
|
-
configurable: true
|
|
131
|
-
});
|
|
132
|
-
Node.phantom = function (K, V) {
|
|
133
|
-
return (0, reified_1.phantom)(Node.reified(K, V));
|
|
134
|
-
};
|
|
135
|
-
Object.defineProperty(Node, "p", {
|
|
136
|
-
get: function () {
|
|
137
|
-
return Node.phantom;
|
|
138
|
-
},
|
|
139
|
-
enumerable: false,
|
|
140
|
-
configurable: true
|
|
141
|
-
});
|
|
142
|
-
Object.defineProperty(Node, "bcs", {
|
|
143
|
-
get: function () {
|
|
144
|
-
return function (K) {
|
|
145
|
-
return bcs_1.bcs.struct("Node<".concat(K.name, ">"), {
|
|
146
|
-
prev: structs_1.Option.bcs(K),
|
|
147
|
-
next: structs_1.Option.bcs(K),
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
enumerable: false,
|
|
152
|
-
configurable: true
|
|
153
|
-
});
|
|
154
|
-
Node.fromFields = function (typeArgs, fields) {
|
|
155
|
-
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
156
|
-
prev: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.prev),
|
|
157
|
-
next: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.next),
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
Node.fromFieldsWithTypes = function (typeArgs, item) {
|
|
161
|
-
if (!isNode(item.type)) {
|
|
162
|
-
throw new Error("not a Node type");
|
|
163
|
-
}
|
|
164
|
-
(0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
|
|
165
|
-
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
166
|
-
prev: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.prev),
|
|
167
|
-
next: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.next),
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
Node.fromBcs = function (typeArgs, data) {
|
|
171
|
-
return Node.fromFields(typeArgs, Node.bcs((0, reified_1.toBcs)(typeArgs[0])).parse(data));
|
|
172
|
-
};
|
|
173
|
-
Node.prototype.toJSONField = function () {
|
|
174
|
-
return {
|
|
175
|
-
prev: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.prev),
|
|
176
|
-
next: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.next),
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
Node.prototype.toJSON = function () {
|
|
180
|
-
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
181
|
-
};
|
|
182
|
-
Node.fromJSONField = function (typeArgs, field) {
|
|
183
|
-
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
184
|
-
prev: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.prev),
|
|
185
|
-
next: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.next),
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
Node.fromJSON = function (typeArgs, json) {
|
|
189
|
-
if (json.$typeName !== Node.$typeName) {
|
|
190
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
191
|
-
}
|
|
192
|
-
(0, reified_1.assertReifiedTypeArgsMatch)(util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], __read(typeArgs.map(reified_1.extractType)), false)), json.$typeArgs, typeArgs);
|
|
193
|
-
return Node.fromJSONField(typeArgs, json);
|
|
194
|
-
};
|
|
195
|
-
Node.fromSuiParsedData = function (typeArgs, content) {
|
|
196
|
-
if (content.dataType !== "moveObject") {
|
|
197
|
-
throw new Error("not an object");
|
|
198
|
-
}
|
|
199
|
-
if (!isNode(content.type)) {
|
|
200
|
-
throw new Error("object at ".concat(content.fields.id, " is not a Node object"));
|
|
201
|
-
}
|
|
202
|
-
return Node.fromFieldsWithTypes(typeArgs, content);
|
|
203
|
-
};
|
|
204
|
-
Node.fromSuiObjectData = function (typeArgs, data) {
|
|
205
|
-
if (data.bcs) {
|
|
206
|
-
if (data.bcs.dataType !== "moveObject" || !isNode(data.bcs.type)) {
|
|
207
|
-
throw new Error("object at is not a Node object");
|
|
208
|
-
}
|
|
209
|
-
var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
|
|
210
|
-
if (gotTypeArgs.length !== 2) {
|
|
211
|
-
throw new Error("type argument mismatch: expected 2 type arguments but got ".concat(gotTypeArgs.length));
|
|
212
|
-
}
|
|
213
|
-
for (var i = 0; i < 2; i++) {
|
|
214
|
-
var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
|
|
215
|
-
var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
|
|
216
|
-
if (gotTypeArg !== expectedTypeArg) {
|
|
217
|
-
throw new Error("type argument mismatch at position ".concat(i, ": expected '").concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return Node.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
221
|
-
}
|
|
222
|
-
if (data.content) {
|
|
223
|
-
return Node.fromSuiParsedData(typeArgs, data.content);
|
|
224
|
-
}
|
|
225
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
226
|
-
};
|
|
227
|
-
Node.fetch = function (client, typeArgs, id) {
|
|
228
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
229
|
-
var res;
|
|
230
|
-
var _a, _b;
|
|
231
|
-
return __generator(this, function (_c) {
|
|
232
|
-
switch (_c.label) {
|
|
233
|
-
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
234
|
-
case 1:
|
|
235
|
-
res = _c.sent();
|
|
236
|
-
if (res.error) {
|
|
237
|
-
throw new Error("error fetching Node object at id ".concat(id, ": ").concat(res.error.code));
|
|
238
|
-
}
|
|
239
|
-
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)) {
|
|
240
|
-
throw new Error("object at id ".concat(id, " is not a Node object"));
|
|
241
|
-
}
|
|
242
|
-
return [2 /*return*/, Node.fromSuiObjectData(typeArgs, res.data)];
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
};
|
|
247
|
-
Node.$typeName = "".concat(index_1.PKG_V1, "::linked_object_table::Node");
|
|
248
|
-
Node.$numTypeParams = 2;
|
|
249
|
-
Node.$isPhantom = [false, true];
|
|
250
|
-
return Node;
|
|
251
|
-
}());
|
|
252
|
-
exports.Node = Node;
|
|
253
85
|
/* ============================== LinkedObjectTable =============================== */
|
|
254
86
|
function isLinkedObjectTable(type) {
|
|
255
87
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -436,3 +268,171 @@ var LinkedObjectTable = /** @class */ (function () {
|
|
|
436
268
|
return LinkedObjectTable;
|
|
437
269
|
}());
|
|
438
270
|
exports.LinkedObjectTable = LinkedObjectTable;
|
|
271
|
+
/* ============================== Node =============================== */
|
|
272
|
+
function isNode(type) {
|
|
273
|
+
type = (0, util_1.compressSuiType)(type);
|
|
274
|
+
return type.startsWith("".concat(index_1.PKG_V1, "::linked_object_table::Node") + "<");
|
|
275
|
+
}
|
|
276
|
+
var Node = /** @class */ (function () {
|
|
277
|
+
function Node(typeArgs, fields) {
|
|
278
|
+
this.__StructClass = true;
|
|
279
|
+
this.$typeName = Node.$typeName;
|
|
280
|
+
this.$isPhantom = Node.$isPhantom;
|
|
281
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], __read(typeArgs), false));
|
|
282
|
+
this.$typeArgs = typeArgs;
|
|
283
|
+
this.prev = fields.prev;
|
|
284
|
+
this.next = fields.next;
|
|
285
|
+
}
|
|
286
|
+
Node.reified = function (K, V) {
|
|
287
|
+
var _this = this;
|
|
288
|
+
return {
|
|
289
|
+
typeName: Node.$typeName,
|
|
290
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Node.$typeName], [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], false)),
|
|
291
|
+
typeArgs: [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)],
|
|
292
|
+
isPhantom: Node.$isPhantom,
|
|
293
|
+
reifiedTypeArgs: [K, V],
|
|
294
|
+
fromFields: function (fields) { return Node.fromFields([K, V], fields); },
|
|
295
|
+
fromFieldsWithTypes: function (item) { return Node.fromFieldsWithTypes([K, V], item); },
|
|
296
|
+
fromBcs: function (data) { return Node.fromBcs([K, V], data); },
|
|
297
|
+
bcs: Node.bcs((0, reified_1.toBcs)(K)),
|
|
298
|
+
fromJSONField: function (field) { return Node.fromJSONField([K, V], field); },
|
|
299
|
+
fromJSON: function (json) { return Node.fromJSON([K, V], json); },
|
|
300
|
+
fromSuiParsedData: function (content) { return Node.fromSuiParsedData([K, V], content); },
|
|
301
|
+
fromSuiObjectData: function (content) { return Node.fromSuiObjectData([K, V], content); },
|
|
302
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
303
|
+
return [2 /*return*/, Node.fetch(client, [K, V], id)];
|
|
304
|
+
}); }); },
|
|
305
|
+
new: function (fields) {
|
|
306
|
+
return new Node([(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], fields);
|
|
307
|
+
},
|
|
308
|
+
kind: "StructClassReified",
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
Object.defineProperty(Node, "r", {
|
|
312
|
+
get: function () {
|
|
313
|
+
return Node.reified;
|
|
314
|
+
},
|
|
315
|
+
enumerable: false,
|
|
316
|
+
configurable: true
|
|
317
|
+
});
|
|
318
|
+
Node.phantom = function (K, V) {
|
|
319
|
+
return (0, reified_1.phantom)(Node.reified(K, V));
|
|
320
|
+
};
|
|
321
|
+
Object.defineProperty(Node, "p", {
|
|
322
|
+
get: function () {
|
|
323
|
+
return Node.phantom;
|
|
324
|
+
},
|
|
325
|
+
enumerable: false,
|
|
326
|
+
configurable: true
|
|
327
|
+
});
|
|
328
|
+
Object.defineProperty(Node, "bcs", {
|
|
329
|
+
get: function () {
|
|
330
|
+
return function (K) {
|
|
331
|
+
return bcs_1.bcs.struct("Node<".concat(K.name, ">"), {
|
|
332
|
+
prev: structs_1.Option.bcs(K),
|
|
333
|
+
next: structs_1.Option.bcs(K),
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
enumerable: false,
|
|
338
|
+
configurable: true
|
|
339
|
+
});
|
|
340
|
+
Node.fromFields = function (typeArgs, fields) {
|
|
341
|
+
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
342
|
+
prev: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.prev),
|
|
343
|
+
next: (0, reified_1.decodeFromFields)(structs_1.Option.reified(typeArgs[0]), fields.next),
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
Node.fromFieldsWithTypes = function (typeArgs, item) {
|
|
347
|
+
if (!isNode(item.type)) {
|
|
348
|
+
throw new Error("not a Node type");
|
|
349
|
+
}
|
|
350
|
+
(0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
|
|
351
|
+
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
352
|
+
prev: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.prev),
|
|
353
|
+
next: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(typeArgs[0]), item.fields.next),
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
Node.fromBcs = function (typeArgs, data) {
|
|
357
|
+
return Node.fromFields(typeArgs, Node.bcs((0, reified_1.toBcs)(typeArgs[0])).parse(data));
|
|
358
|
+
};
|
|
359
|
+
Node.prototype.toJSONField = function () {
|
|
360
|
+
return {
|
|
361
|
+
prev: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.prev),
|
|
362
|
+
next: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(this.$typeArgs[0], ">"), this.next),
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
Node.prototype.toJSON = function () {
|
|
366
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
367
|
+
};
|
|
368
|
+
Node.fromJSONField = function (typeArgs, field) {
|
|
369
|
+
return Node.reified(typeArgs[0], typeArgs[1]).new({
|
|
370
|
+
prev: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.prev),
|
|
371
|
+
next: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(typeArgs[0]), field.next),
|
|
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_V1, "::linked_object_table::Node");
|
|
434
|
+
Node.$numTypeParams = 2;
|
|
435
|
+
Node.$isPhantom = [false, true];
|
|
436
|
+
return Node;
|
|
437
|
+
}());
|
|
438
|
+
exports.Node = Node;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeStr, TypeArgument } from "../../../../_framework/reified";
|
|
2
|
+
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
3
|
+
import { Option } from "../../0x1/option/structs";
|
|
4
|
+
import { UID } from "../../0x2/object/structs";
|
|
5
|
+
import { PKG_V1 } from "../index";
|
|
6
|
+
import { BcsType } from "@mysten/sui/bcs";
|
|
7
|
+
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
8
|
+
export declare function isLinkedSet(type: string): boolean;
|
|
9
|
+
export interface LinkedSetFields<K extends TypeArgument> {
|
|
10
|
+
id: ToField<UID>;
|
|
11
|
+
size: ToField<"u64">;
|
|
12
|
+
head: ToField<Option<K>>;
|
|
13
|
+
tail: ToField<Option<K>>;
|
|
14
|
+
}
|
|
15
|
+
export type LinkedSetReified<K extends TypeArgument> = Reified<LinkedSet<K>, LinkedSetFields<K>>;
|
|
16
|
+
export declare class LinkedSet<K extends TypeArgument> implements StructClass {
|
|
17
|
+
__StructClass: true;
|
|
18
|
+
static readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_set::LinkedSet";
|
|
19
|
+
static readonly $numTypeParams = 1;
|
|
20
|
+
static readonly $isPhantom: readonly [false];
|
|
21
|
+
readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_set::LinkedSet";
|
|
22
|
+
readonly $fullTypeName: `${typeof PKG_V1}::linked_set::LinkedSet<${ToTypeStr<K>}>`;
|
|
23
|
+
readonly $typeArgs: [ToTypeStr<K>];
|
|
24
|
+
readonly $isPhantom: readonly [false];
|
|
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>>(K: K): LinkedSetReified<ToTypeArgument<K>>;
|
|
31
|
+
static get r(): typeof LinkedSet.reified;
|
|
32
|
+
static phantom<K extends Reified<TypeArgument, any>>(K: K): PhantomReified<ToTypeStr<LinkedSet<ToTypeArgument<K>>>>;
|
|
33
|
+
static get p(): typeof LinkedSet.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>>(typeArg: K, fields: Record<string, any>): LinkedSet<ToTypeArgument<K>>;
|
|
66
|
+
static fromFieldsWithTypes<K extends Reified<TypeArgument, any>>(typeArg: K, item: FieldsWithTypes): LinkedSet<ToTypeArgument<K>>;
|
|
67
|
+
static fromBcs<K extends Reified<TypeArgument, any>>(typeArg: K, data: Uint8Array): LinkedSet<ToTypeArgument<K>>;
|
|
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>];
|
|
81
|
+
};
|
|
82
|
+
static fromJSONField<K extends Reified<TypeArgument, any>>(typeArg: K, field: any): LinkedSet<ToTypeArgument<K>>;
|
|
83
|
+
static fromJSON<K extends Reified<TypeArgument, any>>(typeArg: K, json: Record<string, any>): LinkedSet<ToTypeArgument<K>>;
|
|
84
|
+
static fromSuiParsedData<K extends Reified<TypeArgument, any>>(typeArg: K, content: SuiParsedData): LinkedSet<ToTypeArgument<K>>;
|
|
85
|
+
static fromSuiObjectData<K extends Reified<TypeArgument, any>>(typeArg: K, data: SuiObjectData): LinkedSet<ToTypeArgument<K>>;
|
|
86
|
+
static fetch<K extends Reified<TypeArgument, any>>(client: SuiClient, typeArg: K, id: string): Promise<LinkedSet<ToTypeArgument<K>>>;
|
|
87
|
+
}
|
|
88
|
+
export declare function isNode(type: string): boolean;
|
|
89
|
+
export interface NodeFields<K extends TypeArgument> {
|
|
90
|
+
prev: ToField<Option<K>>;
|
|
91
|
+
next: ToField<Option<K>>;
|
|
92
|
+
}
|
|
93
|
+
export type NodeReified<K extends TypeArgument> = Reified<Node<K>, NodeFields<K>>;
|
|
94
|
+
export declare class Node<K extends TypeArgument> implements StructClass {
|
|
95
|
+
__StructClass: true;
|
|
96
|
+
static readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_set::Node";
|
|
97
|
+
static readonly $numTypeParams = 1;
|
|
98
|
+
static readonly $isPhantom: readonly [false];
|
|
99
|
+
readonly $typeName = "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::linked_set::Node";
|
|
100
|
+
readonly $fullTypeName: `${typeof PKG_V1}::linked_set::Node<${ToTypeStr<K>}>`;
|
|
101
|
+
readonly $typeArgs: [ToTypeStr<K>];
|
|
102
|
+
readonly $isPhantom: readonly [false];
|
|
103
|
+
readonly prev: ToField<Option<K>>;
|
|
104
|
+
readonly next: ToField<Option<K>>;
|
|
105
|
+
private constructor();
|
|
106
|
+
static reified<K extends Reified<TypeArgument, any>>(K: K): NodeReified<ToTypeArgument<K>>;
|
|
107
|
+
static get r(): typeof Node.reified;
|
|
108
|
+
static phantom<K extends Reified<TypeArgument, any>>(K: K): PhantomReified<ToTypeStr<Node<ToTypeArgument<K>>>>;
|
|
109
|
+
static get p(): typeof Node.phantom;
|
|
110
|
+
static get bcs(): <K extends BcsType<any>>(K: K) => BcsType<{
|
|
111
|
+
prev: {
|
|
112
|
+
vec: any[];
|
|
113
|
+
};
|
|
114
|
+
next: {
|
|
115
|
+
vec: any[];
|
|
116
|
+
};
|
|
117
|
+
}, {
|
|
118
|
+
prev: {
|
|
119
|
+
vec: Iterable<any> & {
|
|
120
|
+
length: number;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
next: {
|
|
124
|
+
vec: Iterable<any> & {
|
|
125
|
+
length: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}>;
|
|
129
|
+
static fromFields<K extends Reified<TypeArgument, any>>(typeArg: K, fields: Record<string, any>): Node<ToTypeArgument<K>>;
|
|
130
|
+
static fromFieldsWithTypes<K extends Reified<TypeArgument, any>>(typeArg: K, item: FieldsWithTypes): Node<ToTypeArgument<K>>;
|
|
131
|
+
static fromBcs<K extends Reified<TypeArgument, any>>(typeArg: K, data: Uint8Array): Node<ToTypeArgument<K>>;
|
|
132
|
+
toJSONField(): {
|
|
133
|
+
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
134
|
+
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
135
|
+
};
|
|
136
|
+
toJSON(): {
|
|
137
|
+
prev: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
138
|
+
next: import("../../../../_framework/reified").ToJSON<K> | null;
|
|
139
|
+
$typeName: string;
|
|
140
|
+
$typeArgs: [ToTypeStr<K>];
|
|
141
|
+
};
|
|
142
|
+
static fromJSONField<K extends Reified<TypeArgument, any>>(typeArg: K, field: any): Node<ToTypeArgument<K>>;
|
|
143
|
+
static fromJSON<K extends Reified<TypeArgument, any>>(typeArg: K, json: Record<string, any>): Node<ToTypeArgument<K>>;
|
|
144
|
+
static fromSuiParsedData<K extends Reified<TypeArgument, any>>(typeArg: K, content: SuiParsedData): Node<ToTypeArgument<K>>;
|
|
145
|
+
static fromSuiObjectData<K extends Reified<TypeArgument, any>>(typeArg: K, data: SuiObjectData): Node<ToTypeArgument<K>>;
|
|
146
|
+
static fetch<K extends Reified<TypeArgument, any>>(client: SuiClient, typeArg: K, id: string): Promise<Node<ToTypeArgument<K>>>;
|
|
147
|
+
}
|