@0xobelisk/client 0.4.7 → 1.2.0-pre.100

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 (64) hide show
  1. package/README.md +550 -2
  2. package/dist/browser/obelisk-client.js +102 -0
  3. package/dist/browser/obelisk-client.js.LICENSE.txt +16 -0
  4. package/dist/browser/obelisk-client.js.map +1 -0
  5. package/dist/browser/obelisk-client.min.js +101 -0
  6. package/dist/browser/obelisk-client.min.js.map +1 -0
  7. package/dist/index.d.ts +27 -9
  8. package/dist/sui/client.d.ts +59 -0
  9. package/dist/sui/index.d.mts +156 -0
  10. package/dist/sui/index.d.ts +19 -0
  11. package/dist/sui/index.js +93 -0
  12. package/dist/sui/index.js.map +1 -0
  13. package/dist/sui/index.mjs +88 -0
  14. package/dist/sui/index.mjs.map +1 -0
  15. package/dist/sui/types.d.ts +90 -0
  16. package/package.json +60 -121
  17. package/src/index.ts +31 -9
  18. package/src/sui/client.test.ts +277 -0
  19. package/src/sui/client.ts +157 -0
  20. package/src/sui/index.ts +30 -0
  21. package/src/sui/types.ts +94 -0
  22. package/LICENSE +0 -92
  23. package/dist/index.js +0 -1287
  24. package/dist/index.js.map +0 -1
  25. package/dist/index.mjs +0 -1268
  26. package/dist/index.mjs.map +0 -1
  27. package/dist/libs/suiAccountManager/crypto.d.ts +0 -1
  28. package/dist/libs/suiAccountManager/index.d.ts +0 -35
  29. package/dist/libs/suiAccountManager/keypair.d.ts +0 -21
  30. package/dist/libs/suiAccountManager/util.d.ts +0 -29
  31. package/dist/libs/suiContractFactory/index.d.ts +0 -20
  32. package/dist/libs/suiContractFactory/types.d.ts +0 -49
  33. package/dist/libs/suiInteractor/defaultConfig.d.ts +0 -10
  34. package/dist/libs/suiInteractor/index.d.ts +0 -2
  35. package/dist/libs/suiInteractor/suiInteractor.d.ts +0 -205
  36. package/dist/libs/suiInteractor/util.d.ts +0 -1
  37. package/dist/libs/suiModel/index.d.ts +0 -2
  38. package/dist/libs/suiModel/suiOwnedObject.d.ts +0 -24
  39. package/dist/libs/suiModel/suiSharedObject.d.ts +0 -12
  40. package/dist/libs/suiTxBuilder/index.d.ts +0 -544
  41. package/dist/libs/suiTxBuilder/util.d.ts +0 -76
  42. package/dist/metadata/index.d.ts +0 -34
  43. package/dist/obelisk.d.ts +0 -2566
  44. package/dist/types/index.d.ts +0 -141
  45. package/dist/utils/index.d.ts +0 -3
  46. package/src/libs/suiAccountManager/crypto.ts +0 -7
  47. package/src/libs/suiAccountManager/index.ts +0 -72
  48. package/src/libs/suiAccountManager/keypair.ts +0 -38
  49. package/src/libs/suiAccountManager/util.ts +0 -70
  50. package/src/libs/suiContractFactory/index.ts +0 -120
  51. package/src/libs/suiContractFactory/types.ts +0 -54
  52. package/src/libs/suiInteractor/defaultConfig.ts +0 -32
  53. package/src/libs/suiInteractor/index.ts +0 -2
  54. package/src/libs/suiInteractor/suiInteractor.ts +0 -319
  55. package/src/libs/suiInteractor/util.ts +0 -2
  56. package/src/libs/suiModel/index.ts +0 -2
  57. package/src/libs/suiModel/suiOwnedObject.ts +0 -62
  58. package/src/libs/suiModel/suiSharedObject.ts +0 -33
  59. package/src/libs/suiTxBuilder/index.ts +0 -245
  60. package/src/libs/suiTxBuilder/util.ts +0 -84
  61. package/src/metadata/index.ts +0 -22
  62. package/src/obelisk.ts +0 -600
  63. package/src/types/index.ts +0 -205
  64. package/src/utils/index.ts +0 -23
