stable-layer-sdk 0.0.2 → 1.0.0

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.
Files changed (63) hide show
  1. package/dist/client.test.d.ts +1 -0
  2. package/dist/client.test.js +146 -0
  3. package/dist/generated/stable_layer/deps/bucket_v2_framework/liability.d.ts +11 -0
  4. package/dist/generated/stable_layer/deps/bucket_v2_framework/liability.js +13 -0
  5. package/dist/generated/stable_layer/deps/bucket_v2_framework/sheet.d.ts +57 -0
  6. package/dist/generated/stable_layer/deps/bucket_v2_framework/sheet.js +16 -0
  7. package/dist/generated/stable_layer/deps/std/type_name.d.ts +17 -0
  8. package/dist/generated/stable_layer/deps/std/type_name.js +19 -0
  9. package/dist/generated/stable_layer/deps/sui/balance.d.ts +12 -0
  10. package/dist/generated/stable_layer/deps/sui/balance.js +14 -0
  11. package/dist/generated/stable_layer/deps/sui/coin.d.ts +16 -0
  12. package/dist/generated/stable_layer/deps/sui/coin.js +15 -0
  13. package/dist/generated/stable_layer/deps/sui/object.d.ts +8 -0
  14. package/dist/generated/stable_layer/deps/sui/object.js +10 -0
  15. package/dist/generated/stable_layer/deps/sui/vec_map.d.ts +36 -0
  16. package/dist/generated/stable_layer/deps/sui/vec_map.js +27 -0
  17. package/dist/generated/stable_layer/deps/sui/vec_set.d.ts +20 -0
  18. package/dist/generated/stable_layer/deps/sui/vec_set.js +19 -0
  19. package/dist/generated/stable_layer/stable_layer.d.ts +427 -0
  20. package/dist/generated/stable_layer/stable_layer.js +365 -0
  21. package/dist/generated/stable_vault_farm/deps/bucket_v2_framework/liability.d.ts +11 -0
  22. package/dist/generated/stable_vault_farm/deps/bucket_v2_framework/liability.js +13 -0
  23. package/dist/generated/stable_vault_farm/deps/bucket_v2_framework/sheet.d.ts +57 -0
  24. package/dist/generated/stable_vault_farm/deps/bucket_v2_framework/sheet.js +16 -0
  25. package/dist/generated/stable_vault_farm/deps/std/type_name.d.ts +17 -0
  26. package/dist/generated/stable_vault_farm/deps/std/type_name.js +19 -0
  27. package/dist/generated/stable_vault_farm/deps/sui/balance.d.ts +12 -0
  28. package/dist/generated/stable_vault_farm/deps/sui/balance.js +14 -0
  29. package/dist/generated/stable_vault_farm/deps/sui/object.d.ts +8 -0
  30. package/dist/generated/stable_vault_farm/deps/sui/object.js +10 -0
  31. package/dist/generated/stable_vault_farm/deps/sui/table.d.ts +31 -0
  32. package/dist/generated/stable_vault_farm/deps/sui/table.js +32 -0
  33. package/dist/generated/stable_vault_farm/deps/sui/vec_map.d.ts +36 -0
  34. package/dist/generated/stable_vault_farm/deps/sui/vec_map.js +27 -0
  35. package/dist/generated/stable_vault_farm/deps/sui/vec_set.d.ts +20 -0
  36. package/dist/generated/stable_vault_farm/deps/sui/vec_set.js +19 -0
  37. package/dist/generated/stable_vault_farm/stable_vault_farm.d.ts +242 -0
  38. package/dist/generated/stable_vault_farm/stable_vault_farm.js +163 -0
  39. package/dist/generated/utils/index.d.ts +11 -0
  40. package/dist/generated/utils/index.js +131 -0
  41. package/dist/generated/yield_usdb/buffer.d.ts +137 -0
  42. package/dist/generated/yield_usdb/buffer.js +157 -0
  43. package/dist/generated/yield_usdb/deps/bucket_v2_framework/account.d.ts +11 -0
  44. package/dist/generated/yield_usdb/deps/bucket_v2_framework/account.js +12 -0
  45. package/dist/generated/yield_usdb/deps/bucket_v2_framework/double.d.ts +8 -0
  46. package/dist/generated/yield_usdb/deps/bucket_v2_framework/double.js +10 -0
  47. package/dist/generated/yield_usdb/deps/sui/balance.d.ts +15 -0
  48. package/dist/generated/yield_usdb/deps/sui/balance.js +17 -0
  49. package/dist/generated/yield_usdb/deps/sui/coin.d.ts +16 -0
  50. package/dist/generated/yield_usdb/deps/sui/coin.js +15 -0
  51. package/dist/generated/yield_usdb/deps/sui/object.d.ts +8 -0
  52. package/dist/generated/yield_usdb/deps/sui/object.js +10 -0
  53. package/dist/generated/yield_usdb/deps/sui/vec_set.d.ts +20 -0
  54. package/dist/generated/yield_usdb/deps/sui/vec_set.js +19 -0
  55. package/dist/generated/yield_usdb/yield_usdb.d.ts +475 -0
  56. package/dist/generated/yield_usdb/yield_usdb.js +444 -0
  57. package/dist/index.d.ts +16 -19
  58. package/dist/index.js +235 -30
  59. package/dist/interface.d.ts +25 -0
  60. package/dist/interface.js +1 -0
  61. package/dist/libs/constants.d.ts +15 -0
  62. package/dist/libs/constants.js +18 -0
  63. package/package.json +15 -4
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,146 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { StableLayerSDK } from "./index";
11
+ import { Transaction } from "@mysten/sui/transactions";
12
+ import { getFullnodeUrl, SuiClient } from "@mysten/sui/client";
13
+ import { describe, it, expect, beforeAll } from "vitest";
14
+ import * as constants from "./libs/constants";
15
+ const testConfig = {
16
+ network: "mainnet",
17
+ sender: "0x2b986d2381347d9e1c903167cf9b36da5f8eaba6f0db44e0c60e40ea312150ca",
18
+ };
19
+ describe("StableLayerSDK", () => {
20
+ let sdk;
21
+ let suiClient;
22
+ beforeAll(() => {
23
+ sdk = new StableLayerSDK(testConfig);
24
+ suiClient = new SuiClient({ url: getFullnodeUrl("mainnet") });
25
+ });
26
+ describe("constructor", () => {
27
+ it("should initialize with correct config", () => {
28
+ expect(sdk).toBeInstanceOf(StableLayerSDK);
29
+ });
30
+ });
31
+ describe("buildMintTx", () => {
32
+ it("should build a valid mint transaction", () => __awaiter(void 0, void 0, void 0, function* () {
33
+ const tx = new Transaction();
34
+ const params = {
35
+ tx,
36
+ coinName: "BTC_USD",
37
+ amount: BigInt(10),
38
+ sender: testConfig.sender,
39
+ };
40
+ const builtTx = yield sdk.buildMintTx(params);
41
+ expect(builtTx).toBeInstanceOf(Transaction);
42
+ // Dev inspect the transaction to validate it's well-formed
43
+ const result = yield suiClient.devInspectTransactionBlock({
44
+ transactionBlock: builtTx,
45
+ sender: testConfig.sender,
46
+ });
47
+ // Should not have execution errors in the transaction structure
48
+ expect(result.error).toBeUndefined();
49
+ expect(result.effects.status.status).toBe("success");
50
+ }));
51
+ it("should throw error when neither amount nor all is provided for burn", () => __awaiter(void 0, void 0, void 0, function* () {
52
+ const tx = new Transaction();
53
+ const params = {
54
+ tx,
55
+ coinName: "BTC_USD",
56
+ sender: testConfig.sender,
57
+ };
58
+ yield expect(sdk.buildBurnTx(params)).rejects.toThrow("Amount or all must be provided");
59
+ }));
60
+ });
61
+ describe("buildBurnTx", () => {
62
+ it("should build a valid burn transaction with amount", () => __awaiter(void 0, void 0, void 0, function* () {
63
+ const tx = new Transaction();
64
+ const params = {
65
+ tx,
66
+ coinName: "BTC_USD",
67
+ amount: BigInt(10),
68
+ sender: testConfig.sender,
69
+ };
70
+ const builtTx = yield sdk.buildBurnTx(params);
71
+ expect(builtTx).toBeInstanceOf(Transaction);
72
+ // Dev inspect the transaction
73
+ try {
74
+ const result = yield suiClient.devInspectTransactionBlock({
75
+ transactionBlock: builtTx,
76
+ sender: testConfig.sender,
77
+ });
78
+ expect(result.error).toBeUndefined();
79
+ expect(result.effects.status.status).toBe("success");
80
+ }
81
+ catch (error) {
82
+ const balance = yield suiClient.getBalance({
83
+ owner: testConfig.sender,
84
+ coinType: constants.BTC_USD_TYPE,
85
+ });
86
+ if (BigInt(balance.totalBalance) <= BigInt(10)) {
87
+ expect(error.message).toContain(`Not enough coins of type ${constants.BTC_USD_TYPE} to satisfy requested balance`);
88
+ }
89
+ else {
90
+ expect(error.message).toBeUndefined();
91
+ }
92
+ }
93
+ }));
94
+ it("should build a valid burn transaction with all flag", () => __awaiter(void 0, void 0, void 0, function* () {
95
+ const tx = new Transaction();
96
+ const params = {
97
+ tx,
98
+ coinName: "BTC_USD",
99
+ all: true,
100
+ sender: testConfig.sender,
101
+ };
102
+ const builtTx = yield sdk.buildBurnTx(params);
103
+ expect(builtTx).toBeInstanceOf(Transaction);
104
+ try {
105
+ const result = yield suiClient.devInspectTransactionBlock({
106
+ transactionBlock: builtTx,
107
+ sender: testConfig.sender,
108
+ });
109
+ expect(result.error).toBeUndefined();
110
+ expect(result.effects.status.status).toBe("success");
111
+ }
112
+ catch (error) {
113
+ const balance = yield suiClient.getBalance({
114
+ owner: testConfig.sender,
115
+ coinType: constants.BTC_USD_TYPE,
116
+ });
117
+ if (BigInt(balance.totalBalance) <= BigInt(10)) {
118
+ console.log(error);
119
+ expect(error.message).toBeDefined();
120
+ }
121
+ else {
122
+ expect(error.message).toBeUndefined();
123
+ }
124
+ }
125
+ }));
126
+ });
127
+ describe("buildClaimTx", () => {
128
+ it("should build a valid claim transaction", () => __awaiter(void 0, void 0, void 0, function* () {
129
+ const tx = new Transaction();
130
+ const params = {
131
+ tx,
132
+ coinName: "BTC_USD",
133
+ sender: testConfig.sender,
134
+ };
135
+ const builtTx = yield sdk.buildClaimTx(params);
136
+ expect(builtTx).toBeInstanceOf(Transaction);
137
+ // Dev inspect the transaction
138
+ const result = yield suiClient.devInspectTransactionBlock({
139
+ transactionBlock: builtTx,
140
+ sender: testConfig.sender,
141
+ });
142
+ expect(result.error).toBeUndefined();
143
+ expect(result.effects.status.status).toBe("success");
144
+ }));
145
+ });
146
+ });
@@ -0,0 +1,11 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Module for managing Credit and Debt for DeFi protocol usage */
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ export declare const Credit: MoveStruct<{
7
+ value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
8
+ }, "bucket_v2_framework::liability::Credit">;
9
+ export declare const Debt: MoveStruct<{
10
+ value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
11
+ }, "bucket_v2_framework::liability::Debt">;
@@ -0,0 +1,13 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Module for managing Credit and Debt for DeFi protocol usage */
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ import { bcs } from '@mysten/sui/bcs';
7
+ const $moduleName = 'bucket_v2_framework::liability';
8
+ export const Credit = new MoveStruct({ name: `${$moduleName}::Credit`, fields: {
9
+ value: bcs.u64()
10
+ } });
11
+ export const Debt = new MoveStruct({ name: `${$moduleName}::Debt`, fields: {
12
+ value: bcs.u64()
13
+ } });
@@ -0,0 +1,57 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Module for the record of Credit and Debt of certain entity */
5
+ import { MoveTuple, MoveStruct } from '../../../utils/index.js';
6
+ export declare const Entity: MoveTuple<MoveStruct<{
7
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
8
+ }, "std::type_name::TypeName">[], "bucket_v2_framework::sheet::Entity">;
9
+ export declare const Sheet: MoveStruct<{
10
+ credits: MoveStruct<{
11
+ contents: import("@mysten/bcs").BcsType<{
12
+ key: {
13
+ name: string;
14
+ }[];
15
+ value: {
16
+ value: string;
17
+ };
18
+ }[], Iterable<{
19
+ key: {
20
+ name: string;
21
+ }[];
22
+ value: {
23
+ value: string | number | bigint;
24
+ };
25
+ }> & {
26
+ length: number;
27
+ }, string>;
28
+ }, "0x2::vec_map::VecMap<bucket_v2_framework::sheet::Entity, bucket_v2_framework::liability::Credit>">;
29
+ debts: MoveStruct<{
30
+ contents: import("@mysten/bcs").BcsType<{
31
+ key: {
32
+ name: string;
33
+ }[];
34
+ value: {
35
+ value: string;
36
+ };
37
+ }[], Iterable<{
38
+ key: {
39
+ name: string;
40
+ }[];
41
+ value: {
42
+ value: string | number | bigint;
43
+ };
44
+ }> & {
45
+ length: number;
46
+ }, string>;
47
+ }, "0x2::vec_map::VecMap<bucket_v2_framework::sheet::Entity, bucket_v2_framework::liability::Debt>">;
48
+ blacklist: MoveStruct<{
49
+ contents: import("@mysten/bcs").BcsType<{
50
+ name: string;
51
+ }[][], Iterable<{
52
+ name: string;
53
+ }[]> & {
54
+ length: number;
55
+ }, string>;
56
+ }, "0x2::vec_set::VecSet<bucket_v2_framework::sheet::Entity>">;
57
+ }, "bucket_v2_framework::sheet::Sheet">;
@@ -0,0 +1,16 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Module for the record of Credit and Debt of certain entity */
5
+ import { MoveTuple, MoveStruct } from '../../../utils/index.js';
6
+ import * as type_name from '../std/type_name.js';
7
+ import * as vec_map from '../sui/vec_map.js';
8
+ import * as liability from './liability.js';
9
+ import * as vec_set from '../sui/vec_set.js';
10
+ const $moduleName = 'bucket_v2_framework::sheet';
11
+ export const Entity = new MoveTuple({ name: `${$moduleName}::Entity`, fields: [type_name.TypeName] });
12
+ export const Sheet = new MoveStruct({ name: `${$moduleName}::Sheet`, fields: {
13
+ credits: vec_map.VecMap(Entity, liability.Credit),
14
+ debts: vec_map.VecMap(Entity, liability.Debt),
15
+ blacklist: vec_set.VecSet(Entity)
16
+ } });
@@ -0,0 +1,17 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Functionality for converting Move types into values. Use with care! */
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ export declare const TypeName: MoveStruct<{
7
+ /**
8
+ * String representation of the type. All types are represented using their source
9
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
10
+ * Struct types are represented as fully qualified type names; e.g.
11
+ * `00000000000000000000000000000001::string::String` or
12
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
13
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
14
+ * 32 depending on the Move platform)
15
+ */
16
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
17
+ }, "std::type_name::TypeName">;
@@ -0,0 +1,19 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Functionality for converting Move types into values. Use with care! */
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ import { bcs } from '@mysten/sui/bcs';
7
+ const $moduleName = 'std::type_name';
8
+ export const TypeName = new MoveStruct({ name: `${$moduleName}::TypeName`, fields: {
9
+ /**
10
+ * String representation of the type. All types are represented using their source
11
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
12
+ * Struct types are represented as fully qualified type names; e.g.
13
+ * `00000000000000000000000000000001::string::String` or
14
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
15
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
16
+ * 32 depending on the Move platform)
17
+ */
18
+ name: bcs.string()
19
+ } });
@@ -0,0 +1,12 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * A storable handler for Balances in general. Is used in the `Coin` module to
6
+ * allow balance operations and can be used to implement custom coins with `Supply`
7
+ * and `Balance`s.
8
+ */
9
+ import { MoveStruct } from '../../../utils/index.js';
10
+ export declare const Supply: MoveStruct<{
11
+ value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
12
+ }, "0x2::balance::Supply">;
@@ -0,0 +1,14 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * A storable handler for Balances in general. Is used in the `Coin` module to
6
+ * allow balance operations and can be used to implement custom coins with `Supply`
7
+ * and `Balance`s.
8
+ */
9
+ import { MoveStruct } from '../../../utils/index.js';
10
+ import { bcs } from '@mysten/sui/bcs';
11
+ const $moduleName = '0x2::balance';
12
+ export const Supply = new MoveStruct({ name: `${$moduleName}::Supply`, fields: {
13
+ value: bcs.u64()
14
+ } });
@@ -0,0 +1,16 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Defines the `Coin` type - platform wide representation of fungible tokens and
6
+ * coins. `Coin` can be described as a secure wrapper around `Balance` type.
7
+ */
8
+ import { MoveStruct } from '../../../utils/index.js';
9
+ export declare const TreasuryCap: MoveStruct<{
10
+ id: MoveStruct<{
11
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
12
+ }, "0x2::object::UID">;
13
+ total_supply: MoveStruct<{
14
+ value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
15
+ }, "0x2::balance::Supply">;
16
+ }, "0x2::coin::TreasuryCap">;
@@ -0,0 +1,15 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Defines the `Coin` type - platform wide representation of fungible tokens and
6
+ * coins. `Coin` can be described as a secure wrapper around `Balance` type.
7
+ */
8
+ import { MoveStruct } from '../../../utils/index.js';
9
+ import * as object from './object.js';
10
+ import * as balance from './balance.js';
11
+ const $moduleName = '0x2::coin';
12
+ export const TreasuryCap = new MoveStruct({ name: `${$moduleName}::TreasuryCap`, fields: {
13
+ id: object.UID,
14
+ total_supply: balance.Supply
15
+ } });
@@ -0,0 +1,8 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Sui object identifiers */
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ export declare const UID: MoveStruct<{
7
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
+ }, "0x2::object::UID">;
@@ -0,0 +1,10 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Sui object identifiers */
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ import { bcs } from '@mysten/sui/bcs';
7
+ const $moduleName = '0x2::object';
8
+ export const UID = new MoveStruct({ name: `${$moduleName}::UID`, fields: {
9
+ id: bcs.Address
10
+ } });
@@ -0,0 +1,36 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ /** An entry in the map */
7
+ export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
8
+ K,
9
+ V
10
+ ]): MoveStruct<{
11
+ key: K;
12
+ value: V;
13
+ }, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
14
+ /**
15
+ * A map data structure backed by a vector. The map is guaranteed not to contain
16
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
17
+ * insertion order. All operations are O(N) in the size of the map--the intention
18
+ * of this data structure is only to provide the convenience of programming against
19
+ * a map API. Large maps should use handwritten parent/child relationships instead.
20
+ * Maps that need sorted iteration rather than insertion order iteration should
21
+ * also be handwritten.
22
+ */
23
+ export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
24
+ K,
25
+ V
26
+ ]): MoveStruct<{
27
+ contents: BcsType<{
28
+ key: K extends BcsType<infer U, any, string> ? U : never;
29
+ value: V extends BcsType<infer U, any, string> ? U : never;
30
+ }[], Iterable<{
31
+ key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
32
+ value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
33
+ }> & {
34
+ length: number;
35
+ }, string>;
36
+ }, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
@@ -0,0 +1,27 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_map';
7
+ /** An entry in the map */
8
+ export function Entry(...typeParameters) {
9
+ return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
10
+ key: typeParameters[0],
11
+ value: typeParameters[1]
12
+ } });
13
+ }
14
+ /**
15
+ * A map data structure backed by a vector. The map is guaranteed not to contain
16
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
17
+ * insertion order. All operations are O(N) in the size of the map--the intention
18
+ * of this data structure is only to provide the convenience of programming against
19
+ * a map API. Large maps should use handwritten parent/child relationships instead.
20
+ * Maps that need sorted iteration rather than insertion order iteration should
21
+ * also be handwritten.
22
+ */
23
+ export function VecMap(...typeParameters) {
24
+ return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
25
+ contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
26
+ } });
27
+ }
@@ -0,0 +1,20 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ /**
7
+ * A set data structure backed by a vector. The set is guaranteed not to contain
8
+ * duplicate keys. All operations are O(N) in the size of the set
9
+ *
10
+ * - the intention of this data structure is only to provide the convenience of
11
+ * programming against a set API. Sets that need sorted iteration rather than
12
+ * insertion order iteration should be handwritten.
13
+ */
14
+ export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
15
+ K
16
+ ]): MoveStruct<{
17
+ contents: BcsType<import("@mysten/bcs").InferBcsType<K>[], Iterable<import("@mysten/bcs").InferBcsInput<K>> & {
18
+ length: number;
19
+ }, string>;
20
+ }, `0x2::vec_set::VecSet<${K["name"]}>`>;
@@ -0,0 +1,19 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_set';
7
+ /**
8
+ * A set data structure backed by a vector. The set is guaranteed not to contain
9
+ * duplicate keys. All operations are O(N) in the size of the set
10
+ *
11
+ * - the intention of this data structure is only to provide the convenience of
12
+ * programming against a set API. Sets that need sorted iteration rather than
13
+ * insertion order iteration should be handwritten.
14
+ */
15
+ export function VecSet(...typeParameters) {
16
+ return new MoveStruct({ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`, fields: {
17
+ contents: bcs.vector(typeParameters[0])
18
+ } });
19
+ }