@suigar/sdk 2.0.0-beta.10 → 2.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +48 -0
- package/dist/{chunk-PPUDLRHA.js → chunk-TBJ5TYYE.js} +33 -23
- package/dist/{games-BccpPyWd.d.cts → games-BHYRg31e.d.cts} +13 -1
- package/dist/{games-BccpPyWd.d.ts → games-BHYRg31e.d.ts} +13 -1
- package/dist/games.d.cts +1 -1
- package/dist/games.d.ts +1 -1
- package/dist/index.cjs +462 -29
- package/dist/index.d.cts +217 -6
- package/dist/index.d.ts +217 -6
- package/dist/index.js +435 -9
- package/dist/utils.cjs +33 -22
- package/dist/utils.d.cts +47 -15
- package/dist/utils.d.ts +47 -15
- package/dist/utils.js +1 -1
- package/package.json +5 -5
package/dist/utils.d.cts
CHANGED
|
@@ -62,30 +62,62 @@ declare const RANGE_POINT_LIMIT: number;
|
|
|
62
62
|
declare const DEFAULT_LIMBO_MULTIPLIER_SCALE = 100;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Normalizes a
|
|
65
|
+
* Normalizes a value into a non-negative `bigint`.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
67
|
+
* Accepted inputs:
|
|
68
|
+
* - `bigint`
|
|
69
|
+
* - finite `number`
|
|
70
|
+
* - base-10 integer `string`
|
|
71
|
+
* - `boolean`
|
|
71
72
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
* Number inputs are truncated toward zero before conversion, so `5.9` becomes
|
|
74
|
+
* `5n`. String and boolean inputs are parsed through the native
|
|
75
|
+
* `BigInt(...)` constructor, so `true` becomes `1n`, `false` becomes `0n`,
|
|
76
|
+
* and only integer strings are accepted.
|
|
77
|
+
*
|
|
78
|
+
* @param value Value to normalize.
|
|
79
|
+
* @returns A non-negative `bigint`.
|
|
80
|
+
* @throws When `value` is not a bigint, finite number, integer string, or
|
|
81
|
+
* boolean.
|
|
82
|
+
* @throws When the normalized value is negative.
|
|
75
83
|
*/
|
|
76
84
|
declare function toBigInt(value: unknown): bigint;
|
|
77
85
|
/**
|
|
78
|
-
* Validates that a value can be safely used as a Move `u8
|
|
86
|
+
* Validates that a value can be safely used as a Move `u8` in the `0..255`
|
|
87
|
+
* range.
|
|
88
|
+
*
|
|
89
|
+
* Accepted inputs:
|
|
90
|
+
* - finite `number`
|
|
91
|
+
* - base-10 integer `string`
|
|
79
92
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
93
|
+
* String inputs are accepted for parsed values such as `'1'`, but only when
|
|
94
|
+
* they are plain non-negative integer strings. This helper does not accept
|
|
95
|
+
* booleans and does not truncate fractional values.
|
|
83
96
|
*
|
|
84
97
|
* @param value Value to validate.
|
|
85
|
-
* @returns The
|
|
86
|
-
* @throws When `value` is not a finite
|
|
98
|
+
* @returns The validated `u8` value as a JavaScript `number`.
|
|
99
|
+
* @throws When `value` is not a finite number or integer string.
|
|
100
|
+
* @throws When `value` is not an integer between `0` and `255`.
|
|
87
101
|
*/
|
|
88
102
|
declare function toU8(value: unknown): number;
|
|
103
|
+
/**
|
|
104
|
+
* Validates that a value can be safely used as a Move `u16` in the
|
|
105
|
+
* `0..65535` range.
|
|
106
|
+
*
|
|
107
|
+
* Accepted inputs:
|
|
108
|
+
* - finite `number`
|
|
109
|
+
* - base-10 integer `string`
|
|
110
|
+
*
|
|
111
|
+
* String inputs are accepted for parsed values such as `'1'`, but only when
|
|
112
|
+
* they are plain non-negative integer strings. This helper does not accept
|
|
113
|
+
* booleans and does not truncate fractional values.
|
|
114
|
+
*
|
|
115
|
+
* @param value Value to validate.
|
|
116
|
+
* @returns The validated `u16` value as a JavaScript `number`.
|
|
117
|
+
* @throws When `value` is not a finite number or integer string.
|
|
118
|
+
* @throws When `value` is not an integer between `0` and `65535`.
|
|
119
|
+
*/
|
|
120
|
+
declare function toU16(value: unknown): number;
|
|
89
121
|
|
|
90
122
|
declare const Float: MoveStruct<{
|
|
91
123
|
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
@@ -145,4 +177,4 @@ declare function parseCoinType(type: string): string;
|
|
|
145
177
|
*/
|
|
146
178
|
declare function parseGameDetails(gameDetails: BetResultGameDetails): ParsedGameDetails;
|
|
147
179
|
|
|
148
|
-
export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU8 };
|
|
180
|
+
export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU16, toU8 };
|
package/dist/utils.d.ts
CHANGED
|
@@ -62,30 +62,62 @@ declare const RANGE_POINT_LIMIT: number;
|
|
|
62
62
|
declare const DEFAULT_LIMBO_MULTIPLIER_SCALE = 100;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Normalizes a
|
|
65
|
+
* Normalizes a value into a non-negative `bigint`.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
67
|
+
* Accepted inputs:
|
|
68
|
+
* - `bigint`
|
|
69
|
+
* - finite `number`
|
|
70
|
+
* - base-10 integer `string`
|
|
71
|
+
* - `boolean`
|
|
71
72
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
* Number inputs are truncated toward zero before conversion, so `5.9` becomes
|
|
74
|
+
* `5n`. String and boolean inputs are parsed through the native
|
|
75
|
+
* `BigInt(...)` constructor, so `true` becomes `1n`, `false` becomes `0n`,
|
|
76
|
+
* and only integer strings are accepted.
|
|
77
|
+
*
|
|
78
|
+
* @param value Value to normalize.
|
|
79
|
+
* @returns A non-negative `bigint`.
|
|
80
|
+
* @throws When `value` is not a bigint, finite number, integer string, or
|
|
81
|
+
* boolean.
|
|
82
|
+
* @throws When the normalized value is negative.
|
|
75
83
|
*/
|
|
76
84
|
declare function toBigInt(value: unknown): bigint;
|
|
77
85
|
/**
|
|
78
|
-
* Validates that a value can be safely used as a Move `u8
|
|
86
|
+
* Validates that a value can be safely used as a Move `u8` in the `0..255`
|
|
87
|
+
* range.
|
|
88
|
+
*
|
|
89
|
+
* Accepted inputs:
|
|
90
|
+
* - finite `number`
|
|
91
|
+
* - base-10 integer `string`
|
|
79
92
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
93
|
+
* String inputs are accepted for parsed values such as `'1'`, but only when
|
|
94
|
+
* they are plain non-negative integer strings. This helper does not accept
|
|
95
|
+
* booleans and does not truncate fractional values.
|
|
83
96
|
*
|
|
84
97
|
* @param value Value to validate.
|
|
85
|
-
* @returns The
|
|
86
|
-
* @throws When `value` is not a finite
|
|
98
|
+
* @returns The validated `u8` value as a JavaScript `number`.
|
|
99
|
+
* @throws When `value` is not a finite number or integer string.
|
|
100
|
+
* @throws When `value` is not an integer between `0` and `255`.
|
|
87
101
|
*/
|
|
88
102
|
declare function toU8(value: unknown): number;
|
|
103
|
+
/**
|
|
104
|
+
* Validates that a value can be safely used as a Move `u16` in the
|
|
105
|
+
* `0..65535` range.
|
|
106
|
+
*
|
|
107
|
+
* Accepted inputs:
|
|
108
|
+
* - finite `number`
|
|
109
|
+
* - base-10 integer `string`
|
|
110
|
+
*
|
|
111
|
+
* String inputs are accepted for parsed values such as `'1'`, but only when
|
|
112
|
+
* they are plain non-negative integer strings. This helper does not accept
|
|
113
|
+
* booleans and does not truncate fractional values.
|
|
114
|
+
*
|
|
115
|
+
* @param value Value to validate.
|
|
116
|
+
* @returns The validated `u16` value as a JavaScript `number`.
|
|
117
|
+
* @throws When `value` is not a finite number or integer string.
|
|
118
|
+
* @throws When `value` is not an integer between `0` and `65535`.
|
|
119
|
+
*/
|
|
120
|
+
declare function toU16(value: unknown): number;
|
|
89
121
|
|
|
90
122
|
declare const Float: MoveStruct<{
|
|
91
123
|
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
@@ -145,4 +177,4 @@ declare function parseCoinType(type: string): string;
|
|
|
145
177
|
*/
|
|
146
178
|
declare function parseGameDetails(gameDetails: BetResultGameDetails): ParsedGameDetails;
|
|
147
179
|
|
|
148
|
-
export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU8 };
|
|
180
|
+
export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU16, toU8 };
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU8 } from './chunk-
|
|
1
|
+
export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU16, toU8 } from './chunk-TBJ5TYYE.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suigar/sdk",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.11",
|
|
4
4
|
"description": "TypeScript SDK for Suigar v2 Move contracts on Sui.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"suigar",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"vitest": "^4.1.5"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
|
-
"build": "pnpm
|
|
71
|
+
"build": "pnpm clean && pnpm codegen && tsup",
|
|
72
72
|
"build:ci": "rm -rf dist && tsup",
|
|
73
73
|
"clean": "rm -rf dist src/contracts .vitest-cache",
|
|
74
|
-
"codegen": "node ./scripts/update-package-configs.mjs && sui-ts-codegen generate && pnpm
|
|
74
|
+
"codegen": "node ./scripts/update-package-configs.mjs && sui-ts-codegen generate && pnpm lint",
|
|
75
75
|
"eslint:fix": "eslint . --fix",
|
|
76
|
-
"format": "pnpm
|
|
77
|
-
"lint": "pnpm
|
|
76
|
+
"format": "pnpm prettier:fix",
|
|
77
|
+
"lint": "pnpm eslint:fix && pnpm prettier:fix",
|
|
78
78
|
"prettier:fix": "prettier --write --ignore-unknown .",
|
|
79
79
|
"test": "vitest run",
|
|
80
80
|
"typecheck": "tsc --noEmit"
|