@halot/sdk 1.0.0 → 1.0.1

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/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './types/quote';
7
7
  export * from './types/job';
8
8
  export * from './types/x402';
9
9
  export * from './config';
10
+ export * from './network-config';
10
11
  export * from './utils/date';
11
12
  export * from './utils/amount';
12
13
  export * from './utils/category';
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ __exportStar(require("./types/quote"), exports);
24
24
  __exportStar(require("./types/job"), exports);
25
25
  __exportStar(require("./types/x402"), exports);
26
26
  __exportStar(require("./config"), exports);
27
+ __exportStar(require("./network-config"), exports);
27
28
  __exportStar(require("./utils/date"), exports);
28
29
  __exportStar(require("./utils/amount"), exports);
29
30
  __exportStar(require("./utils/category"), exports);
@@ -0,0 +1,36 @@
1
+ import { SettlementNetwork } from './types/common';
2
+ export type HalotNetworkMode = 'testnet' | 'mainnet';
3
+ export type ZeroGAuthorityNetwork = Extract<SettlementNetwork, '0g:testnet' | '0g:mainnet'>;
4
+ export type StellarNetwork = Extract<SettlementNetwork, 'stellar:testnet' | 'stellar:mainnet'>;
5
+ export type SpaceIdDefaults = {
6
+ tldId: number;
7
+ chainId: number;
8
+ graphUrl: string;
9
+ identifier: string;
10
+ controllerAddress: `0x${string}`;
11
+ resolverAddress: `0x${string}`;
12
+ registryAddress: `0x${string}`;
13
+ sannAddress: `0x${string}`;
14
+ verifiedTldHubAddress: `0x${string}`;
15
+ verifiedTldHubRpcUrl: string;
16
+ defaultRpc: string;
17
+ };
18
+ export type ZeroGAuthorityProfile = {
19
+ network: ZeroGAuthorityNetwork;
20
+ networkMode: HalotNetworkMode;
21
+ chainId: number;
22
+ rpcUrl: string;
23
+ providerRegistryAddress?: `0x${string}`;
24
+ verifierRegistryAddress?: `0x${string}`;
25
+ agentIdRegistryAddress?: `0x${string}`;
26
+ spaceId?: SpaceIdDefaults;
27
+ };
28
+ export type StellarNetworkProfile = {
29
+ network: StellarNetwork;
30
+ rpcUrl: string;
31
+ networkPassphrase: string;
32
+ };
33
+ export declare function resolveZeroGAuthorityProfile(network: ZeroGAuthorityNetwork): ZeroGAuthorityProfile;
34
+ export declare function resolveStellarNetworkProfile(network: StellarNetwork): StellarNetworkProfile;
35
+ export declare function resolveZeroGAuthorityByChainId(chainId: number): ZeroGAuthorityNetwork;
36
+ export declare function createZeroGStorageUri(rootHash: string): string;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveZeroGAuthorityProfile = resolveZeroGAuthorityProfile;
4
+ exports.resolveStellarNetworkProfile = resolveStellarNetworkProfile;
5
+ exports.resolveZeroGAuthorityByChainId = resolveZeroGAuthorityByChainId;
6
+ exports.createZeroGStorageUri = createZeroGStorageUri;
7
+ const zeroGAuthorityProfiles = {
8
+ '0g:testnet': {
9
+ network: '0g:testnet',
10
+ networkMode: 'testnet',
11
+ chainId: 16602,
12
+ rpcUrl: 'https://evmrpc-testnet.0g.ai',
13
+ providerRegistryAddress: '0x91703eE68d7840B8ae815e10C8F35b66c16fd888',
14
+ verifierRegistryAddress: '0xFB06f9684BC09d6E997978189B36E404EEf695BE',
15
+ },
16
+ '0g:mainnet': {
17
+ network: '0g:mainnet',
18
+ networkMode: 'mainnet',
19
+ chainId: 16661,
20
+ rpcUrl: 'https://evmrpc.0g.ai',
21
+ spaceId: {
22
+ tldId: 26,
23
+ chainId: 16661,
24
+ graphUrl: 'https://graphigo.prd.space.id/query',
25
+ identifier: '449205675366457712613706471770511817162982777845754732038879201565074548',
26
+ controllerAddress: '0xd7b837a0e388b4c25200983bdaa3ef3a83ca86b7',
27
+ resolverAddress: '0x6D3B3F99177FB2A5de7F9E928a9BD807bF7b5BAD',
28
+ registryAddress: '0x5dC881dDA4e4a8d312be3544AD13118D1a04Cb17',
29
+ sannAddress: '0x9af6F1244df403dAe39Eb2D0be1C3fD0B38e0789',
30
+ verifiedTldHubAddress: '0x754D6827A57334143eD5fB58C5b1A4aAe4396ba5',
31
+ verifiedTldHubRpcUrl: 'https://ethereum-rpc.publicnode.com',
32
+ defaultRpc: 'https://evmrpc.0g.ai',
33
+ },
34
+ },
35
+ };
36
+ const stellarNetworkProfiles = {
37
+ 'stellar:testnet': {
38
+ network: 'stellar:testnet',
39
+ rpcUrl: 'https://soroban-testnet.stellar.org',
40
+ networkPassphrase: 'Test SDF Network ; September 2015',
41
+ },
42
+ 'stellar:mainnet': {
43
+ network: 'stellar:mainnet',
44
+ rpcUrl: 'https://mainnet.sorobanrpc.com',
45
+ networkPassphrase: 'Public Global Stellar Network ; September 2015',
46
+ },
47
+ };
48
+ function resolveZeroGAuthorityProfile(network) {
49
+ return zeroGAuthorityProfiles[network];
50
+ }
51
+ function resolveStellarNetworkProfile(network) {
52
+ return stellarNetworkProfiles[network];
53
+ }
54
+ function resolveZeroGAuthorityByChainId(chainId) {
55
+ for (const profile of Object.values(zeroGAuthorityProfiles)) {
56
+ if (profile.chainId === chainId) {
57
+ return profile.network;
58
+ }
59
+ }
60
+ throw new Error(`Unsupported 0G chain id ${chainId}`);
61
+ }
62
+ function createZeroGStorageUri(rootHash) {
63
+ return `0g://${rootHash}`;
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halot/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared Halot protocol SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,6 +27,8 @@
27
27
  "dist/zero-g",
28
28
  "dist/config.js",
29
29
  "dist/config.d.ts",
30
+ "dist/network-config.js",
31
+ "dist/network-config.d.ts",
30
32
  "dist/index.js",
31
33
  "dist/index.d.ts",
32
34
  "README.md"