@superfluid-finance/sdk-core 0.4.4-dev.5584c73.0 → 0.4.4-dev.6051b03.0
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/CHANGELOG.md +10 -2
- package/README.md +1 -1
- package/dist/index.umd.js +44 -117
- package/dist/main/Framework.d.ts +1 -7
- package/dist/main/Framework.d.ts.map +1 -1
- package/dist/main/Framework.js +2 -9
- package/dist/main/Framework.js.map +1 -1
- package/dist/main/Query.d.ts +0 -2
- package/dist/main/Query.d.ts.map +1 -1
- package/dist/main/Query.js +0 -37
- package/dist/main/Query.js.map +1 -1
- package/dist/main/SFError.d.ts +1 -1
- package/dist/main/SFError.d.ts.map +1 -1
- package/dist/main/SFError.js +0 -1
- package/dist/main/SFError.js.map +1 -1
- package/dist/main/constants.d.ts +2 -1
- package/dist/main/constants.d.ts.map +1 -1
- package/dist/main/constants.js +29 -30
- package/dist/main/constants.js.map +1 -1
- package/dist/main/frameworkHelpers.d.ts +1 -2
- package/dist/main/frameworkHelpers.d.ts.map +1 -1
- package/dist/main/frameworkHelpers.js +12 -39
- package/dist/main/frameworkHelpers.js.map +1 -1
- package/dist/main/subgraph/schema.generated.d.ts +640 -42
- package/dist/main/subgraph/schema.generated.d.ts.map +1 -1
- package/dist/main/types.d.ts +0 -1
- package/dist/main/types.d.ts.map +1 -1
- package/dist/module/Framework.d.ts +1 -7
- package/dist/module/Framework.d.ts.map +1 -1
- package/dist/module/Framework.js +2 -9
- package/dist/module/Framework.js.map +1 -1
- package/dist/module/Query.d.ts +0 -2
- package/dist/module/Query.d.ts.map +1 -1
- package/dist/module/Query.js +0 -37
- package/dist/module/Query.js.map +1 -1
- package/dist/module/SFError.d.ts +1 -1
- package/dist/module/SFError.d.ts.map +1 -1
- package/dist/module/SFError.js +0 -1
- package/dist/module/SFError.js.map +1 -1
- package/dist/module/constants.d.ts +2 -1
- package/dist/module/constants.d.ts.map +1 -1
- package/dist/module/constants.js +28 -29
- package/dist/module/constants.js.map +1 -1
- package/dist/module/frameworkHelpers.d.ts +1 -2
- package/dist/module/frameworkHelpers.d.ts.map +1 -1
- package/dist/module/frameworkHelpers.js +13 -40
- package/dist/module/frameworkHelpers.js.map +1 -1
- package/dist/module/subgraph/schema.generated.d.ts +640 -42
- package/dist/module/subgraph/schema.generated.d.ts.map +1 -1
- package/dist/module/types.d.ts +0 -1
- package/dist/module/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { SFError } from "./SFError";
|
|
2
|
-
import { chainIds, chainIdToResolverDataMap
|
|
2
|
+
import { chainIds, chainIdToResolverDataMap } from "./constants";
|
|
3
3
|
import { isNullOrEmpty } from "./utils";
|
|
4
4
|
export const validateFrameworkConstructorOptions = (options) => {
|
|
5
|
-
if (!options.chainId
|
|
5
|
+
if (!options.chainId) {
|
|
6
6
|
throw new SFError({
|
|
7
7
|
type: "FRAMEWORK_INITIALIZATION",
|
|
8
|
-
customMessage: "You must input chainId
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
// if the user inputs a custom network (local, they have to specify this)
|
|
12
|
-
if (options.networkName &&
|
|
13
|
-
networkNames.includes(options.networkName) &&
|
|
14
|
-
options.chainId &&
|
|
15
|
-
chainIds.includes(options.chainId) &&
|
|
16
|
-
networkNameToChainIdMap.get(options.networkName) !== options.chainId) {
|
|
17
|
-
throw new SFError({
|
|
18
|
-
type: "FRAMEWORK_INITIALIZATION",
|
|
19
|
-
customMessage: "The network name and chainId you have selected don't match.",
|
|
8
|
+
customMessage: "You must input chainId.",
|
|
20
9
|
});
|
|
21
10
|
}
|
|
22
11
|
if (!options.provider) {
|
|
@@ -25,18 +14,9 @@ export const validateFrameworkConstructorOptions = (options) => {
|
|
|
25
14
|
customMessage: "You must pass in a provider, an injected web3.js or ethers.js instance when initializing the framework.",
|
|
26
15
|
});
|
|
27
16
|
}
|
|
28
|
-
// if the user inputs a
|
|
17
|
+
// if the user inputs a chainId that isn't part of the resolver
|
|
29
18
|
// that is, an unsupported network/chain
|
|
30
|
-
if (
|
|
31
|
-
!networkNames.includes(options.networkName)) ||
|
|
32
|
-
(options.chainId != null && !chainIds.includes(options.chainId))) {
|
|
33
|
-
if (options.dataMode !== "WEB3_ONLY" &&
|
|
34
|
-
isNullOrEmpty(options.customSubgraphQueriesEndpoint)) {
|
|
35
|
-
throw new SFError({
|
|
36
|
-
type: "FRAMEWORK_INITIALIZATION",
|
|
37
|
-
customMessage: "You must input your own custom subgraph query endpoint if you use an unsupported network with dataMode set to SUBGRAPH_ONLY or SUBGRAPH_WEB3.",
|
|
38
|
-
});
|
|
39
|
-
}
|
|
19
|
+
if (options.chainId != null && !chainIds.includes(options.chainId)) {
|
|
40
20
|
if (isNullOrEmpty(options.resolverAddress)) {
|
|
41
21
|
throw new SFError({
|
|
42
22
|
type: "FRAMEWORK_INITIALIZATION",
|
|
@@ -46,23 +26,18 @@ export const validateFrameworkConstructorOptions = (options) => {
|
|
|
46
26
|
}
|
|
47
27
|
};
|
|
48
28
|
/**
|
|
49
|
-
*
|
|
29
|
+
* Subgraph Query endpoint is empty string and will break at runtime if this is not handled.
|
|
50
30
|
* @param options
|
|
51
31
|
* @returns SubgraphQueriesEndpoint which is a custom endpoint or based on selected network
|
|
52
32
|
*/
|
|
53
33
|
export const getSubgraphQueriesEndpoint = (options) => {
|
|
54
|
-
const
|
|
55
|
-
?
|
|
56
|
-
:
|
|
57
|
-
const resolverData = chainId ? chainIdToResolverDataMap.get(chainId) : null;
|
|
34
|
+
const resolverData = options.chainId
|
|
35
|
+
? chainIdToResolverDataMap.get(options.chainId)
|
|
36
|
+
: null;
|
|
58
37
|
if (resolverData) {
|
|
59
38
|
return resolverData.subgraphAPIEndpoint;
|
|
60
39
|
}
|
|
61
|
-
|
|
62
|
-
throw new SFError({
|
|
63
|
-
type: "FRAMEWORK_INITIALIZATION",
|
|
64
|
-
customMessage: "Something went wrong, this should never occur.",
|
|
65
|
-
});
|
|
40
|
+
return ""; // return empty string
|
|
66
41
|
};
|
|
67
42
|
/**
|
|
68
43
|
* We check that the user has input a networkName or chainId and that they are both supported.
|
|
@@ -72,10 +47,8 @@ export const getSubgraphQueriesEndpoint = (options) => {
|
|
|
72
47
|
*/
|
|
73
48
|
export const getNetworkName = (options) => {
|
|
74
49
|
var _a;
|
|
75
|
-
return (options.
|
|
76
|
-
(options.chainId
|
|
77
|
-
|
|
78
|
-
: undefined) ||
|
|
79
|
-
"custom");
|
|
50
|
+
return ((options.chainId
|
|
51
|
+
? (_a = chainIdToResolverDataMap.get(options.chainId)) === null || _a === void 0 ? void 0 : _a.networkName
|
|
52
|
+
: undefined) || "custom");
|
|
80
53
|
};
|
|
81
54
|
//# sourceMappingURL=frameworkHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameworkHelpers.js","sourceRoot":"","sources":["../../src/frameworkHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"frameworkHelpers.js","sourceRoot":"","sources":["../../src/frameworkHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAC/C,OAA0B,EAC5B,EAAE;IACA,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QAClB,MAAM,IAAI,OAAO,CAAC;YACd,IAAI,EAAE,0BAA0B;YAChC,aAAa,EAAE,yBAAyB;SAC3C,CAAC,CAAC;KACN;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACnB,MAAM,IAAI,OAAO,CAAC;YACd,IAAI,EAAE,0BAA0B;YAChC,aAAa,EACT,yGAAyG;SAChH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