@typus/typus-perp-sdk 1.1.49 → 1.1.51-upgrade

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/src/api/sentio.d.ts +1 -1
  2. package/dist/src/api/sentio.js +3 -3
  3. package/dist/src/client.d.ts +11 -12
  4. package/dist/src/client.js +16 -44
  5. package/dist/src/fetch.d.ts +15 -45
  6. package/dist/src/fetch.js +70 -69
  7. package/dist/src/generated/typus_perp/admin.d.ts +32 -42
  8. package/dist/src/generated/typus_perp/admin.js +41 -67
  9. package/dist/src/generated/typus_perp/competition.d.ts +22 -10
  10. package/dist/src/generated/typus_perp/competition.js +19 -54
  11. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +2 -2
  12. package/dist/src/generated/typus_perp/deps/std/type_name.js +2 -2
  13. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +3 -3
  14. package/dist/src/generated/typus_perp/deps/sui/balance.js +3 -3
  15. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +4 -6
  16. package/dist/src/generated/typus_perp/deps/sui/object_table.js +4 -38
  17. package/dist/src/generated/typus_perp/deps/sui/table.d.ts +4 -6
  18. package/dist/src/generated/typus_perp/deps/sui/table.js +4 -38
  19. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +2 -2
  20. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +2 -2
  21. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +7 -9
  22. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +6 -6
  23. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +6 -10
  24. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +5 -39
  25. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +14 -8
  26. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +13 -39
  27. package/dist/src/generated/typus_perp/error.d.ts +97 -87
  28. package/dist/src/generated/typus_perp/error.js +18 -0
  29. package/dist/src/generated/typus_perp/escrow.d.ts +17 -21
  30. package/dist/src/generated/typus_perp/escrow.js +10 -22
  31. package/dist/src/generated/typus_perp/lending.d.ts +47 -0
  32. package/dist/src/generated/typus_perp/lending.js +40 -0
  33. package/dist/src/generated/typus_perp/lp_pool.d.ts +718 -397
  34. package/dist/src/generated/typus_perp/lp_pool.js +485 -365
  35. package/dist/src/generated/typus_perp/math.d.ts +18 -8
  36. package/dist/src/generated/typus_perp/math.js +24 -6
  37. package/dist/src/generated/typus_perp/position.d.ts +207 -185
  38. package/dist/src/generated/typus_perp/position.js +236 -277
  39. package/dist/src/generated/typus_perp/profit_vault.d.ts +64 -72
  40. package/dist/src/generated/typus_perp/profit_vault.js +48 -86
  41. package/dist/src/generated/typus_perp/symbol.d.ts +6 -6
  42. package/dist/src/generated/typus_perp/symbol.js +11 -13
  43. package/dist/src/generated/typus_perp/trading.d.ts +451 -558
  44. package/dist/src/generated/typus_perp/trading.js +429 -681
  45. package/dist/src/generated/typus_perp/treasury_caps.d.ts +5 -7
  46. package/dist/src/generated/typus_perp/treasury_caps.js +8 -45
  47. package/dist/src/generated/typus_stake_pool/admin.d.ts +13 -122
  48. package/dist/src/generated/typus_stake_pool/admin.js +19 -103
  49. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +2 -2
  50. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +2 -2
  51. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +2 -2
  52. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +2 -2
  53. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +249 -240
  54. package/dist/src/generated/typus_stake_pool/stake_pool.js +159 -246
  55. package/dist/src/generated/utils/index.d.ts +21 -2
  56. package/dist/src/generated/utils/index.js +34 -10
  57. package/dist/src/user/history.d.ts +3 -2
  58. package/dist/src/user/history.js +60 -18
  59. package/dist/src/user/order.d.ts +1 -1
  60. package/dist/src/user/orderWithBidReceipt.d.ts +1 -1
  61. package/package.json +8 -15
  62. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
  63. package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
  64. package/dist/src/generated/typus_perp/user_account.d.ts +0 -146
  65. package/dist/src/generated/typus_perp/user_account.js +0 -221
  66. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
  67. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
  68. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
  69. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
  70. package/dist/src/grpc/graphql.d.ts +0 -26
  71. package/dist/src/grpc/graphql.js +0 -126
  72. package/dist/src/grpc/grpc.d.ts +0 -1
  73. package/dist/src/grpc/grpc.js +0 -38
  74. package/dist/src/grpc/ledgerService.d.ts +0 -0
  75. package/dist/src/grpc/ledgerService.js +0 -64
  76. package/dist/src/grpc/liveDataService.d.ts +0 -0
  77. package/dist/src/grpc/liveDataService.js +0 -49
