@agoric/client-utils 0.1.1-dev-9d21dfc.0.9d21dfc → 0.1.1-dev-47c99cc.0.47c99cc
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/network-config.d.ts
CHANGED
|
@@ -6,9 +6,15 @@ export namespace LOCAL_CONFIG {
|
|
|
6
6
|
}
|
|
7
7
|
export const LOCAL_CONFIG_KEY: "local";
|
|
8
8
|
export function parseNetworkSpec(spec: string): {
|
|
9
|
-
|
|
9
|
+
domain: string;
|
|
10
|
+
subdomain?: string;
|
|
11
|
+
fqdn?: string;
|
|
10
12
|
chainId?: string;
|
|
11
|
-
}
|
|
13
|
+
} & ({
|
|
14
|
+
domain: string;
|
|
15
|
+
} | {
|
|
16
|
+
fqdn: string;
|
|
17
|
+
});
|
|
12
18
|
export function fetchNetworkConfig(spec: string, { fetch }: {
|
|
13
19
|
fetch: typeof globalThis.fetch;
|
|
14
20
|
}): Promise<MinimalNetworkConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-config.d.ts","sourceRoot":"","sources":["../src/network-config.js"],"names":[],"mappings":"AAMO,oEACoD;AAEpD,0DAC6C;;;;;AAQpD,+BAAgC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"network-config.d.ts","sourceRoot":"","sources":["../src/network-config.js"],"names":[],"mappings":"AAMO,oEACoD;AAEpD,0DAC6C;;;;;AAQpD,+BAAgC,OAAO,CAAC;AAkBjC,uCAHI,MAAM,GACJ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAQ7H;AASM,yCAJI,MAAM,aACN;IAAE,KAAK,EAAE,uBAAY,CAAA;CAAE,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAqBzC;;;;;eApEa,MAAM;;;;cACN,MAAM,EAAE"}
|
package/dist/network-config.js
CHANGED
|
@@ -16,17 +16,23 @@ export const LOCAL_CONFIG_KEY = 'local';
|
|
|
16
16
|
* - "$subdomain": a subdomain of agoric.net that is expected to respond to an
|
|
17
17
|
* HTTP request for `/network-config` (e.g., "local" or "main" or a network
|
|
18
18
|
* listed at https://all.agoric.net/ ) with a {@link MinimalNetworkConfig}
|
|
19
|
-
* - "$subdomain,$chainId": a subdomain of rpc.agoric.net that is
|
|
20
|
-
* respond to cosmos-sdk RPC requests, and a Cosmos Chain ID
|
|
21
|
-
* https://evm.cosmos.network/docs/next/documentation/concepts/chain-id
|
|
22
|
-
* https://github.com/cosmos/chain-registry ) to associate with it
|
|
19
|
+
* - "$subdomain,$chainId": a single-word subdomain of rpc.agoric.net that is
|
|
20
|
+
* expected to respond to cosmos-sdk RPC requests, and a Cosmos Chain ID
|
|
21
|
+
* (cf. https://evm.cosmos.network/docs/next/documentation/concepts/chain-id
|
|
22
|
+
* and https://github.com/cosmos/chain-registry ) to associate with it
|
|
23
|
+
* - "$fqdn,$chainId": a fully-qualified domain name that is expected to
|
|
24
|
+
* respond to cosmos-sdk RPC requests, and a Cosmos Chain ID to associate
|
|
25
|
+
* with it
|
|
23
26
|
*
|
|
24
27
|
* @param {string} spec
|
|
25
|
-
* @returns {{
|
|
28
|
+
* @returns {{ domain: string, subdomain?: string, fqdn?: string, chainId?: string } & ({ domain: string } | { fqdn: string })}
|
|
26
29
|
*/
|
|
27
30
|
export const parseNetworkSpec = spec => {
|
|
28
|
-
const [
|
|
29
|
-
|
|
31
|
+
const [domain, chainId] = spec.split(',');
|
|
32
|
+
if (domain.includes('.')) {
|
|
33
|
+
return { domain, fqdn: domain, chainId };
|
|
34
|
+
}
|
|
35
|
+
return { domain, subdomain: domain, chainId };
|
|
30
36
|
};
|
|
31
37
|
/**
|
|
32
38
|
* Fetches the network config for the given network specifier.
|
|
@@ -36,15 +42,16 @@ export const parseNetworkSpec = spec => {
|
|
|
36
42
|
* @returns {Promise<MinimalNetworkConfig>}
|
|
37
43
|
*/
|
|
38
44
|
export const fetchNetworkConfig = async (spec, { fetch }) => {
|
|
39
|
-
const { subdomain, chainId } = parseNetworkSpec(spec);
|
|
40
|
-
if (
|
|
45
|
+
const { domain, fqdn, subdomain, chainId } = parseNetworkSpec(spec);
|
|
46
|
+
if (domain === LOCAL_CONFIG_KEY) {
|
|
41
47
|
const config = { ...LOCAL_CONFIG };
|
|
42
48
|
if (chainId)
|
|
43
49
|
config.chainName = chainId;
|
|
44
50
|
return config;
|
|
45
51
|
}
|
|
46
52
|
if (chainId) {
|
|
47
|
-
|
|
53
|
+
const rpcAddr = subdomain ? toRpcUrl(subdomain) : `https://${fqdn}:443`;
|
|
54
|
+
return { chainName: chainId, rpcAddrs: [rpcAddr] };
|
|
48
55
|
}
|
|
49
56
|
return fetch(toNetworkConfigUrl(subdomain))
|
|
50
57
|
.then(res => res.json())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-config.js","sourceRoot":"","sources":["../src/network-config.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,EAAE,CACrD,WAAW,kBAAkB,4BAA4B,CAAC;AAE5D,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,EAAE,CAC3C,WAAW,kBAAkB,qBAAqB,CAAC;AAErD,wCAAwC;AACxC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,CAAC,sBAAsB,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"network-config.js","sourceRoot":"","sources":["../src/network-config.js"],"names":[],"mappings":"AAAA;;;;GAIG;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AAO,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC;QACxE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACrD,CAAC;IAED,OAAO,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;SACxC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACvB,KAAK,CAAC,GAAG,CAAC,EAAE;QACX,MAAM,KAAK,CAAC,8BAA8B,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/client-utils",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-47c99cc.0.47c99cc",
|
|
4
4
|
"description": "Utilities for building Agoric clients",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"ts-blank-space": "^0.6.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@agoric/casting": "0.4.3-dev-
|
|
36
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
37
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
38
|
-
"@agoric/internal": "0.3.3-dev-
|
|
39
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
40
|
-
"@agoric/vats": "0.15.2-dev-
|
|
35
|
+
"@agoric/casting": "0.4.3-dev-47c99cc.0.47c99cc",
|
|
36
|
+
"@agoric/cosmic-proto": "0.4.1-dev-47c99cc.0.47c99cc",
|
|
37
|
+
"@agoric/ertp": "0.16.3-dev-47c99cc.0.47c99cc",
|
|
38
|
+
"@agoric/internal": "0.3.3-dev-47c99cc.0.47c99cc",
|
|
39
|
+
"@agoric/smart-wallet": "0.5.4-dev-47c99cc.0.47c99cc",
|
|
40
|
+
"@agoric/vats": "0.15.2-dev-47c99cc.0.47c99cc",
|
|
41
41
|
"@cosmjs/crypto": "^0.36.0",
|
|
42
42
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
43
43
|
"@cosmjs/stargate": "^0.36.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": "^20.9 || ^22.11"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "47c99cc2a61e496584d3509bb780fa345b177f77"
|
|
77
77
|
}
|