@suilend/sdk 12.7.0 → 13.0.0-next.g122801a
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/_generated/_dependencies/pyth-2/price-identifier/structs.d.ts +46 -0
- package/_generated/_dependencies/{source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e → pyth-2}/price-identifier/structs.js +45 -25
- package/_generated/_dependencies/std/ascii/structs.d.ts +100 -0
- package/_generated/_dependencies/{source/0x1 → std}/ascii/structs.js +153 -103
- package/_generated/_dependencies/{source/0x1 → std}/option/structs.d.ts +29 -21
- package/_generated/_dependencies/std/option/structs.js +155 -0
- package/_generated/_dependencies/std/type-name/structs.d.ts +65 -0
- package/_generated/_dependencies/{source/0x1 → std}/type-name/structs.js +49 -22
- package/_generated/_dependencies/sui/bag/structs.d.ts +75 -0
- package/_generated/_dependencies/sui/bag/structs.js +154 -0
- package/_generated/_dependencies/{source/0x2 → sui}/balance/structs.d.ts +80 -60
- package/_generated/_dependencies/sui/balance/structs.js +306 -0
- package/_generated/_dependencies/sui/object/structs.d.ts +104 -0
- package/_generated/_dependencies/{source/0x2 → sui}/object/structs.js +98 -46
- package/_generated/_dependencies/{source/0x2 → sui}/object-table/structs.d.ts +37 -30
- package/_generated/_dependencies/sui/object-table/structs.js +164 -0
- package/_generated/_envs/index.d.ts +3 -0
- package/_generated/_envs/index.js +18 -0
- package/_generated/_envs/mainnet.d.ts +2 -0
- package/_generated/_envs/mainnet.js +490 -0
- package/_generated/_framework/env.d.ts +137 -0
- package/_generated/_framework/env.js +261 -0
- package/_generated/_framework/reified.d.ts +68 -36
- package/_generated/_framework/reified.js +110 -98
- package/_generated/_framework/util.d.ts +4 -4
- package/_generated/_framework/util.js +82 -79
- package/_generated/_framework/vector.d.ts +11 -9
- package/_generated/_framework/vector.js +10 -10
- package/_generated/suilend/cell/structs.d.ts +24 -22
- package/_generated/suilend/cell/structs.js +68 -24
- package/_generated/suilend/decimal/structs.d.ts +28 -24
- package/_generated/suilend/decimal/structs.js +45 -24
- package/_generated/suilend/index.d.ts +5 -6
- package/_generated/suilend/index.js +10 -19
- package/_generated/suilend/lending-market/functions.d.ts +1123 -149
- package/_generated/suilend/lending-market/functions.js +1121 -207
- package/_generated/suilend/lending-market/structs.d.ts +985 -1290
- package/_generated/suilend/lending-market/structs.js +2482 -1282
- package/_generated/suilend/lending-market-registry/functions.d.ts +32 -3
- package/_generated/suilend/lending-market-registry/functions.js +30 -6
- package/_generated/suilend/liquidity-mining/structs.d.ts +200 -333
- package/_generated/suilend/liquidity-mining/structs.js +449 -319
- package/_generated/suilend/obligation/structs.d.ts +406 -918
- package/_generated/suilend/obligation/structs.js +786 -596
- package/_generated/suilend/rate-limiter/functions.d.ts +134 -15
- package/_generated/suilend/rate-limiter/functions.js +139 -21
- package/_generated/suilend/rate-limiter/structs.d.ts +72 -80
- package/_generated/suilend/rate-limiter/structs.js +98 -48
- package/_generated/suilend/reserve/structs.d.ts +611 -904
- package/_generated/suilend/reserve/structs.js +1528 -736
- package/_generated/suilend/reserve-config/functions.d.ts +718 -96
- package/_generated/suilend/reserve-config/functions.js +751 -157
- package/_generated/suilend/reserve-config/structs.d.ts +148 -163
- package/_generated/suilend/reserve-config/structs.js +260 -94
- package/client.d.ts +2 -2
- package/client.js +22 -39
- package/lib/initialize.d.ts +617 -83
- package/lib/initialize.js +151 -48
- package/lib/proCompatible.js +5 -5
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +9 -9
- package/parsers/obligation.d.ts +14 -14
- package/parsers/obligation.js +4 -4
- package/parsers/rateLimiter.d.ts +1 -1
- package/parsers/reserve.d.ts +12 -12
- package/parsers/reserve.js +2 -2
- package/strategies.d.ts +14 -14
- package/utils/obligation.d.ts +3 -0
- package/utils/obligation.js +10 -0
- package/utils/simulate.d.ts +1 -1
- package/utils/simulate.js +5 -5
- package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +0 -84
- package/_generated/_dependencies/source/0x1/index.d.ts +0 -3
- package/_generated/_dependencies/source/0x1/index.js +0 -3
- package/_generated/_dependencies/source/0x1/option/structs.js +0 -110
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +0 -47
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +0 -52
- package/_generated/_dependencies/source/0x2/bag/structs.js +0 -113
- package/_generated/_dependencies/source/0x2/balance/structs.js +0 -210
- package/_generated/_dependencies/source/0x2/index.d.ts +0 -3
- package/_generated/_dependencies/source/0x2/index.js +0 -3
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +0 -82
- package/_generated/_dependencies/source/0x2/object-table/structs.js +0 -115
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.d.ts +0 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js +0 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +0 -46
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
2
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
3
|
-
import { PKG_V30 } from "../index.js";
|
|
4
|
-
import { UID } from "../object/structs.js";
|
|
5
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
6
|
-
/* ============================== Bag =============================== */
|
|
7
|
-
export function isBag(type) {
|
|
8
|
-
type = compressSuiType(type);
|
|
9
|
-
return type === `${PKG_V30}::bag::Bag`;
|
|
10
|
-
}
|
|
11
|
-
export class Bag {
|
|
12
|
-
__StructClass = true;
|
|
13
|
-
static $typeName = `${PKG_V30}::bag::Bag`;
|
|
14
|
-
static $numTypeParams = 0;
|
|
15
|
-
static $isPhantom = [];
|
|
16
|
-
$typeName = Bag.$typeName;
|
|
17
|
-
$fullTypeName;
|
|
18
|
-
$typeArgs;
|
|
19
|
-
$isPhantom = Bag.$isPhantom;
|
|
20
|
-
id;
|
|
21
|
-
size;
|
|
22
|
-
constructor(typeArgs, fields) {
|
|
23
|
-
this.$fullTypeName = composeSuiType(Bag.$typeName, ...typeArgs);
|
|
24
|
-
this.$typeArgs = typeArgs;
|
|
25
|
-
this.id = fields.id;
|
|
26
|
-
this.size = fields.size;
|
|
27
|
-
}
|
|
28
|
-
static reified() {
|
|
29
|
-
return {
|
|
30
|
-
typeName: Bag.$typeName,
|
|
31
|
-
fullTypeName: composeSuiType(Bag.$typeName, ...[]),
|
|
32
|
-
typeArgs: [],
|
|
33
|
-
isPhantom: Bag.$isPhantom,
|
|
34
|
-
reifiedTypeArgs: [],
|
|
35
|
-
fromFields: (fields) => Bag.fromFields(fields),
|
|
36
|
-
fromFieldsWithTypes: (item) => Bag.fromFieldsWithTypes(item),
|
|
37
|
-
fromBcs: (data) => Bag.fromBcs(data),
|
|
38
|
-
bcs: Bag.bcs,
|
|
39
|
-
fromJSONField: (field) => Bag.fromJSONField(field),
|
|
40
|
-
fromJSON: (json) => Bag.fromJSON(json),
|
|
41
|
-
fetch: async (client, id) => Bag.fetch(client, id),
|
|
42
|
-
new: (fields) => {
|
|
43
|
-
return new Bag([], fields);
|
|
44
|
-
},
|
|
45
|
-
kind: "StructClassReified",
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
static get r() {
|
|
49
|
-
return Bag.reified();
|
|
50
|
-
}
|
|
51
|
-
static phantom() {
|
|
52
|
-
return phantom(Bag.reified());
|
|
53
|
-
}
|
|
54
|
-
static get p() {
|
|
55
|
-
return Bag.phantom();
|
|
56
|
-
}
|
|
57
|
-
static get bcs() {
|
|
58
|
-
return bcs.struct("Bag", {
|
|
59
|
-
id: UID.bcs,
|
|
60
|
-
size: bcs.u64(),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
static fromFields(fields) {
|
|
64
|
-
return Bag.reified().new({
|
|
65
|
-
id: decodeFromFields(UID.reified(), fields.id),
|
|
66
|
-
size: decodeFromFields("u64", fields.size),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
static fromFieldsWithTypes(item) {
|
|
70
|
-
if (!isBag(item.type)) {
|
|
71
|
-
throw new Error("not a Bag type");
|
|
72
|
-
}
|
|
73
|
-
return Bag.reified().new({
|
|
74
|
-
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
75
|
-
size: decodeFromFieldsWithTypes("u64", item.fields.size),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
static fromBcs(data) {
|
|
79
|
-
return Bag.fromFields(Bag.bcs.parse(data));
|
|
80
|
-
}
|
|
81
|
-
toJSONField() {
|
|
82
|
-
return {
|
|
83
|
-
id: this.id,
|
|
84
|
-
size: this.size.toString(),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
toJSON() {
|
|
88
|
-
return {
|
|
89
|
-
$typeName: this.$typeName,
|
|
90
|
-
$typeArgs: this.$typeArgs,
|
|
91
|
-
...this.toJSONField(),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
static fromJSONField(field) {
|
|
95
|
-
return Bag.reified().new({
|
|
96
|
-
id: decodeFromJSONField(UID.reified(), field.id),
|
|
97
|
-
size: decodeFromJSONField("u64", field.size),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
static fromJSON(json) {
|
|
101
|
-
if (json.$typeName !== Bag.$typeName) {
|
|
102
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
103
|
-
}
|
|
104
|
-
return Bag.fromJSONField(json);
|
|
105
|
-
}
|
|
106
|
-
static async fetch(client, id) {
|
|
107
|
-
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
108
|
-
if (!isBag(object.type)) {
|
|
109
|
-
throw new Error(`object at id ${id} is not a Bag object`);
|
|
110
|
-
}
|
|
111
|
-
return Bag.fromBcs(object.content);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../../../_framework/reified.js";
|
|
2
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
3
|
-
import { PKG_V30 } from "../index.js";
|
|
4
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
5
|
-
/* ============================== Balance =============================== */
|
|
6
|
-
export function isBalance(type) {
|
|
7
|
-
type = compressSuiType(type);
|
|
8
|
-
return type.startsWith(`${PKG_V30}::balance::Balance` + "<");
|
|
9
|
-
}
|
|
10
|
-
export class Balance {
|
|
11
|
-
__StructClass = true;
|
|
12
|
-
static $typeName = `${PKG_V30}::balance::Balance`;
|
|
13
|
-
static $numTypeParams = 1;
|
|
14
|
-
static $isPhantom = [true];
|
|
15
|
-
$typeName = Balance.$typeName;
|
|
16
|
-
$fullTypeName;
|
|
17
|
-
$typeArgs;
|
|
18
|
-
$isPhantom = Balance.$isPhantom;
|
|
19
|
-
value;
|
|
20
|
-
constructor(typeArgs, fields) {
|
|
21
|
-
this.$fullTypeName = composeSuiType(Balance.$typeName, ...typeArgs);
|
|
22
|
-
this.$typeArgs = typeArgs;
|
|
23
|
-
this.value = fields.value;
|
|
24
|
-
}
|
|
25
|
-
static reified(T) {
|
|
26
|
-
return {
|
|
27
|
-
typeName: Balance.$typeName,
|
|
28
|
-
fullTypeName: composeSuiType(Balance.$typeName, ...[extractType(T)]),
|
|
29
|
-
typeArgs: [extractType(T)],
|
|
30
|
-
isPhantom: Balance.$isPhantom,
|
|
31
|
-
reifiedTypeArgs: [T],
|
|
32
|
-
fromFields: (fields) => Balance.fromFields(T, fields),
|
|
33
|
-
fromFieldsWithTypes: (item) => Balance.fromFieldsWithTypes(T, item),
|
|
34
|
-
fromBcs: (data) => Balance.fromBcs(T, data),
|
|
35
|
-
bcs: Balance.bcs,
|
|
36
|
-
fromJSONField: (field) => Balance.fromJSONField(T, field),
|
|
37
|
-
fromJSON: (json) => Balance.fromJSON(T, json),
|
|
38
|
-
fetch: async (client, id) => Balance.fetch(client, T, id),
|
|
39
|
-
new: (fields) => {
|
|
40
|
-
return new Balance([extractType(T)], fields);
|
|
41
|
-
},
|
|
42
|
-
kind: "StructClassReified",
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
static get r() {
|
|
46
|
-
return Balance.reified;
|
|
47
|
-
}
|
|
48
|
-
static phantom(T) {
|
|
49
|
-
return phantom(Balance.reified(T));
|
|
50
|
-
}
|
|
51
|
-
static get p() {
|
|
52
|
-
return Balance.phantom;
|
|
53
|
-
}
|
|
54
|
-
static get bcs() {
|
|
55
|
-
return bcs.struct("Balance", {
|
|
56
|
-
value: bcs.u64(),
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
static fromFields(typeArg, fields) {
|
|
60
|
-
return Balance.reified(typeArg).new({
|
|
61
|
-
value: decodeFromFields("u64", fields.value),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
static fromFieldsWithTypes(typeArg, item) {
|
|
65
|
-
if (!isBalance(item.type)) {
|
|
66
|
-
throw new Error("not a Balance type");
|
|
67
|
-
}
|
|
68
|
-
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
69
|
-
return Balance.reified(typeArg).new({
|
|
70
|
-
value: decodeFromFieldsWithTypes("u64", item.fields.value),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
static fromBcs(typeArg, data) {
|
|
74
|
-
return Balance.fromFields(typeArg, Balance.bcs.parse(data));
|
|
75
|
-
}
|
|
76
|
-
toJSONField() {
|
|
77
|
-
return {
|
|
78
|
-
value: this.value.toString(),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
toJSON() {
|
|
82
|
-
return {
|
|
83
|
-
$typeName: this.$typeName,
|
|
84
|
-
$typeArgs: this.$typeArgs,
|
|
85
|
-
...this.toJSONField(),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
static fromJSONField(typeArg, field) {
|
|
89
|
-
return Balance.reified(typeArg).new({
|
|
90
|
-
value: decodeFromJSONField("u64", field.value),
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
static fromJSON(typeArg, json) {
|
|
94
|
-
if (json.$typeName !== Balance.$typeName) {
|
|
95
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
96
|
-
}
|
|
97
|
-
assertReifiedTypeArgsMatch(composeSuiType(Balance.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
98
|
-
return Balance.fromJSONField(typeArg, json);
|
|
99
|
-
}
|
|
100
|
-
static async fetch(client, typeArg, id) {
|
|
101
|
-
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
102
|
-
if (!isBalance(object.type)) {
|
|
103
|
-
throw new Error(`object at id ${id} is not a Balance object`);
|
|
104
|
-
}
|
|
105
|
-
return Balance.fromBcs(typeArg, object.content);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/* ============================== Supply =============================== */
|
|
109
|
-
export function isSupply(type) {
|
|
110
|
-
type = compressSuiType(type);
|
|
111
|
-
return type.startsWith(`${PKG_V30}::balance::Supply` + "<");
|
|
112
|
-
}
|
|
113
|
-
export class Supply {
|
|
114
|
-
__StructClass = true;
|
|
115
|
-
static $typeName = `${PKG_V30}::balance::Supply`;
|
|
116
|
-
static $numTypeParams = 1;
|
|
117
|
-
static $isPhantom = [true];
|
|
118
|
-
$typeName = Supply.$typeName;
|
|
119
|
-
$fullTypeName;
|
|
120
|
-
$typeArgs;
|
|
121
|
-
$isPhantom = Supply.$isPhantom;
|
|
122
|
-
value;
|
|
123
|
-
constructor(typeArgs, fields) {
|
|
124
|
-
this.$fullTypeName = composeSuiType(Supply.$typeName, ...typeArgs);
|
|
125
|
-
this.$typeArgs = typeArgs;
|
|
126
|
-
this.value = fields.value;
|
|
127
|
-
}
|
|
128
|
-
static reified(T) {
|
|
129
|
-
return {
|
|
130
|
-
typeName: Supply.$typeName,
|
|
131
|
-
fullTypeName: composeSuiType(Supply.$typeName, ...[extractType(T)]),
|
|
132
|
-
typeArgs: [extractType(T)],
|
|
133
|
-
isPhantom: Supply.$isPhantom,
|
|
134
|
-
reifiedTypeArgs: [T],
|
|
135
|
-
fromFields: (fields) => Supply.fromFields(T, fields),
|
|
136
|
-
fromFieldsWithTypes: (item) => Supply.fromFieldsWithTypes(T, item),
|
|
137
|
-
fromBcs: (data) => Supply.fromBcs(T, data),
|
|
138
|
-
bcs: Supply.bcs,
|
|
139
|
-
fromJSONField: (field) => Supply.fromJSONField(T, field),
|
|
140
|
-
fromJSON: (json) => Supply.fromJSON(T, json),
|
|
141
|
-
fetch: async (client, id) => Supply.fetch(client, T, id),
|
|
142
|
-
new: (fields) => {
|
|
143
|
-
return new Supply([extractType(T)], fields);
|
|
144
|
-
},
|
|
145
|
-
kind: "StructClassReified",
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
static get r() {
|
|
149
|
-
return Supply.reified;
|
|
150
|
-
}
|
|
151
|
-
static phantom(T) {
|
|
152
|
-
return phantom(Supply.reified(T));
|
|
153
|
-
}
|
|
154
|
-
static get p() {
|
|
155
|
-
return Supply.phantom;
|
|
156
|
-
}
|
|
157
|
-
static get bcs() {
|
|
158
|
-
return bcs.struct("Supply", {
|
|
159
|
-
value: bcs.u64(),
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
static fromFields(typeArg, fields) {
|
|
163
|
-
return Supply.reified(typeArg).new({
|
|
164
|
-
value: decodeFromFields("u64", fields.value),
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
static fromFieldsWithTypes(typeArg, item) {
|
|
168
|
-
if (!isSupply(item.type)) {
|
|
169
|
-
throw new Error("not a Supply type");
|
|
170
|
-
}
|
|
171
|
-
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
172
|
-
return Supply.reified(typeArg).new({
|
|
173
|
-
value: decodeFromFieldsWithTypes("u64", item.fields.value),
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
static fromBcs(typeArg, data) {
|
|
177
|
-
return Supply.fromFields(typeArg, Supply.bcs.parse(data));
|
|
178
|
-
}
|
|
179
|
-
toJSONField() {
|
|
180
|
-
return {
|
|
181
|
-
value: this.value.toString(),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
toJSON() {
|
|
185
|
-
return {
|
|
186
|
-
$typeName: this.$typeName,
|
|
187
|
-
$typeArgs: this.$typeArgs,
|
|
188
|
-
...this.toJSONField(),
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
static fromJSONField(typeArg, field) {
|
|
192
|
-
return Supply.reified(typeArg).new({
|
|
193
|
-
value: decodeFromJSONField("u64", field.value),
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
static fromJSON(typeArg, json) {
|
|
197
|
-
if (json.$typeName !== Supply.$typeName) {
|
|
198
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
199
|
-
}
|
|
200
|
-
assertReifiedTypeArgsMatch(composeSuiType(Supply.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
201
|
-
return Supply.fromJSONField(typeArg, json);
|
|
202
|
-
}
|
|
203
|
-
static async fetch(client, typeArg, id) {
|
|
204
|
-
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
205
|
-
if (!isSupply(object.type)) {
|
|
206
|
-
throw new Error(`object at id ${id} is not a Supply object`);
|
|
207
|
-
}
|
|
208
|
-
return Supply.fromBcs(typeArg, object.content);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../../../_framework/reified";
|
|
2
|
-
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
3
|
-
import { PKG_V30 } from "../index";
|
|
4
|
-
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
5
|
-
export declare function isID(type: string): boolean;
|
|
6
|
-
export interface IDFields {
|
|
7
|
-
bytes: ToField<"address">;
|
|
8
|
-
}
|
|
9
|
-
export type IDReified = Reified<ID, IDFields>;
|
|
10
|
-
export declare class ID implements StructClass {
|
|
11
|
-
__StructClass: true;
|
|
12
|
-
static readonly $typeName = "0x2::object::ID";
|
|
13
|
-
static readonly $numTypeParams = 0;
|
|
14
|
-
static readonly $isPhantom: readonly [];
|
|
15
|
-
readonly $typeName = "0x2::object::ID";
|
|
16
|
-
readonly $fullTypeName: `${typeof PKG_V30}::object::ID`;
|
|
17
|
-
readonly $typeArgs: [];
|
|
18
|
-
readonly $isPhantom: readonly [];
|
|
19
|
-
readonly bytes: ToField<"address">;
|
|
20
|
-
private constructor();
|
|
21
|
-
static reified(): IDReified;
|
|
22
|
-
static get r(): import("../../../../_framework/reified").StructClassReified<ID, IDFields>;
|
|
23
|
-
static phantom(): PhantomReified<ToTypeStr<ID>>;
|
|
24
|
-
static get p(): PhantomReified<"0x2::object::ID">;
|
|
25
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
26
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
27
|
-
}, string>;
|
|
28
|
-
static fromFields(fields: Record<string, any>): ID;
|
|
29
|
-
static fromFieldsWithTypes(item: FieldsWithTypes): ID;
|
|
30
|
-
static fromBcs(data: Uint8Array): ID;
|
|
31
|
-
toJSONField(): {
|
|
32
|
-
bytes: string;
|
|
33
|
-
};
|
|
34
|
-
toJSON(): {
|
|
35
|
-
bytes: string;
|
|
36
|
-
$typeName: string;
|
|
37
|
-
$typeArgs: [];
|
|
38
|
-
};
|
|
39
|
-
static fromJSONField(field: any): ID;
|
|
40
|
-
static fromJSON(json: Record<string, any>): ID;
|
|
41
|
-
static fetch(client: SuiGrpcClient, id: string): Promise<ID>;
|
|
42
|
-
}
|
|
43
|
-
export declare function isUID(type: string): boolean;
|
|
44
|
-
export interface UIDFields {
|
|
45
|
-
id: ToField<ID>;
|
|
46
|
-
}
|
|
47
|
-
export type UIDReified = Reified<UID, UIDFields>;
|
|
48
|
-
export declare class UID implements StructClass {
|
|
49
|
-
__StructClass: true;
|
|
50
|
-
static readonly $typeName = "0x2::object::UID";
|
|
51
|
-
static readonly $numTypeParams = 0;
|
|
52
|
-
static readonly $isPhantom: readonly [];
|
|
53
|
-
readonly $typeName = "0x2::object::UID";
|
|
54
|
-
readonly $fullTypeName: `${typeof PKG_V30}::object::UID`;
|
|
55
|
-
readonly $typeArgs: [];
|
|
56
|
-
readonly $isPhantom: readonly [];
|
|
57
|
-
readonly id: ToField<ID>;
|
|
58
|
-
private constructor();
|
|
59
|
-
static reified(): UIDReified;
|
|
60
|
-
static get r(): import("../../../../_framework/reified").StructClassReified<UID, UIDFields>;
|
|
61
|
-
static phantom(): PhantomReified<ToTypeStr<UID>>;
|
|
62
|
-
static get p(): PhantomReified<"0x2::object::UID">;
|
|
63
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
64
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
65
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
66
|
-
}, string>;
|
|
67
|
-
}, string>;
|
|
68
|
-
static fromFields(fields: Record<string, any>): UID;
|
|
69
|
-
static fromFieldsWithTypes(item: FieldsWithTypes): UID;
|
|
70
|
-
static fromBcs(data: Uint8Array): UID;
|
|
71
|
-
toJSONField(): {
|
|
72
|
-
id: string;
|
|
73
|
-
};
|
|
74
|
-
toJSON(): {
|
|
75
|
-
id: string;
|
|
76
|
-
$typeName: string;
|
|
77
|
-
$typeArgs: [];
|
|
78
|
-
};
|
|
79
|
-
static fromJSONField(field: any): UID;
|
|
80
|
-
static fromJSON(json: Record<string, any>): UID;
|
|
81
|
-
static fetch(client: SuiGrpcClient, id: string): Promise<UID>;
|
|
82
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../../../_framework/reified.js";
|
|
2
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
3
|
-
import { PKG_V30 } from "../index.js";
|
|
4
|
-
import { UID } from "../object/structs.js";
|
|
5
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
6
|
-
/* ============================== ObjectTable =============================== */
|
|
7
|
-
export function isObjectTable(type) {
|
|
8
|
-
type = compressSuiType(type);
|
|
9
|
-
return type.startsWith(`${PKG_V30}::object_table::ObjectTable` + "<");
|
|
10
|
-
}
|
|
11
|
-
export class ObjectTable {
|
|
12
|
-
__StructClass = true;
|
|
13
|
-
static $typeName = `${PKG_V30}::object_table::ObjectTable`;
|
|
14
|
-
static $numTypeParams = 2;
|
|
15
|
-
static $isPhantom = [true, true];
|
|
16
|
-
$typeName = ObjectTable.$typeName;
|
|
17
|
-
$fullTypeName;
|
|
18
|
-
$typeArgs;
|
|
19
|
-
$isPhantom = ObjectTable.$isPhantom;
|
|
20
|
-
id;
|
|
21
|
-
size;
|
|
22
|
-
constructor(typeArgs, fields) {
|
|
23
|
-
this.$fullTypeName = composeSuiType(ObjectTable.$typeName, ...typeArgs);
|
|
24
|
-
this.$typeArgs = typeArgs;
|
|
25
|
-
this.id = fields.id;
|
|
26
|
-
this.size = fields.size;
|
|
27
|
-
}
|
|
28
|
-
static reified(K, V) {
|
|
29
|
-
return {
|
|
30
|
-
typeName: ObjectTable.$typeName,
|
|
31
|
-
fullTypeName: composeSuiType(ObjectTable.$typeName, ...[extractType(K), extractType(V)]),
|
|
32
|
-
typeArgs: [extractType(K), extractType(V)],
|
|
33
|
-
isPhantom: ObjectTable.$isPhantom,
|
|
34
|
-
reifiedTypeArgs: [K, V],
|
|
35
|
-
fromFields: (fields) => ObjectTable.fromFields([K, V], fields),
|
|
36
|
-
fromFieldsWithTypes: (item) => ObjectTable.fromFieldsWithTypes([K, V], item),
|
|
37
|
-
fromBcs: (data) => ObjectTable.fromBcs([K, V], data),
|
|
38
|
-
bcs: ObjectTable.bcs,
|
|
39
|
-
fromJSONField: (field) => ObjectTable.fromJSONField([K, V], field),
|
|
40
|
-
fromJSON: (json) => ObjectTable.fromJSON([K, V], json),
|
|
41
|
-
fetch: async (client, id) => ObjectTable.fetch(client, [K, V], id),
|
|
42
|
-
new: (fields) => {
|
|
43
|
-
return new ObjectTable([extractType(K), extractType(V)], fields);
|
|
44
|
-
},
|
|
45
|
-
kind: "StructClassReified",
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
static get r() {
|
|
49
|
-
return ObjectTable.reified;
|
|
50
|
-
}
|
|
51
|
-
static phantom(K, V) {
|
|
52
|
-
return phantom(ObjectTable.reified(K, V));
|
|
53
|
-
}
|
|
54
|
-
static get p() {
|
|
55
|
-
return ObjectTable.phantom;
|
|
56
|
-
}
|
|
57
|
-
static get bcs() {
|
|
58
|
-
return bcs.struct("ObjectTable", {
|
|
59
|
-
id: UID.bcs,
|
|
60
|
-
size: bcs.u64(),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
static fromFields(typeArgs, fields) {
|
|
64
|
-
return ObjectTable.reified(typeArgs[0], typeArgs[1]).new({
|
|
65
|
-
id: decodeFromFields(UID.reified(), fields.id),
|
|
66
|
-
size: decodeFromFields("u64", fields.size),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
static fromFieldsWithTypes(typeArgs, item) {
|
|
70
|
-
if (!isObjectTable(item.type)) {
|
|
71
|
-
throw new Error("not a ObjectTable type");
|
|
72
|
-
}
|
|
73
|
-
assertFieldsWithTypesArgsMatch(item, typeArgs);
|
|
74
|
-
return ObjectTable.reified(typeArgs[0], typeArgs[1]).new({
|
|
75
|
-
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
76
|
-
size: decodeFromFieldsWithTypes("u64", item.fields.size),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
static fromBcs(typeArgs, data) {
|
|
80
|
-
return ObjectTable.fromFields(typeArgs, ObjectTable.bcs.parse(data));
|
|
81
|
-
}
|
|
82
|
-
toJSONField() {
|
|
83
|
-
return {
|
|
84
|
-
id: this.id,
|
|
85
|
-
size: this.size.toString(),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
toJSON() {
|
|
89
|
-
return {
|
|
90
|
-
$typeName: this.$typeName,
|
|
91
|
-
$typeArgs: this.$typeArgs,
|
|
92
|
-
...this.toJSONField(),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
static fromJSONField(typeArgs, field) {
|
|
96
|
-
return ObjectTable.reified(typeArgs[0], typeArgs[1]).new({
|
|
97
|
-
id: decodeFromJSONField(UID.reified(), field.id),
|
|
98
|
-
size: decodeFromJSONField("u64", field.size),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
static fromJSON(typeArgs, json) {
|
|
102
|
-
if (json.$typeName !== ObjectTable.$typeName) {
|
|
103
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
104
|
-
}
|
|
105
|
-
assertReifiedTypeArgsMatch(composeSuiType(ObjectTable.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
|
|
106
|
-
return ObjectTable.fromJSONField(typeArgs, json);
|
|
107
|
-
}
|
|
108
|
-
static async fetch(client, typeArgs, id) {
|
|
109
|
-
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
110
|
-
if (!isObjectTable(object.type)) {
|
|
111
|
-
throw new Error(`object at id ${id} is not a ObjectTable object`);
|
|
112
|
-
}
|
|
113
|
-
return ObjectTable.fromBcs(typeArgs, object.content);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const PACKAGE_ID = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e";
|
|
2
|
-
export declare const PUBLISHED_AT = "0x4e20ddf36af412a4096f9014f4a565af9e812db9a05cc40254846cf6ed0ad91";
|
|
3
|
-
export declare const PKG_V2 = "0x4e20ddf36af412a4096f9014f4a565af9e812db9a05cc40254846cf6ed0ad91";
|
|
4
|
-
export declare const PKG_V1 = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e";
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export const PACKAGE_ID = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e";
|
|
2
|
-
export const PUBLISHED_AT = "0x4e20ddf36af412a4096f9014f4a565af9e812db9a05cc40254846cf6ed0ad91";
|
|
3
|
-
export const PKG_V2 = "0x4e20ddf36af412a4096f9014f4a565af9e812db9a05cc40254846cf6ed0ad91";
|
|
4
|
-
export const PKG_V1 = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e";
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as reified from "../../../../_framework/reified";
|
|
2
|
-
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../../../_framework/reified";
|
|
3
|
-
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
4
|
-
import { Vector } from "../../../../_framework/vector";
|
|
5
|
-
import { PKG_V1 } from "../index";
|
|
6
|
-
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
7
|
-
export declare function isPriceIdentifier(type: string): boolean;
|
|
8
|
-
export interface PriceIdentifierFields {
|
|
9
|
-
bytes: ToField<Vector<"u8">>;
|
|
10
|
-
}
|
|
11
|
-
export type PriceIdentifierReified = Reified<PriceIdentifier, PriceIdentifierFields>;
|
|
12
|
-
export declare class PriceIdentifier implements StructClass {
|
|
13
|
-
__StructClass: true;
|
|
14
|
-
static readonly $typeName = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e::price_identifier::PriceIdentifier";
|
|
15
|
-
static readonly $numTypeParams = 0;
|
|
16
|
-
static readonly $isPhantom: readonly [];
|
|
17
|
-
readonly $typeName = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e::price_identifier::PriceIdentifier";
|
|
18
|
-
readonly $fullTypeName: `${typeof PKG_V1}::price_identifier::PriceIdentifier`;
|
|
19
|
-
readonly $typeArgs: [];
|
|
20
|
-
readonly $isPhantom: readonly [];
|
|
21
|
-
readonly bytes: ToField<Vector<"u8">>;
|
|
22
|
-
private constructor();
|
|
23
|
-
static reified(): PriceIdentifierReified;
|
|
24
|
-
static get r(): reified.StructClassReified<PriceIdentifier, PriceIdentifierFields>;
|
|
25
|
-
static phantom(): PhantomReified<ToTypeStr<PriceIdentifier>>;
|
|
26
|
-
static get p(): reified.PhantomReified<"0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e::price_identifier::PriceIdentifier">;
|
|
27
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
28
|
-
bytes: import("@mysten/bcs").BcsType<number[], Iterable<number> & {
|
|
29
|
-
length: number;
|
|
30
|
-
}, string>;
|
|
31
|
-
}, string>;
|
|
32
|
-
static fromFields(fields: Record<string, any>): PriceIdentifier;
|
|
33
|
-
static fromFieldsWithTypes(item: FieldsWithTypes): PriceIdentifier;
|
|
34
|
-
static fromBcs(data: Uint8Array): PriceIdentifier;
|
|
35
|
-
toJSONField(): {
|
|
36
|
-
bytes: number[];
|
|
37
|
-
};
|
|
38
|
-
toJSON(): {
|
|
39
|
-
bytes: number[];
|
|
40
|
-
$typeName: string;
|
|
41
|
-
$typeArgs: [];
|
|
42
|
-
};
|
|
43
|
-
static fromJSONField(field: any): PriceIdentifier;
|
|
44
|
-
static fromJSON(json: Record<string, any>): PriceIdentifier;
|
|
45
|
-
static fetch(client: SuiGrpcClient, id: string): Promise<PriceIdentifier>;
|
|
46
|
-
}
|