@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.
- package/README.md +550 -2
- package/dist/browser/obelisk-client.js +102 -0
- package/dist/browser/obelisk-client.js.LICENSE.txt +16 -0
- package/dist/browser/obelisk-client.js.map +1 -0
- package/dist/browser/obelisk-client.min.js +101 -0
- package/dist/browser/obelisk-client.min.js.map +1 -0
- package/dist/index.d.ts +27 -9
- package/dist/sui/client.d.ts +59 -0
- package/dist/sui/index.d.mts +156 -0
- package/dist/sui/index.d.ts +19 -0
- package/dist/sui/index.js +93 -0
- package/dist/sui/index.js.map +1 -0
- package/dist/sui/index.mjs +88 -0
- package/dist/sui/index.mjs.map +1 -0
- package/dist/sui/types.d.ts +90 -0
- package/package.json +60 -121
- package/src/index.ts +31 -9
- package/src/sui/client.test.ts +277 -0
- package/src/sui/client.ts +157 -0
- package/src/sui/index.ts +30 -0
- package/src/sui/types.ts +94 -0
- package/LICENSE +0 -92
- package/dist/index.js +0 -1287
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1268
- package/dist/index.mjs.map +0 -1
- package/dist/libs/suiAccountManager/crypto.d.ts +0 -1
- package/dist/libs/suiAccountManager/index.d.ts +0 -35
- package/dist/libs/suiAccountManager/keypair.d.ts +0 -21
- package/dist/libs/suiAccountManager/util.d.ts +0 -29
- package/dist/libs/suiContractFactory/index.d.ts +0 -20
- package/dist/libs/suiContractFactory/types.d.ts +0 -49
- package/dist/libs/suiInteractor/defaultConfig.d.ts +0 -10
- package/dist/libs/suiInteractor/index.d.ts +0 -2
- package/dist/libs/suiInteractor/suiInteractor.d.ts +0 -205
- package/dist/libs/suiInteractor/util.d.ts +0 -1
- package/dist/libs/suiModel/index.d.ts +0 -2
- package/dist/libs/suiModel/suiOwnedObject.d.ts +0 -24
- package/dist/libs/suiModel/suiSharedObject.d.ts +0 -12
- package/dist/libs/suiTxBuilder/index.d.ts +0 -544
- package/dist/libs/suiTxBuilder/util.d.ts +0 -76
- package/dist/metadata/index.d.ts +0 -34
- package/dist/obelisk.d.ts +0 -2566
- package/dist/types/index.d.ts +0 -141
- package/dist/utils/index.d.ts +0 -3
- package/src/libs/suiAccountManager/crypto.ts +0 -7
- package/src/libs/suiAccountManager/index.ts +0 -72
- package/src/libs/suiAccountManager/keypair.ts +0 -38
- package/src/libs/suiAccountManager/util.ts +0 -70
- package/src/libs/suiContractFactory/index.ts +0 -120
- package/src/libs/suiContractFactory/types.ts +0 -54
- package/src/libs/suiInteractor/defaultConfig.ts +0 -32
- package/src/libs/suiInteractor/index.ts +0 -2
- package/src/libs/suiInteractor/suiInteractor.ts +0 -319
- package/src/libs/suiInteractor/util.ts +0 -2
- package/src/libs/suiModel/index.ts +0 -2
- package/src/libs/suiModel/suiOwnedObject.ts +0 -62
- package/src/libs/suiModel/suiSharedObject.ts +0 -33
- package/src/libs/suiTxBuilder/index.ts +0 -245
- package/src/libs/suiTxBuilder/util.ts +0 -84
- package/src/metadata/index.ts +0 -22
- package/src/obelisk.ts +0 -600
- package/src/types/index.ts +0 -205
- package/src/utils/index.ts +0 -23
package/src/sui/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @0xobelisk/client/sui - Unified Dubhe Client for Sui Blockchain
|
|
3
|
+
*
|
|
4
|
+
* 🚀 Simple, powerful client creation aligned with @0xobelisk/react
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - ⚡ Unified configuration interface
|
|
8
|
+
* - 🔧 Factory pattern for easy instantiation
|
|
9
|
+
* - 🛡️ Complete type safety with strict TypeScript
|
|
10
|
+
* - 📦 All-in-one bundle with contract, GraphQL, gRPC, and ECS clients
|
|
11
|
+
* - 🎯 Intuitive API design
|
|
12
|
+
* - 🌐 Platform-agnostic (Browser, Node.js, COCOS)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// ============ Type Exports ============
|
|
16
|
+
export type { NetworkType, ClientConfig, DubheConfig, DubheClientBundle } from './types';
|
|
17
|
+
|
|
18
|
+
// ============ Client Factory Functions ============
|
|
19
|
+
export {
|
|
20
|
+
createClient,
|
|
21
|
+
createClientWithValidation,
|
|
22
|
+
validateClientConfig,
|
|
23
|
+
isNetworkType
|
|
24
|
+
} from './client';
|
|
25
|
+
|
|
26
|
+
// ============ Re-export Core Types for Convenience ============
|
|
27
|
+
export type { Dubhe } from '@0xobelisk/sui-client';
|
|
28
|
+
export type { DubheGraphqlClient } from '@0xobelisk/graphql-client';
|
|
29
|
+
export type { DubheECSWorld } from '@0xobelisk/ecs';
|
|
30
|
+
export type { DubheGrpcClient } from '@0xobelisk/grpc-client';
|
package/src/sui/types.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { SuiMoveNormalizedModules, Dubhe } from '@0xobelisk/sui-client';
|
|
2
|
+
import type { DubheGraphqlClient } from '@0xobelisk/graphql-client';
|
|
3
|
+
import type { DubheECSWorld } from '@0xobelisk/ecs';
|
|
4
|
+
import type { DubheGrpcClient } from '@0xobelisk/grpc-client';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Network type for Sui blockchain
|
|
8
|
+
*/
|
|
9
|
+
export type NetworkType = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Client configuration interface
|
|
13
|
+
* Aligned with @0xobelisk/react configuration for consistency
|
|
14
|
+
*/
|
|
15
|
+
export interface ClientConfig {
|
|
16
|
+
/** Network type */
|
|
17
|
+
network: NetworkType;
|
|
18
|
+
/** Contract package ID */
|
|
19
|
+
packageId: string;
|
|
20
|
+
/** Contract metadata (required for contract instantiation) */
|
|
21
|
+
metadata: any;
|
|
22
|
+
/** Dubhe Schema ID (optional, for enhanced features) */
|
|
23
|
+
dubheSchemaId?: string;
|
|
24
|
+
/** Dubhe metadata (enables GraphQL/ECS features) */
|
|
25
|
+
dubheMetadata?: any;
|
|
26
|
+
/** Authentication credentials */
|
|
27
|
+
credentials?: {
|
|
28
|
+
/** Private key (base64 or hex string) */
|
|
29
|
+
secretKey?: string;
|
|
30
|
+
/** Mnemonic phrase (12 or 24 words) */
|
|
31
|
+
mnemonics?: string;
|
|
32
|
+
};
|
|
33
|
+
/** Service endpoints configuration */
|
|
34
|
+
endpoints?: {
|
|
35
|
+
/** Full node RPC URLs (can provide multiple for redundancy) */
|
|
36
|
+
fullnodeUrls?: string[];
|
|
37
|
+
/** GraphQL endpoint URL */
|
|
38
|
+
graphql?: string;
|
|
39
|
+
/** WebSocket endpoint URL for subscriptions */
|
|
40
|
+
websocket?: string;
|
|
41
|
+
/** gRPC endpoint URL */
|
|
42
|
+
grpc?: string;
|
|
43
|
+
/** Dubhe Channel API URL */
|
|
44
|
+
channelUrl?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Performance and behavior options */
|
|
47
|
+
options?: {
|
|
48
|
+
/** Enable batch query optimization */
|
|
49
|
+
enableBatchOptimization?: boolean;
|
|
50
|
+
/** Default cache timeout (milliseconds) */
|
|
51
|
+
cacheTimeout?: number;
|
|
52
|
+
/** Request debounce delay (milliseconds) */
|
|
53
|
+
debounceMs?: number;
|
|
54
|
+
/** Auto-reconnect on WebSocket errors */
|
|
55
|
+
reconnectOnError?: boolean;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Type alias for consistency with @0xobelisk/react package
|
|
61
|
+
*/
|
|
62
|
+
export type DubheConfig = ClientConfig;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Client bundle returned by createClient
|
|
66
|
+
* Contains all initialized client instances
|
|
67
|
+
*/
|
|
68
|
+
export interface DubheClientBundle {
|
|
69
|
+
/** Dubhe contract instance - core client for contract interactions */
|
|
70
|
+
contract: Dubhe;
|
|
71
|
+
/** GraphQL client for querying indexed data */
|
|
72
|
+
graphqlClient: DubheGraphqlClient;
|
|
73
|
+
/** gRPC client for high-performance queries */
|
|
74
|
+
grpcClient: DubheGrpcClient;
|
|
75
|
+
/** ECS World instance for entity-component-system queries */
|
|
76
|
+
ecsWorld: DubheECSWorld;
|
|
77
|
+
/** Contract metadata */
|
|
78
|
+
metadata: SuiMoveNormalizedModules;
|
|
79
|
+
/** Network type */
|
|
80
|
+
network: NetworkType;
|
|
81
|
+
/** Package ID */
|
|
82
|
+
packageId: string;
|
|
83
|
+
/** Dubhe Schema ID (if provided) */
|
|
84
|
+
dubheSchemaId?: string;
|
|
85
|
+
/** User address */
|
|
86
|
+
address: string;
|
|
87
|
+
/** Configuration options used */
|
|
88
|
+
options?: {
|
|
89
|
+
enableBatchOptimization?: boolean;
|
|
90
|
+
cacheTimeout?: number;
|
|
91
|
+
debounceMs?: number;
|
|
92
|
+
reconnectOnError?: boolean;
|
|
93
|
+
};
|
|
94
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
Business Source License 1.1
|
|
2
|
-
|
|
3
|
-
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
4
|
-
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
5
|
-
|
|
6
|
-
-----------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
Parameters
|
|
9
|
-
|
|
10
|
-
Licensor: Obelisk Labs
|
|
11
|
-
|
|
12
|
-
Licensed Work: Obelisk Engine
|
|
13
|
-
The Licensed Work is (c) 2023 Obelisk Labs
|
|
14
|
-
|
|
15
|
-
-----------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
Terms
|
|
18
|
-
|
|
19
|
-
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
20
|
-
works, redistribute, and make non-production use of the Licensed Work. The
|
|
21
|
-
Licensor may make an Additional Use Grant, above, permitting limited
|
|
22
|
-
production use.
|
|
23
|
-
|
|
24
|
-
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
25
|
-
available distribution of a specific version of the Licensed Work under this
|
|
26
|
-
License, whichever comes first, the Licensor hereby grants you rights under
|
|
27
|
-
the terms of the Change License, and the rights granted in the paragraph
|
|
28
|
-
above terminate.
|
|
29
|
-
|
|
30
|
-
If your use of the Licensed Work does not comply with the requirements
|
|
31
|
-
currently in effect as described in this License, you must purchase a
|
|
32
|
-
commercial license from the Licensor, its affiliated entities, or authorized
|
|
33
|
-
resellers, or you must refrain from using the Licensed Work.
|
|
34
|
-
|
|
35
|
-
All copies of the original and modified Licensed Work, and derivative works
|
|
36
|
-
of the Licensed Work, are subject to this License. This License applies
|
|
37
|
-
separately for each version of the Licensed Work and the Change Date may vary
|
|
38
|
-
for each version of the Licensed Work released by Licensor.
|
|
39
|
-
|
|
40
|
-
You must conspicuously display this License on each original or modified copy
|
|
41
|
-
of the Licensed Work. If you receive the Licensed Work in original or
|
|
42
|
-
modified form from a third party, the terms and conditions set forth in this
|
|
43
|
-
License apply to your use of that work.
|
|
44
|
-
|
|
45
|
-
Any use of the Licensed Work in violation of this License will automatically
|
|
46
|
-
terminate your rights under this License for the current and all other
|
|
47
|
-
versions of the Licensed Work.
|
|
48
|
-
|
|
49
|
-
This License does not grant you any right in any trademark or logo of
|
|
50
|
-
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
51
|
-
Licensor as expressly required by this License).
|
|
52
|
-
|
|
53
|
-
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
54
|
-
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
55
|
-
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
56
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
57
|
-
TITLE.
|
|
58
|
-
|
|
59
|
-
MariaDB hereby grants you permission to use this License’s text to license
|
|
60
|
-
your works, and to refer to it using the trademark "Business Source License",
|
|
61
|
-
as long as you comply with the Covenants of Licensor below.
|
|
62
|
-
|
|
63
|
-
-----------------------------------------------------------------------------
|
|
64
|
-
|
|
65
|
-
Covenants of Licensor
|
|
66
|
-
|
|
67
|
-
In consideration of the right to use this License’s text and the "Business
|
|
68
|
-
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
69
|
-
other recipients of the licensed work to be provided by Licensor:
|
|
70
|
-
|
|
71
|
-
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
72
|
-
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
73
|
-
where "compatible" means that software provided under the Change License can
|
|
74
|
-
be included in a program with software provided under GPL Version 2.0 or a
|
|
75
|
-
later version. Licensor may specify additional Change Licenses without
|
|
76
|
-
limitation.
|
|
77
|
-
|
|
78
|
-
2. To either: (a) specify an additional grant of rights to use that does not
|
|
79
|
-
impose any additional restriction on the right granted in this License, as
|
|
80
|
-
the Additional Use Grant; or (b) insert the text "None".
|
|
81
|
-
|
|
82
|
-
3. To specify a Change Date.
|
|
83
|
-
|
|
84
|
-
4. Not to modify this License in any other way.
|
|
85
|
-
|
|
86
|
-
-----------------------------------------------------------------------------
|
|
87
|
-
|
|
88
|
-
Notice
|
|
89
|
-
|
|
90
|
-
The Business Source License (this document, or the "License") is not an Open
|
|
91
|
-
Source license. However, the Licensed Work will eventually be made available
|
|
92
|
-
under an Open Source License, as stated in this License.
|