@@ -1,205 +0,0 @@
1
- import { Infer } from 'superstruct';
2
- import {
3
- DisplayFieldsResponse,
4
- ObjectCallArg,
5
- ObjectContentFields,
6
- SharedObjectRef,
7
- SuiObjectRef,
8
- TransactionArgument,
9
- TransactionBlock,
10
- SuiTransactionBlockResponse,
11
- DevInspectResults,
12
- SuiMoveNormalizedModules,
13
- } from '@mysten/sui.js';
14
-
15
- import { SuiMoveMoudleFuncType } from '../libs/suiContractFactory/types';
16
-
17
- export type ObeliskObjectData = {
18
- objectId: string;
19
- objectType: string;
20
- objectVersion: number;
21
- objectDisplay: DisplayFieldsResponse;
22
- objectFields: ObjectContentFields;
23
- };
24
-
25
- export type ObeliskParams = {
26
- mnemonics?: string;
27
- secretKey?: string;
28
- fullnodeUrls?: string[];
29
- faucetUrl?: string;
30
- networkType?: NetworkType;
31
- packageId?: string;
32
- metadata?: SuiMoveNormalizedModules;
33
- };
34
-
35
- export type SchemaFieldType = {
36
- schemas: {
37
- type: string;
38
- fields: {
39
- id: {
40
- id: string;
41
- };
42
- size: string;
43
- };
44
- };
45
- };
46
-
47
- export type SchemaValueType = {
48
- id: {
49
- id: string;
50
- };
51
- name: string;
52
- value: {
53
- type: string;
54
- fields: SchemaFieldType;
55
- };
56
- };
57
-
58
- export type SuiTxArgument =
59
- | {
60
- kind: 'Input';
61
- index: number;
62
- type?: 'object' | 'pure' | undefined;
63
- value?: any;
64
- }
65
- | {
66
- kind: 'GasCoin';
67
- }
68
- | {
69
- kind: 'Result';
70
- index: number;
71
- }
72
- | {
73
- kind: 'NestedResult';
74
- index: number;
75
- resultIndex: number;
76
- };
77
- export type SchemaContentType = {
78
- type: string;
79
- fields: SchemaValueType;
80
- hasPublicTransfer: boolean;
81
- dataType: 'moveObject';
82
- };
83
-
84
- export interface MessageMeta {
85
- readonly meta: SuiMoveMoudleFuncType;
86
- }
87
-
88
- export interface ContractQuery extends MessageMeta {
89
- (tx: TransactionBlock, params: SuiTxArgument[], isRaw?: boolean): Promise<
90
- DevInspectResults | TransactionBlock
91
- >;
92
- }
93
-
94
- export interface ContractTx extends MessageMeta {
95
- (tx: TransactionBlock, params: SuiTxArgument[], isRaw?: boolean):
96
- | SuiTransactionBlockResponse
97
- | TransactionBlock;
98
- }
99
-
100
- export type MapMessageTx = Record<string, ContractTx>;
101
- export type MapMessageQuery = Record<string, ContractQuery>;
102
-
103
- export type MapMoudleFuncTx = Record<string, MapMessageTx>;
104
- export type MapMoudleFuncQuery = Record<string, MapMessageQuery>;
105
-
106
- export type MapMoudleFuncTest = Record<string, Record<string, string>>;
107
- export type MapMoudleFuncQueryTest = Record<string, Record<string, string>>;
108
-
109
- export type AccountMangerParams = {
110
- mnemonics?: string;
111
- secretKey?: string;
112
- };
113
-
114
- export type DerivePathParams = {
115
- accountIndex?: number;
116
- isExternal?: boolean;
117
- addressIndex?: number;
118
- };
119
-
120
- export type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
121
- export type FaucetNetworkType = 'testnet' | 'devnet' | 'localnet';
122
-
123
- export type SuiKitParams = {
124
- mnemonics?: string;
125
- secretKey?: string;
126
- fullnodeUrls?: string[];
127
- faucetUrl?: string;
128
- networkType?: NetworkType;
129
- };
130
-
131
- export type ObjectData = {
132
- objectId: string;
133
- objectType: string;
134
- objectVersion: number;
135
- objectDigest: string;
136
- initialSharedVersion?: number;
137
- objectDisplay: DisplayFieldsResponse;
138
- objectFields: ObjectContentFields;
139
- };
140
-
141
- export type ObjectFieldType = {
142
- id: {
143
- id: string;
144
- };
145
- name: string;
146
- value: string;
147
- };
148
-
149
- export type EntityData = {
150
- objectId: string;
151
- index: string;
152
- key: string;
153
- };
154
-
155
- export type SuiTxArg =
156
- | Infer<typeof TransactionArgument>
157
- | Infer<typeof ObjectCallArg>
158
- | string
159
- | number
160
- | bigint
161
- | boolean;
162
-
163
- export type SuiObjectArg =
164
- | SharedObjectRef
165
- | Infer<typeof SuiObjectRef>
166
- | string
167
- | Infer<typeof ObjectCallArg>
168
- | Infer<typeof TransactionArgument>;
169
-
170
- export type SuiVecTxArg =
171
- | { value: SuiTxArg[]; vecType: SuiInputTypes }
172
- | SuiTxArg[];
173
-
174
- /**
175
- * These are the basics types that can be used in the SUI
176
- */
177
- export type SuiBasicTypes =
178
- | 'address'
179
- | 'bool'
180
- | 'u8'
181
- | 'u16'
182
- | 'u32'
183
- | 'u64'
184
- | 'u128'
185
- | 'u256';
186
-
187
- export type SuiInputTypes = 'object' | SuiBasicTypes;
188
-
189
- export type SuiReturnValues = {
190
- returnValues: [number[], string][];
191
- }[];
192
-
193
- export type DynamicFieldContentType = {
194
- type: string;
195
- fields: Record<string, any>;
196
- hasPublicTransfer: boolean;
197
- dataType: string;
198
- };
199
-
200
- export type ObjectContent = {
201
- type: string;
202
- fields: Record<string, any>;
203
- hasPublicTransfer: boolean;
204
- dataType: string;
205
- };
@@ -1,23 +0,0 @@
1
- export function capitalizeFirstLetter(input: string): string {
2
- return input.charAt(0).toUpperCase() + input.slice(1);
3
- }
4
-
5
- export function normalizeHexAddress(input: string): string | null {
6
- const hexRegex = /^(0x)?[0-9a-fA-F]{64}$/;
7
-
8
- if (hexRegex.test(input)) {
9
- if (input.startsWith('0x')) {
10
- return input;
11
- } else {
12
- return '0x' + input;
13
- }
14
- } else {
15
- return null;
16
- }
17
- }
18
-
19
- export function numberToAddressHex(num: number): string {
20
- const hex = num.toString(16);
21
- const paddedHex = '0x' + hex.padStart(64, '0');
22
- return paddedHex;
23
- }