@suilend/sdk 1.1.18 → 1.1.20
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/source/0x1/ascii/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x1/ascii/structs.js +7 -7
- package/_generated/_dependencies/source/0x1/index.d.ts +1 -1
- package/_generated/_dependencies/source/0x1/index.js +2 -2
- package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x1/option/structs.js +4 -4
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +2 -2
- package/_generated/_dependencies/source/0x1/type-name/structs.js +4 -4
- package/_generated/_dependencies/source/0x2/bag/structs.js +2 -2
- package/_generated/_dependencies/source/0x2/balance/structs.js +3 -3
- package/_generated/_dependencies/source/0x2/object/structs.js +3 -3
- package/_generated/_dependencies/source/0x2/object-table/structs.js +2 -2
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +2 -2
- package/_generated/_framework/reified.js +10 -10
- package/_generated/_framework/util.d.ts +11 -5
- package/_generated/_framework/util.js +13 -12
- package/_generated/_framework/vector.d.ts +1 -1
- package/_generated/_framework/vector.js +2 -2
- package/_generated/suilend/cell/structs.d.ts +3 -3
- package/_generated/suilend/cell/structs.js +2 -2
- package/_generated/suilend/decimal/structs.d.ts +3 -3
- package/_generated/suilend/decimal/structs.js +2 -2
- package/_generated/suilend/index.d.ts +3 -3
- package/_generated/suilend/index.js +11 -5
- package/_generated/suilend/lending-market/functions.d.ts +50 -6
- package/_generated/suilend/lending-market/functions.js +136 -41
- package/_generated/suilend/lending-market/structs.d.ts +192 -192
- package/_generated/suilend/lending-market/structs.js +392 -392
- package/_generated/suilend/lending-market-registry/functions.js +3 -2
- package/_generated/suilend/liquidity-mining/structs.d.ts +14 -14
- package/_generated/suilend/liquidity-mining/structs.js +6 -6
- package/_generated/suilend/obligation/structs.d.ts +17 -17
- package/_generated/suilend/obligation/structs.js +7 -7
- package/_generated/suilend/rate-limiter/functions.js +7 -6
- package/_generated/suilend/rate-limiter/structs.d.ts +6 -6
- package/_generated/suilend/rate-limiter/structs.js +3 -3
- package/_generated/suilend/reserve/structs.d.ts +179 -15
- package/_generated/suilend/reserve/structs.js +434 -7
- package/_generated/suilend/reserve-config/functions.d.ts +7 -7
- package/_generated/suilend/reserve-config/functions.js +54 -53
- package/_generated/suilend/reserve-config/structs.d.ts +6 -6
- package/_generated/suilend/reserve-config/structs.js +3 -3
- package/client.d.ts +2 -2
- package/client.js +44 -12
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +10 -1
- package/parsers/lendingMarket.js +0 -1
- package/parsers/obligation.d.ts +18 -0
- package/parsers/obligation.js +0 -1
- package/parsers/reserve.d.ts +21 -0
- package/parsers/reserve.js +13 -1
- package/utils/events.js +3 -3
- package/utils/obligation.js +6 -5
|
@@ -2,7 +2,7 @@ import * as reified from "../../../../_framework/reified";
|
|
|
2
2
|
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../../../_framework/reified";
|
|
3
3
|
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
4
4
|
import { Vector } from "../../../../_framework/vector";
|
|
5
|
-
import {
|
|
5
|
+
import { PKG_V11 } from "../index";
|
|
6
6
|
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
7
7
|
export declare function isChar(type: string): boolean;
|
|
8
8
|
export interface CharFields {
|
|
@@ -15,7 +15,7 @@ export declare class Char implements StructClass {
|
|
|
15
15
|
static readonly $numTypeParams = 0;
|
|
16
16
|
static readonly $isPhantom: readonly [];
|
|
17
17
|
readonly $typeName = "0x1::ascii::Char";
|
|
18
|
-
readonly $fullTypeName: `${typeof
|
|
18
|
+
readonly $fullTypeName: `${typeof PKG_V11}::ascii::Char`;
|
|
19
19
|
readonly $typeArgs: [];
|
|
20
20
|
readonly $isPhantom: readonly [];
|
|
21
21
|
readonly byte: ToField<"u8">;
|
|
@@ -57,7 +57,7 @@ export declare class String implements StructClass {
|
|
|
57
57
|
static readonly $numTypeParams = 0;
|
|
58
58
|
static readonly $isPhantom: readonly [];
|
|
59
59
|
readonly $typeName = "0x1::ascii::String";
|
|
60
|
-
readonly $fullTypeName: `${typeof
|
|
60
|
+
readonly $fullTypeName: `${typeof PKG_V11}::ascii::String`;
|
|
61
61
|
readonly $typeArgs: [];
|
|
62
62
|
readonly $isPhantom: readonly [];
|
|
63
63
|
readonly bytes: ToField<Vector<"u8">>;
|
|
@@ -32,9 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.String = exports.Char = void 0;
|
|
36
|
-
exports.isChar = isChar;
|
|
37
|
-
exports.isString = isString;
|
|
35
|
+
exports.String = exports.isString = exports.Char = exports.isChar = void 0;
|
|
38
36
|
const reified = __importStar(require("../../../../_framework/reified"));
|
|
39
37
|
const reified_1 = require("../../../../_framework/reified");
|
|
40
38
|
const util_1 = require("../../../../_framework/util");
|
|
@@ -44,8 +42,9 @@ const utils_1 = require("@mysten/sui/utils");
|
|
|
44
42
|
/* ============================== Char =============================== */
|
|
45
43
|
function isChar(type) {
|
|
46
44
|
type = (0, util_1.compressSuiType)(type);
|
|
47
|
-
return type === `${index_1.
|
|
45
|
+
return type === `${index_1.PKG_V11}::ascii::Char`;
|
|
48
46
|
}
|
|
47
|
+
exports.isChar = isChar;
|
|
49
48
|
class Char {
|
|
50
49
|
constructor(typeArgs, fields) {
|
|
51
50
|
this.__StructClass = true;
|
|
@@ -159,14 +158,15 @@ class Char {
|
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
exports.Char = Char;
|
|
162
|
-
Char.$typeName = `${index_1.
|
|
161
|
+
Char.$typeName = `${index_1.PKG_V11}::ascii::Char`;
|
|
163
162
|
Char.$numTypeParams = 0;
|
|
164
163
|
Char.$isPhantom = [];
|
|
165
164
|
/* ============================== String =============================== */
|
|
166
165
|
function isString(type) {
|
|
167
166
|
type = (0, util_1.compressSuiType)(type);
|
|
168
|
-
return type === `${index_1.
|
|
167
|
+
return type === `${index_1.PKG_V11}::ascii::String`;
|
|
169
168
|
}
|
|
169
|
+
exports.isString = isString;
|
|
170
170
|
class String {
|
|
171
171
|
constructor(typeArgs, fields) {
|
|
172
172
|
this.__StructClass = true;
|
|
@@ -284,6 +284,6 @@ class String {
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
exports.String = String;
|
|
287
|
-
String.$typeName = `${index_1.
|
|
287
|
+
String.$typeName = `${index_1.PKG_V11}::ascii::String`;
|
|
288
288
|
String.$numTypeParams = 0;
|
|
289
289
|
String.$isPhantom = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PKG_V11 = exports.PUBLISHED_AT = exports.PACKAGE_ID = void 0;
|
|
4
4
|
exports.PACKAGE_ID = "0x1";
|
|
5
5
|
exports.PUBLISHED_AT = "0x1";
|
|
6
|
-
exports.
|
|
6
|
+
exports.PKG_V11 = "0x1";
|
|
@@ -2,7 +2,7 @@ import * as reified from "../../../../_framework/reified";
|
|
|
2
2
|
import { PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeStr, TypeArgument } from "../../../../_framework/reified";
|
|
3
3
|
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
4
4
|
import { Vector } from "../../../../_framework/vector";
|
|
5
|
-
import {
|
|
5
|
+
import { PKG_V11 } from "../index";
|
|
6
6
|
import { BcsType } from "@mysten/sui/bcs";
|
|
7
7
|
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
8
8
|
export declare function isOption(type: string): boolean;
|
|
@@ -17,7 +17,7 @@ export declare class Option<Element extends TypeArgument> implements StructClass
|
|
|
17
17
|
static readonly $isPhantom: readonly [false];
|
|
18
18
|
__inner: Element;
|
|
19
19
|
readonly $typeName = "0x1::option::Option";
|
|
20
|
-
readonly $fullTypeName: `${typeof
|
|
20
|
+
readonly $fullTypeName: `${typeof PKG_V11}::option::Option<${ToTypeStr<Element>}>`;
|
|
21
21
|
readonly $typeArgs: [ToTypeStr<Element>];
|
|
22
22
|
readonly $isPhantom: readonly [false];
|
|
23
23
|
readonly vec: ToField<Vector<Element>>;
|
|
@@ -26,7 +26,7 @@ export declare class Option<Element extends TypeArgument> implements StructClass
|
|
|
26
26
|
static get r(): typeof Option.reified;
|
|
27
27
|
static phantom<Element extends Reified<TypeArgument, any>>(Element: Element): PhantomReified<ToTypeStr<Option<ToTypeArgument<Element>>>>;
|
|
28
28
|
static get p(): typeof Option.phantom;
|
|
29
|
-
static get bcs(): <Element extends BcsType<any>>(Element: Element) => BcsType<{
|
|
29
|
+
static get bcs(): <Element extends BcsType<any, any>>(Element: Element) => BcsType<{
|
|
30
30
|
vec: any[];
|
|
31
31
|
}, {
|
|
32
32
|
vec: Iterable<any> & {
|
|
@@ -32,8 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.Option = void 0;
|
|
36
|
-
exports.isOption = isOption;
|
|
35
|
+
exports.Option = exports.isOption = void 0;
|
|
37
36
|
const reified = __importStar(require("../../../../_framework/reified"));
|
|
38
37
|
const reified_1 = require("../../../../_framework/reified");
|
|
39
38
|
const util_1 = require("../../../../_framework/util");
|
|
@@ -43,8 +42,9 @@ const utils_1 = require("@mysten/sui/utils");
|
|
|
43
42
|
/* ============================== Option =============================== */
|
|
44
43
|
function isOption(type) {
|
|
45
44
|
type = (0, util_1.compressSuiType)(type);
|
|
46
|
-
return type.startsWith(`${index_1.
|
|
45
|
+
return type.startsWith(`${index_1.PKG_V11}::option::Option` + "<");
|
|
47
46
|
}
|
|
47
|
+
exports.isOption = isOption;
|
|
48
48
|
class Option {
|
|
49
49
|
constructor(typeArgs, fields) {
|
|
50
50
|
this.__StructClass = true;
|
|
@@ -175,6 +175,6 @@ class Option {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
exports.Option = Option;
|
|
178
|
-
Option.$typeName = `${index_1.
|
|
178
|
+
Option.$typeName = `${index_1.PKG_V11}::option::Option`;
|
|
179
179
|
Option.$numTypeParams = 1;
|
|
180
180
|
Option.$isPhantom = [false];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../../../_framework/reified";
|
|
2
2
|
import { FieldsWithTypes } from "../../../../_framework/util";
|
|
3
3
|
import { String } from "../ascii/structs";
|
|
4
|
-
import {
|
|
4
|
+
import { PKG_V11 } from "../index";
|
|
5
5
|
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
6
6
|
export declare function isTypeName(type: string): boolean;
|
|
7
7
|
export interface TypeNameFields {
|
|
@@ -14,7 +14,7 @@ export declare class TypeName implements StructClass {
|
|
|
14
14
|
static readonly $numTypeParams = 0;
|
|
15
15
|
static readonly $isPhantom: readonly [];
|
|
16
16
|
readonly $typeName = "0x1::type_name::TypeName";
|
|
17
|
-
readonly $fullTypeName: `${typeof
|
|
17
|
+
readonly $fullTypeName: `${typeof PKG_V11}::type_name::TypeName`;
|
|
18
18
|
readonly $typeArgs: [];
|
|
19
19
|
readonly $isPhantom: readonly [];
|
|
20
20
|
readonly name: ToField<String>;
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TypeName = void 0;
|
|
13
|
-
exports.isTypeName = isTypeName;
|
|
12
|
+
exports.TypeName = exports.isTypeName = void 0;
|
|
14
13
|
const reified_1 = require("../../../../_framework/reified");
|
|
15
14
|
const util_1 = require("../../../../_framework/util");
|
|
16
15
|
const structs_1 = require("../ascii/structs");
|
|
@@ -20,8 +19,9 @@ const utils_1 = require("@mysten/sui/utils");
|
|
|
20
19
|
/* ============================== TypeName =============================== */
|
|
21
20
|
function isTypeName(type) {
|
|
22
21
|
type = (0, util_1.compressSuiType)(type);
|
|
23
|
-
return type === `${index_1.
|
|
22
|
+
return type === `${index_1.PKG_V11}::type_name::TypeName`;
|
|
24
23
|
}
|
|
24
|
+
exports.isTypeName = isTypeName;
|
|
25
25
|
class TypeName {
|
|
26
26
|
constructor(typeArgs, fields) {
|
|
27
27
|
this.__StructClass = true;
|
|
@@ -139,6 +139,6 @@ class TypeName {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
exports.TypeName = TypeName;
|
|
142
|
-
TypeName.$typeName = `${index_1.
|
|
142
|
+
TypeName.$typeName = `${index_1.PKG_V11}::type_name::TypeName`;
|
|
143
143
|
TypeName.$numTypeParams = 0;
|
|
144
144
|
TypeName.$isPhantom = [];
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Bag = void 0;
|
|
13
|
-
exports.isBag = isBag;
|
|
12
|
+
exports.Bag = exports.isBag = void 0;
|
|
14
13
|
const reified_1 = require("../../../../_framework/reified");
|
|
15
14
|
const util_1 = require("../../../../_framework/util");
|
|
16
15
|
const index_1 = require("../index");
|
|
@@ -22,6 +21,7 @@ function isBag(type) {
|
|
|
22
21
|
type = (0, util_1.compressSuiType)(type);
|
|
23
22
|
return type === `${index_1.PKG_V28}::bag::Bag`;
|
|
24
23
|
}
|
|
24
|
+
exports.isBag = isBag;
|
|
25
25
|
class Bag {
|
|
26
26
|
constructor(typeArgs, fields) {
|
|
27
27
|
this.__StructClass = true;
|
|
@@ -9,9 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Supply = exports.Balance = void 0;
|
|
13
|
-
exports.isBalance = isBalance;
|
|
14
|
-
exports.isSupply = isSupply;
|
|
12
|
+
exports.Supply = exports.isSupply = exports.Balance = exports.isBalance = void 0;
|
|
15
13
|
const reified_1 = require("../../../../_framework/reified");
|
|
16
14
|
const util_1 = require("../../../../_framework/util");
|
|
17
15
|
const index_1 = require("../index");
|
|
@@ -22,6 +20,7 @@ function isBalance(type) {
|
|
|
22
20
|
type = (0, util_1.compressSuiType)(type);
|
|
23
21
|
return type.startsWith(`${index_1.PKG_V28}::balance::Balance` + "<");
|
|
24
22
|
}
|
|
23
|
+
exports.isBalance = isBalance;
|
|
25
24
|
class Balance {
|
|
26
25
|
constructor(typeArgs, fields) {
|
|
27
26
|
this.__StructClass = true;
|
|
@@ -158,6 +157,7 @@ function isSupply(type) {
|
|
|
158
157
|
type = (0, util_1.compressSuiType)(type);
|
|
159
158
|
return type.startsWith(`${index_1.PKG_V28}::balance::Supply` + "<");
|
|
160
159
|
}
|
|
160
|
+
exports.isSupply = isSupply;
|
|
161
161
|
class Supply {
|
|
162
162
|
constructor(typeArgs, fields) {
|
|
163
163
|
this.__StructClass = true;
|
|
@@ -9,9 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UID = exports.ID = void 0;
|
|
13
|
-
exports.isID = isID;
|
|
14
|
-
exports.isUID = isUID;
|
|
12
|
+
exports.UID = exports.isUID = exports.ID = exports.isID = void 0;
|
|
15
13
|
const reified_1 = require("../../../../_framework/reified");
|
|
16
14
|
const util_1 = require("../../../../_framework/util");
|
|
17
15
|
const index_1 = require("../index");
|
|
@@ -22,6 +20,7 @@ function isID(type) {
|
|
|
22
20
|
type = (0, util_1.compressSuiType)(type);
|
|
23
21
|
return type === `${index_1.PKG_V28}::object::ID`;
|
|
24
22
|
}
|
|
23
|
+
exports.isID = isID;
|
|
25
24
|
class ID {
|
|
26
25
|
constructor(typeArgs, fields) {
|
|
27
26
|
this.__StructClass = true;
|
|
@@ -151,6 +150,7 @@ function isUID(type) {
|
|
|
151
150
|
type = (0, util_1.compressSuiType)(type);
|
|
152
151
|
return type === `${index_1.PKG_V28}::object::UID`;
|
|
153
152
|
}
|
|
153
|
+
exports.isUID = isUID;
|
|
154
154
|
class UID {
|
|
155
155
|
constructor(typeArgs, fields) {
|
|
156
156
|
this.__StructClass = true;
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ObjectTable = void 0;
|
|
13
|
-
exports.isObjectTable = isObjectTable;
|
|
12
|
+
exports.ObjectTable = exports.isObjectTable = void 0;
|
|
14
13
|
const reified_1 = require("../../../../_framework/reified");
|
|
15
14
|
const util_1 = require("../../../../_framework/util");
|
|
16
15
|
const index_1 = require("../index");
|
|
@@ -22,6 +21,7 @@ function isObjectTable(type) {
|
|
|
22
21
|
type = (0, util_1.compressSuiType)(type);
|
|
23
22
|
return type.startsWith(`${index_1.PKG_V28}::object_table::ObjectTable` + "<");
|
|
24
23
|
}
|
|
24
|
+
exports.isObjectTable = isObjectTable;
|
|
25
25
|
class ObjectTable {
|
|
26
26
|
constructor(typeArgs, fields) {
|
|
27
27
|
this.__StructClass = true;
|
|
@@ -32,8 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.PriceIdentifier = void 0;
|
|
36
|
-
exports.isPriceIdentifier = isPriceIdentifier;
|
|
35
|
+
exports.PriceIdentifier = exports.isPriceIdentifier = void 0;
|
|
37
36
|
const reified = __importStar(require("../../../../_framework/reified"));
|
|
38
37
|
const reified_1 = require("../../../../_framework/reified");
|
|
39
38
|
const util_1 = require("../../../../_framework/util");
|
|
@@ -45,6 +44,7 @@ function isPriceIdentifier(type) {
|
|
|
45
44
|
type = (0, util_1.compressSuiType)(type);
|
|
46
45
|
return type === `${index_1.PKG_V1}::price_identifier::PriceIdentifier`;
|
|
47
46
|
}
|
|
47
|
+
exports.isPriceIdentifier = isPriceIdentifier;
|
|
48
48
|
class PriceIdentifier {
|
|
49
49
|
constructor(typeArgs, fields) {
|
|
50
50
|
this.__StructClass = true;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vector = void 0;
|
|
4
|
-
exports.phantom = phantom;
|
|
5
|
-
exports.toBcs = toBcs;
|
|
6
|
-
exports.extractType = extractType;
|
|
7
|
-
exports.decodeFromFields = decodeFromFields;
|
|
8
|
-
exports.decodeFromFieldsWithTypes = decodeFromFieldsWithTypes;
|
|
9
|
-
exports.assertReifiedTypeArgsMatch = assertReifiedTypeArgsMatch;
|
|
10
|
-
exports.assertFieldsWithTypesArgsMatch = assertFieldsWithTypesArgsMatch;
|
|
11
|
-
exports.fieldToJSON = fieldToJSON;
|
|
12
|
-
exports.decodeFromJSONField = decodeFromJSONField;
|
|
3
|
+
exports.decodeFromJSONField = exports.fieldToJSON = exports.assertFieldsWithTypesArgsMatch = exports.assertReifiedTypeArgsMatch = exports.decodeFromFieldsWithTypes = exports.decodeFromFields = exports.extractType = exports.toBcs = exports.phantom = exports.vector = void 0;
|
|
13
4
|
const bcs_1 = require("@mysten/sui/bcs");
|
|
14
5
|
const utils_1 = require("@mysten/sui/utils");
|
|
15
6
|
const util_1 = require("./util");
|
|
@@ -30,6 +21,7 @@ function phantom(type) {
|
|
|
30
21
|
};
|
|
31
22
|
}
|
|
32
23
|
}
|
|
24
|
+
exports.phantom = phantom;
|
|
33
25
|
const Address = bcs_1.bcs.bytes(32).transform({
|
|
34
26
|
input: (val) => (0, utils_1.fromHEX)(val),
|
|
35
27
|
output: (val) => (0, utils_1.toHEX)(val),
|
|
@@ -56,6 +48,7 @@ function toBcs(arg) {
|
|
|
56
48
|
return arg.bcs;
|
|
57
49
|
}
|
|
58
50
|
}
|
|
51
|
+
exports.toBcs = toBcs;
|
|
59
52
|
function extractType(reified) {
|
|
60
53
|
switch (reified) {
|
|
61
54
|
case "u8":
|
|
@@ -78,6 +71,7 @@ function extractType(reified) {
|
|
|
78
71
|
}
|
|
79
72
|
throw new Error("unreachable");
|
|
80
73
|
}
|
|
74
|
+
exports.extractType = extractType;
|
|
81
75
|
function decodeFromFields(reified, field) {
|
|
82
76
|
switch (reified) {
|
|
83
77
|
case "bool":
|
|
@@ -117,6 +111,7 @@ function decodeFromFields(reified, field) {
|
|
|
117
111
|
return reified.fromFields(field);
|
|
118
112
|
}
|
|
119
113
|
}
|
|
114
|
+
exports.decodeFromFields = decodeFromFields;
|
|
120
115
|
function decodeFromFieldsWithTypes(reified, item) {
|
|
121
116
|
switch (reified) {
|
|
122
117
|
case "bool":
|
|
@@ -154,6 +149,7 @@ function decodeFromFieldsWithTypes(reified, item) {
|
|
|
154
149
|
return reified.fromFieldsWithTypes(item);
|
|
155
150
|
}
|
|
156
151
|
}
|
|
152
|
+
exports.decodeFromFieldsWithTypes = decodeFromFieldsWithTypes;
|
|
157
153
|
function assertReifiedTypeArgsMatch(fullType, typeArgs, reifiedTypeArgs) {
|
|
158
154
|
if (reifiedTypeArgs.length !== typeArgs.length) {
|
|
159
155
|
throw new Error(`provided item has mismatching number of type argments ${fullType} (expected ${reifiedTypeArgs.length}, got ${typeArgs.length}))`);
|
|
@@ -165,10 +161,12 @@ function assertReifiedTypeArgsMatch(fullType, typeArgs, reifiedTypeArgs) {
|
|
|
165
161
|
}
|
|
166
162
|
}
|
|
167
163
|
}
|
|
164
|
+
exports.assertReifiedTypeArgsMatch = assertReifiedTypeArgsMatch;
|
|
168
165
|
function assertFieldsWithTypesArgsMatch(item, reifiedTypeArgs) {
|
|
169
166
|
const { typeArgs: itemTypeArgs } = (0, util_1.parseTypeName)(item.type);
|
|
170
167
|
assertReifiedTypeArgsMatch(item.type, itemTypeArgs, reifiedTypeArgs);
|
|
171
168
|
}
|
|
169
|
+
exports.assertFieldsWithTypesArgsMatch = assertFieldsWithTypesArgsMatch;
|
|
172
170
|
function fieldToJSON(type, field) {
|
|
173
171
|
const { typeName, typeArgs } = (0, util_1.parseTypeName)(type);
|
|
174
172
|
switch (typeName) {
|
|
@@ -204,6 +202,7 @@ function fieldToJSON(type, field) {
|
|
|
204
202
|
return field.toJSONField();
|
|
205
203
|
}
|
|
206
204
|
}
|
|
205
|
+
exports.fieldToJSON = fieldToJSON;
|
|
207
206
|
function decodeFromJSONField(typeArg, field) {
|
|
208
207
|
switch (typeArg) {
|
|
209
208
|
case "bool":
|
|
@@ -238,3 +237,4 @@ function decodeFromJSONField(typeArg, field) {
|
|
|
238
237
|
return typeArg.fromJSONField(field);
|
|
239
238
|
}
|
|
240
239
|
}
|
|
240
|
+
exports.decodeFromJSONField = decodeFromJSONField;
|
|
@@ -16,15 +16,21 @@ export declare function obj(tx: Transaction, arg: TransactionObjectInput): {
|
|
|
16
16
|
GasCoin: true;
|
|
17
17
|
} | {
|
|
18
18
|
Input: number;
|
|
19
|
-
type?: "
|
|
19
|
+
type?: "object" | "pure" | undefined;
|
|
20
20
|
} | {
|
|
21
21
|
Result: number;
|
|
22
22
|
} | {
|
|
23
23
|
NestedResult: [number, number];
|
|
24
|
-
} | ((tx: Transaction) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
} | ((tx: Transaction) => {
|
|
25
|
+
GasCoin: true;
|
|
26
|
+
} | {
|
|
27
|
+
Input: number;
|
|
28
|
+
type?: "object" | "pure" | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
Result: number;
|
|
31
|
+
} | {
|
|
32
|
+
NestedResult: [number, number];
|
|
33
|
+
});
|
|
28
34
|
export declare function pure(tx: Transaction, arg: PureArg, type: string): TransactionArgument;
|
|
29
35
|
export declare function option(tx: Transaction, type: string, arg: GenericArg | null): TransactionArgument;
|
|
30
36
|
export declare function generic(tx: Transaction, type: string, arg: GenericArg): TransactionArgument;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitGenericParameters =
|
|
4
|
-
exports.parseTypeName = parseTypeName;
|
|
5
|
-
exports.isTransactionArgument = isTransactionArgument;
|
|
6
|
-
exports.obj = obj;
|
|
7
|
-
exports.pure = pure;
|
|
8
|
-
exports.option = option;
|
|
9
|
-
exports.generic = generic;
|
|
10
|
-
exports.vector = vector;
|
|
11
|
-
exports.typeArgIsPure = typeArgIsPure;
|
|
12
|
-
exports.compressSuiAddress = compressSuiAddress;
|
|
13
|
-
exports.compressSuiType = compressSuiType;
|
|
14
|
-
exports.composeSuiType = composeSuiType;
|
|
3
|
+
exports.composeSuiType = exports.compressSuiType = exports.compressSuiAddress = exports.typeArgIsPure = exports.vector = exports.generic = exports.option = exports.pure = exports.obj = exports.isTransactionArgument = exports.parseTypeName = exports.splitGenericParameters = void 0;
|
|
15
4
|
const bcs_1 = require("@mysten/sui/bcs");
|
|
16
5
|
function splitGenericParameters(str, genericSeparators = ["<", ">"]) {
|
|
17
6
|
const [left, right] = genericSeparators;
|
|
@@ -36,6 +25,7 @@ function splitGenericParameters(str, genericSeparators = ["<", ">"]) {
|
|
|
36
25
|
tok.push(word.trim());
|
|
37
26
|
return tok;
|
|
38
27
|
}
|
|
28
|
+
exports.splitGenericParameters = splitGenericParameters;
|
|
39
29
|
function parseTypeName(name) {
|
|
40
30
|
if (typeof name !== "string") {
|
|
41
31
|
throw new Error(`Illegal type passed as a name of the type: ${name}`);
|
|
@@ -55,6 +45,7 @@ function parseTypeName(name) {
|
|
|
55
45
|
const typeArgs = splitGenericParameters(name.slice(l_bound + 1, name.length - r_bound - 1), [left, right]);
|
|
56
46
|
return { typeName, typeArgs };
|
|
57
47
|
}
|
|
48
|
+
exports.parseTypeName = parseTypeName;
|
|
58
49
|
function isTransactionArgument(arg) {
|
|
59
50
|
if (!arg || typeof arg !== "object" || Array.isArray(arg)) {
|
|
60
51
|
return false;
|
|
@@ -64,9 +55,11 @@ function isTransactionArgument(arg) {
|
|
|
64
55
|
"Result" in arg ||
|
|
65
56
|
"NestedResult" in arg);
|
|
66
57
|
}
|
|
58
|
+
exports.isTransactionArgument = isTransactionArgument;
|
|
67
59
|
function obj(tx, arg) {
|
|
68
60
|
return isTransactionArgument(arg) ? arg : tx.object(arg);
|
|
69
61
|
}
|
|
62
|
+
exports.obj = obj;
|
|
70
63
|
function pure(tx, arg, type) {
|
|
71
64
|
if (isTransactionArgument(arg)) {
|
|
72
65
|
return obj(tx, arg);
|
|
@@ -194,6 +187,7 @@ function pure(tx, arg, type) {
|
|
|
194
187
|
return tx.pure(getBcsForType(type).serialize(arg));
|
|
195
188
|
}
|
|
196
189
|
}
|
|
190
|
+
exports.pure = pure;
|
|
197
191
|
function option(tx, type, arg) {
|
|
198
192
|
if (isTransactionArgument(arg)) {
|
|
199
193
|
return arg;
|
|
@@ -216,6 +210,7 @@ function option(tx, type, arg) {
|
|
|
216
210
|
arguments: [val],
|
|
217
211
|
});
|
|
218
212
|
}
|
|
213
|
+
exports.option = option;
|
|
219
214
|
function generic(tx, type, arg) {
|
|
220
215
|
if (typeArgIsPure(type)) {
|
|
221
216
|
return pure(tx, arg, type);
|
|
@@ -234,6 +229,7 @@ function generic(tx, type, arg) {
|
|
|
234
229
|
}
|
|
235
230
|
}
|
|
236
231
|
}
|
|
232
|
+
exports.generic = generic;
|
|
237
233
|
function vector(tx, itemType, items) {
|
|
238
234
|
if (typeof items === "function") {
|
|
239
235
|
throw new Error("Transaction plugins are not supported");
|
|
@@ -259,6 +255,7 @@ function vector(tx, itemType, items) {
|
|
|
259
255
|
});
|
|
260
256
|
}
|
|
261
257
|
}
|
|
258
|
+
exports.vector = vector;
|
|
262
259
|
function typeArgIsPure(type) {
|
|
263
260
|
const { typeName, typeArgs } = parseTypeName(type);
|
|
264
261
|
switch (typeName) {
|
|
@@ -284,6 +281,7 @@ function typeArgIsPure(type) {
|
|
|
284
281
|
return false;
|
|
285
282
|
}
|
|
286
283
|
}
|
|
284
|
+
exports.typeArgIsPure = typeArgIsPure;
|
|
287
285
|
function compressSuiAddress(addr) {
|
|
288
286
|
// remove leading zeros
|
|
289
287
|
const stripped = addr.split("0x").join("");
|
|
@@ -294,6 +292,7 @@ function compressSuiAddress(addr) {
|
|
|
294
292
|
}
|
|
295
293
|
return "0x0";
|
|
296
294
|
}
|
|
295
|
+
exports.compressSuiAddress = compressSuiAddress;
|
|
297
296
|
// Recursively removes leading zeros from a type.
|
|
298
297
|
// e.g. `0x00000002::module::Name<0x00001::a::C>` -> `0x2::module::Name<0x1::a::C>`
|
|
299
298
|
function compressSuiType(type) {
|
|
@@ -324,6 +323,7 @@ function compressSuiType(type) {
|
|
|
324
323
|
}
|
|
325
324
|
}
|
|
326
325
|
}
|
|
326
|
+
exports.compressSuiType = compressSuiType;
|
|
327
327
|
function composeSuiType(typeName, ...typeArgs) {
|
|
328
328
|
if (typeArgs.length > 0) {
|
|
329
329
|
return `${typeName}<${typeArgs.join(", ")}>`;
|
|
@@ -332,3 +332,4 @@ function composeSuiType(typeName, ...typeArgs) {
|
|
|
332
332
|
return typeName;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
+
exports.composeSuiType = composeSuiType;
|
|
@@ -17,7 +17,7 @@ export declare class Vector<T extends TypeArgument> implements VectorClass {
|
|
|
17
17
|
static get r(): typeof Vector.reified;
|
|
18
18
|
static get bcs(): <T, Input>(type: import("@mysten/sui/bcs").BcsType<T, Input>, options?: import("@mysten/sui/bcs").BcsTypeOptions<T[], Iterable<Input> & {
|
|
19
19
|
length: number;
|
|
20
|
-
}>) => import("@mysten/sui/bcs").BcsType<T[], Iterable<Input> & {
|
|
20
|
+
}> | undefined) => import("@mysten/sui/bcs").BcsType<T[], Iterable<Input> & {
|
|
21
21
|
length: number;
|
|
22
22
|
}>;
|
|
23
23
|
static fromFields<T extends Reified<TypeArgument, any>>(typeArg: T, elements: any[]): Vector<ToTypeArgument<T>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Vector = void 0;
|
|
4
|
-
exports.vector = vector;
|
|
3
|
+
exports.vector = exports.Vector = void 0;
|
|
5
4
|
const bcs_1 = require("@mysten/sui/bcs");
|
|
6
5
|
const reified_1 = require("./reified");
|
|
7
6
|
const util_1 = require("./util");
|
|
@@ -75,3 +74,4 @@ Vector.$isPhantom = [false];
|
|
|
75
74
|
function vector(T) {
|
|
76
75
|
return Vector.r(T);
|
|
77
76
|
}
|
|
77
|
+
exports.vector = vector;
|
|
@@ -11,10 +11,10 @@ export interface CellFields<Element extends TypeArgument> {
|
|
|
11
11
|
export type CellReified<Element extends TypeArgument> = Reified<Cell<Element>, CellFields<Element>>;
|
|
12
12
|
export declare class Cell<Element extends TypeArgument> implements StructClass {
|
|
13
13
|
__StructClass: true;
|
|
14
|
-
static readonly $typeName
|
|
14
|
+
static readonly $typeName: string;
|
|
15
15
|
static readonly $numTypeParams = 1;
|
|
16
16
|
static readonly $isPhantom: readonly [false];
|
|
17
|
-
readonly $typeName
|
|
17
|
+
readonly $typeName: string;
|
|
18
18
|
readonly $fullTypeName: `${typeof PKG_V1}::cell::Cell<${ToTypeStr<Element>}>`;
|
|
19
19
|
readonly $typeArgs: [ToTypeStr<Element>];
|
|
20
20
|
readonly $isPhantom: readonly [false];
|
|
@@ -24,7 +24,7 @@ export declare class Cell<Element extends TypeArgument> implements StructClass {
|
|
|
24
24
|
static get r(): typeof Cell.reified;
|
|
25
25
|
static phantom<Element extends Reified<TypeArgument, any>>(Element: Element): PhantomReified<ToTypeStr<Cell<ToTypeArgument<Element>>>>;
|
|
26
26
|
static get p(): typeof Cell.phantom;
|
|
27
|
-
static get bcs(): <Element extends BcsType<any>>(Element: Element) => BcsType<{
|
|
27
|
+
static get bcs(): <Element extends BcsType<any, any>>(Element: Element) => BcsType<{
|
|
28
28
|
element: {
|
|
29
29
|
vec: any[];
|
|
30
30
|
};
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Cell = void 0;
|
|
13
|
-
exports.isCell = isCell;
|
|
12
|
+
exports.Cell = exports.isCell = void 0;
|
|
14
13
|
const structs_1 = require("../../_dependencies/source/0x1/option/structs");
|
|
15
14
|
const reified_1 = require("../../_framework/reified");
|
|
16
15
|
const util_1 = require("../../_framework/util");
|
|
@@ -22,6 +21,7 @@ function isCell(type) {
|
|
|
22
21
|
type = (0, util_1.compressSuiType)(type);
|
|
23
22
|
return type.startsWith(`${index_1.PKG_V1}::cell::Cell` + "<");
|
|
24
23
|
}
|
|
24
|
+
exports.isCell = isCell;
|
|
25
25
|
class Cell {
|
|
26
26
|
constructor(typeArgs, fields) {
|
|
27
27
|
this.__StructClass = true;
|
|
@@ -9,10 +9,10 @@ export interface DecimalFields {
|
|
|
9
9
|
export type DecimalReified = Reified<Decimal, DecimalFields>;
|
|
10
10
|
export declare class Decimal implements StructClass {
|
|
11
11
|
__StructClass: true;
|
|
12
|
-
static readonly $typeName
|
|
12
|
+
static readonly $typeName: string;
|
|
13
13
|
static readonly $numTypeParams = 0;
|
|
14
14
|
static readonly $isPhantom: readonly [];
|
|
15
|
-
readonly $typeName
|
|
15
|
+
readonly $typeName: string;
|
|
16
16
|
readonly $fullTypeName: `${typeof PKG_V1}::decimal::Decimal`;
|
|
17
17
|
readonly $typeArgs: [];
|
|
18
18
|
readonly $isPhantom: readonly [];
|
|
@@ -21,7 +21,7 @@ export declare class Decimal implements StructClass {
|
|
|
21
21
|
static reified(): DecimalReified;
|
|
22
22
|
static get r(): import("../../_framework/reified").StructClassReified<Decimal, DecimalFields>;
|
|
23
23
|
static phantom(): PhantomReified<ToTypeStr<Decimal>>;
|
|
24
|
-
static get p(): PhantomReified<"0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::decimal::Decimal">;
|
|
24
|
+
static get p(): PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::decimal::Decimal" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::decimal::Decimal">;
|
|
25
25
|
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
26
26
|
value: string;
|
|
27
27
|
}, {
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Decimal = void 0;
|
|
13
|
-
exports.isDecimal = isDecimal;
|
|
12
|
+
exports.Decimal = exports.isDecimal = void 0;
|
|
14
13
|
const reified_1 = require("../../_framework/reified");
|
|
15
14
|
const util_1 = require("../../_framework/util");
|
|
16
15
|
const index_1 = require("../index");
|
|
@@ -21,6 +20,7 @@ function isDecimal(type) {
|
|
|
21
20
|
type = (0, util_1.compressSuiType)(type);
|
|
22
21
|
return type === `${index_1.PKG_V1}::decimal::Decimal`;
|
|
23
22
|
}
|
|
23
|
+
exports.isDecimal = isDecimal;
|
|
24
24
|
class Decimal {
|
|
25
25
|
constructor(typeArgs, fields) {
|
|
26
26
|
this.__StructClass = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PACKAGE_ID
|
|
2
|
-
export declare
|
|
1
|
+
export declare const PACKAGE_ID: string;
|
|
2
|
+
export declare let PUBLISHED_AT: string;
|
|
3
|
+
export declare const PKG_V1: string;
|
|
3
4
|
export declare function setPublishedAt(publishedAt: string): void;
|
|
4
|
-
export declare const PKG_V1 = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
|