@@ -1,221 +0,0 @@
1
- "use strict";
2
- /**************************************************************
3
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
4
- **************************************************************/
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.UserAccountCap = exports.UserAccount = void 0;
40
- exports.newUserAccount = newUserAccount;
41
- exports.removeUserAccount = removeUserAccount;
42
- exports.hasUserAccount = hasUserAccount;
43
- exports.getMutUserAccount = getMutUserAccount;
44
- exports.checkOwner = checkOwner;
45
- exports.addDelegateUser = addDelegateUser;
46
- exports.removeDelegateUser = removeDelegateUser;
47
- exports.deposit = deposit;
48
- exports.withdraw = withdraw;
49
- exports.getUserAccountOwner = getUserAccountOwner;
50
- /**
51
- * The `user_account` module defines the `UserAccount` and `UserAccountCap`
52
- * structs, and the logic for creating, updating, and using them.
53
- */
54
- const index_1 = require("../utils/index");
55
- const bcs_1 = require("@mysten/sui/bcs");
56
- const object = __importStar(require("./deps/sui/object"));
57
- const type_name = __importStar(require("./deps/std/type_name"));
58
- const $moduleName = "@typus/perp::user_account";
59
- exports.UserAccount = new index_1.MoveStruct({
60
- name: `${$moduleName}::UserAccount`,
61
- fields: {
62
- id: object.UID,
63
- /** The address of the owner of the user account. */
64
- owner: bcs_1.bcs.Address,
65
- /** A vector of the delegate users. */
66
- delegate_user: bcs_1.bcs.vector(bcs_1.bcs.Address),
67
- /** A vector of the symbols of the tokens in the user account. */
68
- symbols: bcs_1.bcs.vector(type_name.TypeName),
69
- /** Padding for future use. */
70
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
71
- },
72
- });
73
- exports.UserAccountCap = new index_1.MoveStruct({
74
- name: `${$moduleName}::UserAccountCap`,
75
- fields: {
76
- id: object.UID,
77
- /** The address of the owner of the user account. */
78
- owner: bcs_1.bcs.Address,
79
- /** The ID of the user account. */
80
- user_account_id: bcs_1.bcs.Address,
81
- },
82
- });
83
- /** Creates a new user account and capability. */
84
- function newUserAccount(options = {}) {
85
- const packageAddress = options.package ?? "@typus/perp";
86
- return (tx) => tx.moveCall({
87
- package: packageAddress,
88
- module: "user_account",
89
- function: "new_user_account",
90
- });
91
- }
92
- /** Removes a user account. WARNING: no authority check inside */
93
- function removeUserAccount(options) {
94
- const packageAddress = options.package ?? "@typus/perp";
95
- const argumentsTypes = [
96
- "0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
97
- "address",
98
- `${packageAddress}::user_account::UserAccountCap`,
99
- ];
100
- const parameterNames = ["marketId", "user", "userAccountCap"];
101
- return (tx) => tx.moveCall({
102
- package: packageAddress,
103
- module: "user_account",
104
- function: "remove_user_account",
105
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
106
- });
107
- }
108
- /** Checks if a user has an account. */
109
- function hasUserAccount(options) {
110
- const packageAddress = options.package ?? "@typus/perp";
111
- const argumentsTypes = [
112
- "0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
113
- "address",
114
- ];
115
- const parameterNames = ["marketId", "user"];
116
- return (tx) => tx.moveCall({
117
- package: packageAddress,
118
- module: "user_account",
119
- function: "has_user_account",
120
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
121
- });
122
- }
123
- /**
124
- * Gets a mutable reference to a user account. WARNING: no security check, only
125
- * delegate_user or cranker can access
126
- */
127
- function getMutUserAccount(options) {
128
- const packageAddress = options.package ?? "@typus/perp";
129
- const argumentsTypes = [
130
- "0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
131
- "address",
132
- ];
133
- const parameterNames = ["marketId", "user"];
134
- return (tx) => tx.moveCall({
135
- package: packageAddress,
136
- module: "user_account",
137
- function: "get_mut_user_account",
138
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
139
- });
140
- }
141
- /** Checks if the sender is the owner of the user account. Abort if not owner */
142
- function checkOwner(options) {
143
- const packageAddress = options.package ?? "@typus/perp";
144
- const argumentsTypes = [`${packageAddress}::user_account::UserAccount`];
145
- const parameterNames = ["userAccount"];
146
- return (tx) => tx.moveCall({
147
- package: packageAddress,
148
- module: "user_account",
149
- function: "check_owner",
150
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
151
- });
152
- }
153
- /** Adds a delegate user to a user account. WARNING: no authority check inside */
154
- function addDelegateUser(options) {
155
- const packageAddress = options.package ?? "@typus/perp";
156
- const argumentsTypes = [`${packageAddress}::user_account::UserAccount`, "address"];
157
- const parameterNames = ["userAccount", "user"];
158
- return (tx) => tx.moveCall({
159
- package: packageAddress,
160
- module: "user_account",
161
- function: "add_delegate_user",
162
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
163
- });
164
- }
165
- /** Remove a delegate user from a user account. WARNING: no authority check inside */
166
- function removeDelegateUser(options) {
167
- const packageAddress = options.package ?? "@typus/perp";
168
- const argumentsTypes = [`${packageAddress}::user_account::UserAccount`, "address"];
169
- const parameterNames = ["userAccount", "user"];
170
- return (tx) => tx.moveCall({
171
- package: packageAddress,
172
- module: "user_account",
173
- function: "remove_delegate_user",
174
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
175
- });
176
- }
177
- /** Deposits collateral into a user account. WARNING: no authority check inside */
178
- function deposit(options) {
179
- const packageAddress = options.package ?? "@typus/perp";
180
- const argumentsTypes = [
181
- `${packageAddress}::user_account::UserAccount`,
182
- `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
183
- ];
184
- const parameterNames = ["userAccount", "balance"];
185
- return (tx) => tx.moveCall({
186
- package: packageAddress,
187
- module: "user_account",
188
- function: "deposit",
189
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
190
- typeArguments: options.typeArguments,
191
- });
192
- }
193
- /** Withdraws collateral from a user account. WARNING: no authority check inside */
194
- function withdraw(options) {
195
- const packageAddress = options.package ?? "@typus/perp";
196
- const argumentsTypes = [
197
- `${packageAddress}::user_account::UserAccount`,
198
- "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
199
- `${packageAddress}::user_account::UserAccountCap`,
200
- ];
201
- const parameterNames = ["userAccount", "amount", "userAccountCap"];
202
- return (tx) => tx.moveCall({
203
- package: packageAddress,
204
- module: "user_account",
205
- function: "withdraw",
206
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
207
- typeArguments: options.typeArguments,
208
- });
209
- }
210
- /** Gets the owner of a user account from a capability. */
211
- function getUserAccountOwner(options) {
212
- const packageAddress = options.package ?? "@typus/perp";
213
- const argumentsTypes = [`${packageAddress}::user_account::UserAccountCap`];
214
- const parameterNames = ["userAccountCap"];
215
- return (tx) => tx.moveCall({
216
- package: packageAddress,
217
- module: "user_account",
218
- function: "get_user_account_owner",
219
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
220
- });
221
- }
@@ -1,8 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /** Sui object identifiers */
5
- import { MoveStruct } from "../../../utils/index";
6
- export declare const UID: MoveStruct<{
7
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
- }, "0x2::object::UID">;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**************************************************************
3
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
4
- **************************************************************/
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UID = void 0;
7
- /** Sui object identifiers */
8
- const index_1 = require("../../../utils/index");
9
- const bcs_1 = require("@mysten/sui/bcs");
10
- const $moduleName = "0x2::object";
11
- exports.UID = new index_1.MoveStruct({
12
- name: `${$moduleName}::UID`,
13
- fields: {
14
- id: bcs_1.bcs.Address,
15
- },
16
- });
@@ -1,30 +0,0 @@
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";
6
- /** An entry in the map */
7
- export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]): MoveStruct<{
8
- key: K;
9
- value: V;
10
- }, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
11
- /**
12
- * A map data structure backed by a vector. The map is guaranteed not to contain
13
- * duplicate keys, but entries are _not_ sorted by key--entries are included in
14
- * insertion order. All operations are O(N) in the size of the map--the intention
15
- * of this data structure is only to provide the convenience of programming against
16
- * a map API. Large maps should use handwritten parent/child relationships instead.
17
- * Maps that need sorted iteration rather than insertion order iteration should
18
- * also be handwritten.
19
- */
20
- export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]): MoveStruct<{
21
- contents: BcsType<{
22
- key: K extends BcsType<infer U, any, string> ? U : never;
23
- value: V extends BcsType<infer U, any, string> ? U : never;
24
- }[], Iterable<{
25
- key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
26
- value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
27
- }> & {
28
- length: number;
29
- }, string>;
30
- }, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Entry = Entry;
4
- exports.VecMap = VecMap;
5
- /**************************************************************
6
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
- **************************************************************/
8
- const bcs_1 = require("@mysten/sui/bcs");
9
- const index_1 = require("../../../utils/index");
10
- const $moduleName = "0x2::vec_map";
11
- /** An entry in the map */
12
- function Entry(...typeParameters) {
13
- return new index_1.MoveStruct({
14
- name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`,
15
- fields: {
16
- key: typeParameters[0],
17
- value: typeParameters[1],
18
- },
19
- });
20
- }
21
- /**
22
- * A map data structure backed by a vector. The map is guaranteed not to contain
23
- * duplicate keys, but entries are _not_ sorted by key--entries are included in
24
- * insertion order. All operations are O(N) in the size of the map--the intention
25
- * of this data structure is only to provide the convenience of programming against
26
- * a map API. Large maps should use handwritten parent/child relationships instead.
27
- * Maps that need sorted iteration rather than insertion order iteration should
28
- * also be handwritten.
29
- */
30
- function VecMap(...typeParameters) {
31
- return new index_1.MoveStruct({
32
- name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`,
33
- fields: {
34
- contents: bcs_1.bcs.vector(Entry(typeParameters[0], typeParameters[1])),
35
- },
36
- });
37
- }
@@ -1,26 +0,0 @@
1
- import { SuiGraphQLClient } from "@mysten/sui/graphql";
2
- export declare function getDynamicFields(gqlClient: SuiGraphQLClient, id: string): Promise<{
3
- nodes: {
4
- name: {
5
- type: {
6
- repr: string;
7
- } | null;
8
- json: unknown;
9
- } | null;
10
- value: {
11
- __typename: "MoveValue";
12
- type: {
13
- repr: string;
14
- } | null;
15
- json: unknown;
16
- } | {
17
- __typename: "MoveObject";
18
- contents: {
19
- type: {
20
- repr: string;
21
- } | null;
22
- json: unknown;
23
- } | null;
24
- } | null;
25
- }[];
26
- } | null | undefined>;
@@ -1,126 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDynamicFields = getDynamicFields;
4
- const graphql_1 = require("@mysten/sui/graphql");
5
- const latest_1 = require("@mysten/sui/graphql/schemas/latest");
6
- const gqlClient = new graphql_1.SuiGraphQLClient({
7
- url: "https://graphql.testnet.sui.io/graphql",
8
- });
9
- const chainIdentifierQuery = (0, latest_1.graphql)(`
10
- query {
11
- chainIdentifier
12
- }
13
- `);
14
- async function getChainIdentifier() {
15
- const result = await gqlClient.query({
16
- query: chainIdentifierQuery,
17
- });
18
- return result.data?.chainIdentifier;
19
- }
20
- const getSuinsName = (0, latest_1.graphql)(`
21
- query getSuiName($address: SuiAddress!) {
22
- address(address: $address) {
23
- defaultSuinsName
24
- }
25
- }
26
- `);
27
- async function getDefaultSuinsName(address) {
28
- const result = await gqlClient.query({
29
- query: getSuinsName,
30
- variables: {
31
- address,
32
- },
33
- });
34
- return result.data?.address?.defaultSuinsName;
35
- }
36
- // getDefaultSuinsName("0xd15f079d5f60b8fdfdcf3ca66c0d3473790c758b04b6418929d5d2991c5443ee").then((x) => console.log(x));
37
- const dynamicFieldQuery = (0, latest_1.graphql)(`
38
- query DynamicField($address: SuiAddress!) {
39
- object(address: $address) {
40
- dynamicField(name: { type: "0x2::kiosk::Lock", bcs: "NLArx1UJguOUYmXgNG8Pv8KbKXLjWtCi6i0Yeq1Vhfw=" }) {
41
- ...DynamicFieldSelect
42
- }
43
- }
44
- }
45
-
46
- fragment DynamicFieldSelect on DynamicField {
47
- name {
48
- ...MoveValueFields
49
- }
50
- value {
51
- ...DynamicFieldValueSelection
52
- }
53
- }
54
-
55
- fragment DynamicFieldValueSelection on DynamicFieldValue {
56
- __typename
57
- ... on MoveValue {
58
- ...MoveValueFields
59
- }
60
- ... on MoveObject {
61
- hasPublicTransfer
62
- contents {
63
- ...MoveValueFields
64
- }
65
- }
66
- }
67
-
68
- fragment MoveValueFields on MoveValue {
69
- type {
70
- repr
71
- }
72
- json
73
- bcs
74
- }
75
- `);
76
- async function getDynamicField(address) {
77
- const result = await gqlClient.query({
78
- query: dynamicFieldQuery,
79
- variables: {
80
- address,
81
- },
82
- });
83
- return result.data?.object?.dynamicField;
84
- }
85
- // getDynamicField("0xb57fba584a700a5bcb40991e1b2e6bf68b0f3896d767a0da92e69de73de226ac").then((x) => console.log(x));
86
- const dynamicFieldsQuery = (0, latest_1.graphql)(`
87
- query ($id: SuiAddress!) {
88
- address(address: $id) {
89
- dynamicFields {
90
- nodes {
91
- name {
92
- ...Value
93
- }
94
- value {
95
- __typename
96
- ... on MoveValue {
97
- ...Value
98
- }
99
- ... on MoveObject {
100
- contents {
101
- ...Value
102
- }
103
- }
104
- }
105
- }
106
- }
107
- }
108
- }
109
-
110
- fragment Value on MoveValue {
111
- type {
112
- repr
113
- }
114
- json
115
- }
116
- `);
117
- async function getDynamicFields(gqlClient, id) {
118
- const result = await gqlClient.query({
119
- query: dynamicFieldsQuery,
120
- variables: {
121
- id,
122
- },
123
- });
124
- return result.data?.address?.dynamicFields;
125
- }
126
- getDynamicFields(gqlClient, "0x54447a759a238f93ff847177bd87ace4b6ebc83553080611b93ac394122ecc4d").then((x) => console.dir(x, { depth: null }));
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const grpc_1 = require("@mysten/sui/grpc");
4
- const src_1 = require("../../src");
5
- const gRpcClient = new grpc_1.SuiGrpcClient({ network: src_1.NETWORK.toLowerCase(), baseUrl: `https://fullnode.${src_1.NETWORK.toLowerCase()}.sui.io:443` });
6
- // gRpcClient.ledgerService
7
- // .getObject({ objectId: LIQUIDITY_POOL_0, readMask: { paths: ["contents"] } })
8
- // .then((x) => console.log(x.response.object?.contents));
9
- // gRpcClient.ledgerService
10
- // .batchGetObjects({
11
- // requests: [{ objectId: LIQUIDITY_POOL_0 }, { objectId: LIQUIDITY_POOL_0 }],
12
- // readMask: { paths: ["contents"] },
13
- // })
14
- // .then((x) =>
15
- // x.response.objects.map((x) => {
16
- // if (x.result.oneofKind === "object") {
17
- // console.log(x.result.object.contents);
18
- // } else if (x.result.oneofKind === "error") {
19
- // console.error(x.result.error);
20
- // } else {
21
- // console.warn("undefined case");
22
- // }
23
- // })
24
- // );
25
- // gRpcClient.stateService
26
- // .listDynamicFields({
27
- // parent: "0xfbd1ad8da88e7cb228f1c12a87399b19acd4f25c64a3503a7aad8747751580aa",
28
- // readMask: { paths: ["field_object"] },
29
- // })
30
- // .then((x) =>
31
- // x.response.dynamicFields.map((x) => {
32
- // console.log(x);
33
- // return x.fieldObject?.contents;
34
- // })
35
- // );
36
- // getBalance
37
- // listBalances;
38
- // listOwnedObjects
File without changes
@@ -1,64 +0,0 @@
1
- "use strict";
2
- // import * as grpc from "@grpc/grpc-js";
3
- // import * as protoLoader from "@grpc/proto-loader";
4
- // // Load proto definitions
5
- // const packageDefinition = protoLoader.loadSync("sui/rpc/v2/ledger_service.proto", {
6
- // keepCase: true,
7
- // longs: String,
8
- // enums: String,
9
- // defaults: true,
10
- // oneofs: true,
11
- // includeDirs: ["src/grpc/proto"],
12
- // });
13
- // const suiProto = grpc.loadPackageDefinition(packageDefinition) as any;
14
- // const LedgerService = suiProto.sui.rpc.v2.LedgerService;
15
- // // Create gRPC client
16
- // const client = new LedgerService("fullnode.testnet.sui.io:443", grpc.credentials.createSsl());
17
- // // // Sample transaction digest in Base58 format
18
- // // const base58Digest = "3ByWphQ5sAVojiTrTrGXGM5FmCVzpzYmhsjbhYESJtxp";
19
- // // // Construct the request
20
- // // const request = {
21
- // // digest: base58Digest,
22
- // // read_mask: {
23
- // // paths: ["events", "effects"],
24
- // // },
25
- // // };
26
- // // // Make gRPC call
27
- // // client.GetTransaction(request, (err: any, response: any) => {
28
- // // if (err) {
29
- // // console.error("Error:", err);
30
- // // } else {
31
- // // console.log("Response:", JSON.stringify(response, null, 2));
32
- // // }
33
- // // });
34
- // // const request = {
35
- // // object_id: "0x0285cbf4aa8585be6c978235d11d06fa35773266ede040d38d34e1d79b049460",
36
- // // read_mask: {
37
- // // paths: ["bcs"],
38
- // // },
39
- // // };
40
- // // // Make gRPC call
41
- // // client.GetObject(request, (err: any, response: any) => {
42
- // // if (err) {
43
- // // console.error("Error:", err);
44
- // // } else {
45
- // // console.dir(response);
46
- // // }
47
- // // });
48
- // const request = {
49
- // requests: [
50
- // { object_id: "0x0285cbf4aa8585be6c978235d11d06fa35773266ede040d38d34e1d79b049460" },
51
- // { object_id: "0x50b01081469d032e04bfcbd057614b1359376920f55c7bebd076e0e2af07a57f" },
52
- // ],
53
- // read_mask: {
54
- // paths: ["bcs"],
55
- // },
56
- // };
57
- // // Make gRPC call
58
- // client.BatchGetObjects(request, (err: any, response: any) => {
59
- // if (err) {
60
- // console.error("Error:", err);
61
- // } else {
62
- // console.dir(response, { depth: null });
63
- // }
64
- // });
File without changes
@@ -1,49 +0,0 @@
1
- "use strict";
2
- // import * as grpc from "@grpc/grpc-js";
3
- // import * as protoLoader from "@grpc/proto-loader";
4
- // import * as path from "path";
5
- // // Load proto definitions
6
- // const packageDefinition = protoLoader.loadSync("sui/rpc/v2beta2/live_data_service.proto", {
7
- // keepCase: true,
8
- // longs: String,
9
- // enums: String,
10
- // defaults: true,
11
- // oneofs: true,
12
- // includeDirs: ["src/grpc/proto"],
13
- // });
14
- // const suiProto = grpc.loadPackageDefinition(packageDefinition) as any;
15
- // const LiveDataService = suiProto.sui.rpc.v2beta2.LiveDataService;
16
- // // console.log(Object.keys(LiveDataService.service));
17
- // // Create gRPC client
18
- // const client = new LiveDataService("fullnode.testnet.sui.io:443", grpc.credentials.createSsl());
19
- // // Construct the request
20
- // const request1 = {
21
- // parent: "0x0285cbf4aa8585be6c978235d11d06fa35773266ede040d38d34e1d79b049460",
22
- // page_size: 50, // maximum 1000
23
- // // page_token,
24
- // read_mask: {
25
- // paths: ["name_value", "object"],
26
- // },
27
- // };
28
- // // Make gRPC call
29
- // client.ListDynamicFields(request1, (err: any, response: any) => {
30
- // if (err) {
31
- // console.error("Error:", err);
32
- // } else {
33
- // console.log("Response:", JSON.stringify(response, null, 2));
34
- // }
35
- // });
36
- // // // Construct the request
37
- // // const request2 = {
38
- // // owner: "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
39
- // // // page_size: 50, // maximum 1000
40
- // // // page_token,
41
- // // };
42
- // // // Make gRPC call
43
- // // client.ListOwnedObjects(request2, (err: any, response: any) => {
44
- // // if (err) {
45
- // // console.error("Error:", err);
46
- // // } else {
47
- // // console.log("Response:", JSON.stringify(response, null, 2));
48
- // // }
49
- // // });