@halot/sdk 1.0.0 → 1.0.2
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 +1 -0
- package/dist/index.js +1 -0
- package/dist/network-config.d.ts +36 -0
- package/dist/network-config.js +64 -0
- package/dist/types/common.d.ts +12 -12
- package/dist/types/common.js +12 -8
- package/dist/types/provider.d.ts +8 -8
- package/dist/types/verifier.d.ts +8 -8
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
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/dist/types/common.d.ts
CHANGED
|
@@ -48,25 +48,25 @@ export declare const WalletSchema: z.ZodObject<{
|
|
|
48
48
|
privateKey: z.ZodString;
|
|
49
49
|
}, z.core.$strip>;
|
|
50
50
|
export declare const SettlementWalletsSchema: z.ZodObject<{
|
|
51
|
-
'0g:testnet': z.
|
|
52
|
-
'0g:mainnet': z.
|
|
53
|
-
'stellar:testnet': z.
|
|
54
|
-
'stellar:mainnet': z.
|
|
51
|
+
'0g:testnet': z.ZodOptional<z.ZodString>;
|
|
52
|
+
'0g:mainnet': z.ZodOptional<z.ZodString>;
|
|
53
|
+
'stellar:testnet': z.ZodOptional<z.ZodString>;
|
|
54
|
+
'stellar:mainnet': z.ZodOptional<z.ZodString>;
|
|
55
55
|
}, z.core.$strip>;
|
|
56
56
|
export declare const WalletBundleSchema: z.ZodObject<{
|
|
57
57
|
authorities: z.ZodObject<{
|
|
58
|
-
'0g:testnet': z.ZodObject<{
|
|
58
|
+
'0g:testnet': z.ZodOptional<z.ZodObject<{
|
|
59
59
|
privateKey: z.ZodString;
|
|
60
|
-
}, z.core.$strip
|
|
61
|
-
'0g:mainnet': z.ZodObject<{
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
'0g:mainnet': z.ZodOptional<z.ZodObject<{
|
|
62
62
|
privateKey: z.ZodString;
|
|
63
|
-
}, z.core.$strip
|
|
64
|
-
'stellar:testnet': z.ZodObject<{
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
'stellar:testnet': z.ZodOptional<z.ZodObject<{
|
|
65
65
|
privateKey: z.ZodString;
|
|
66
|
-
}, z.core.$strip
|
|
67
|
-
'stellar:mainnet': z.ZodObject<{
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
'stellar:mainnet': z.ZodOptional<z.ZodObject<{
|
|
68
68
|
privateKey: z.ZodString;
|
|
69
|
-
}, z.core.$strip
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
70
|
}, z.core.$strip>;
|
|
71
71
|
}, z.core.$strip>;
|
|
72
72
|
export declare const OnchainAnchorSchema: z.ZodObject<{
|
package/dist/types/common.js
CHANGED
|
@@ -43,17 +43,21 @@ exports.WalletSchema = zod_1.z.object({
|
|
|
43
43
|
privateKey: zod_1.z.string(),
|
|
44
44
|
});
|
|
45
45
|
exports.SettlementWalletsSchema = zod_1.z.object({
|
|
46
|
-
'0g:testnet': zod_1.z.string().
|
|
47
|
-
'0g:mainnet': zod_1.z.string().
|
|
48
|
-
'stellar:testnet': zod_1.z.string().
|
|
49
|
-
'stellar:mainnet': zod_1.z.string().
|
|
46
|
+
'0g:testnet': zod_1.z.string().optional(),
|
|
47
|
+
'0g:mainnet': zod_1.z.string().optional(),
|
|
48
|
+
'stellar:testnet': zod_1.z.string().optional(),
|
|
49
|
+
'stellar:mainnet': zod_1.z.string().optional(),
|
|
50
|
+
}).refine((wallets) => Object.values(wallets).some((wallet) => typeof wallet === 'string' && wallet.length > 0), {
|
|
51
|
+
message: 'At least one settlement wallet is required',
|
|
50
52
|
});
|
|
51
53
|
exports.WalletBundleSchema = zod_1.z.object({
|
|
52
54
|
authorities: zod_1.z.object({
|
|
53
|
-
'0g:testnet': exports.WalletSchema,
|
|
54
|
-
'0g:mainnet': exports.WalletSchema,
|
|
55
|
-
'stellar:testnet': exports.WalletSchema,
|
|
56
|
-
'stellar:mainnet': exports.WalletSchema,
|
|
55
|
+
'0g:testnet': exports.WalletSchema.optional(),
|
|
56
|
+
'0g:mainnet': exports.WalletSchema.optional(),
|
|
57
|
+
'stellar:testnet': exports.WalletSchema.optional(),
|
|
58
|
+
'stellar:mainnet': exports.WalletSchema.optional(),
|
|
59
|
+
}).refine((authorities) => Object.values(authorities).some(Boolean), {
|
|
60
|
+
message: 'At least one wallet authority is required',
|
|
57
61
|
}),
|
|
58
62
|
});
|
|
59
63
|
exports.OnchainAnchorSchema = zod_1.z.object({
|
package/dist/types/provider.d.ts
CHANGED
|
@@ -30,10 +30,10 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
30
30
|
}>;
|
|
31
31
|
}, z.core.$strip>;
|
|
32
32
|
settlementWallets: z.ZodObject<{
|
|
33
|
-
'0g:testnet': z.
|
|
34
|
-
'0g:mainnet': z.
|
|
35
|
-
'stellar:testnet': z.
|
|
36
|
-
'stellar:mainnet': z.
|
|
33
|
+
'0g:testnet': z.ZodOptional<z.ZodString>;
|
|
34
|
+
'0g:mainnet': z.ZodOptional<z.ZodString>;
|
|
35
|
+
'stellar:testnet': z.ZodOptional<z.ZodString>;
|
|
36
|
+
'stellar:mainnet': z.ZodOptional<z.ZodString>;
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
export declare const RegisteredProviderSchema: z.ZodObject<{
|
|
@@ -58,10 +58,10 @@ export declare const RegisteredProviderSchema: z.ZodObject<{
|
|
|
58
58
|
}>;
|
|
59
59
|
}, z.core.$strip>;
|
|
60
60
|
settlementWallets: z.ZodObject<{
|
|
61
|
-
'0g:testnet': z.
|
|
62
|
-
'0g:mainnet': z.
|
|
63
|
-
'stellar:testnet': z.
|
|
64
|
-
'stellar:mainnet': z.
|
|
61
|
+
'0g:testnet': z.ZodOptional<z.ZodString>;
|
|
62
|
+
'0g:mainnet': z.ZodOptional<z.ZodString>;
|
|
63
|
+
'stellar:testnet': z.ZodOptional<z.ZodString>;
|
|
64
|
+
'stellar:mainnet': z.ZodOptional<z.ZodString>;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
66
|
providerId: z.ZodString;
|
|
67
67
|
ownerAddress: z.ZodString;
|
package/dist/types/verifier.d.ts
CHANGED
|
@@ -21,10 +21,10 @@ export declare const VerifierConfigSchema: z.ZodObject<{
|
|
|
21
21
|
}>;
|
|
22
22
|
}, z.core.$strip>;
|
|
23
23
|
settlementWallets: z.ZodObject<{
|
|
24
|
-
'0g:testnet': z.
|
|
25
|
-
'0g:mainnet': z.
|
|
26
|
-
'stellar:testnet': z.
|
|
27
|
-
'stellar:mainnet': z.
|
|
24
|
+
'0g:testnet': z.ZodOptional<z.ZodString>;
|
|
25
|
+
'0g:mainnet': z.ZodOptional<z.ZodString>;
|
|
26
|
+
'stellar:testnet': z.ZodOptional<z.ZodString>;
|
|
27
|
+
'stellar:mainnet': z.ZodOptional<z.ZodString>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
stake: z.ZodObject<{
|
|
30
30
|
amount: z.ZodString;
|
|
@@ -93,10 +93,10 @@ export declare const RegisteredVerifierSchema: z.ZodObject<{
|
|
|
93
93
|
}>;
|
|
94
94
|
}, z.core.$strip>;
|
|
95
95
|
settlementWallets: z.ZodObject<{
|
|
96
|
-
'0g:testnet': z.
|
|
97
|
-
'0g:mainnet': z.
|
|
98
|
-
'stellar:testnet': z.
|
|
99
|
-
'stellar:mainnet': z.
|
|
96
|
+
'0g:testnet': z.ZodOptional<z.ZodString>;
|
|
97
|
+
'0g:mainnet': z.ZodOptional<z.ZodString>;
|
|
98
|
+
'stellar:testnet': z.ZodOptional<z.ZodString>;
|
|
99
|
+
'stellar:mainnet': z.ZodOptional<z.ZodString>;
|
|
100
100
|
}, z.core.$strip>;
|
|
101
101
|
stake: z.ZodObject<{
|
|
102
102
|
amount: z.ZodString;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halot/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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"
|