@railgun-community/shared-models 5.1.4 → 5.1.8
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/utils/fallback-provider.d.ts +1 -0
- package/dist/utils/fallback-provider.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/util.d.ts +3 -0
- package/dist/utils/util.js +18 -0
- package/dist/utils/util.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-provider.js","sourceRoot":"","sources":["../../src/utils/fallback-provider.ts"],"names":[],"mappings":";;;AAAA,mCAAyE;AACzE,2EAAqE;
|
|
1
|
+
{"version":3,"file":"fallback-provider.js","sourceRoot":"","sources":["../../src/utils/fallback-provider.ts"],"names":[],"mappings":";;;AAAA,mCAAyE;AACzE,2EAAqE;AAc9D,MAAM,oCAAoC,GAAG,CAClD,MAAkC,EAChB,EAAE;IACpB,MAAM,OAAO,GAAe,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnD,IAAI;QACF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACpD,MAAM,QAAQ,GAAG,WAAW;gBAC1B,CAAC,CAAC,IAAI,0BAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;gBAC/C,CAAC,CAAC,IAAI,kDAAsB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvD,OAAO;gBACL,GAAG,IAAI;gBACP,QAAQ;aACT,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,yBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;KACjD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,EAAE;YAC3B,MAAM,GAAG,CAAC;SACX;QACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;KACrE;AACH,CAAC,CAAC;AAtBW,QAAA,oCAAoC,wCAsB/C","sourcesContent":["import { FallbackProvider, Networkish, WebSocketProvider } from 'ethers';\nimport { PollingJsonRpcProvider } from './polling-json-rpc-provider';\n\nexport type FallbackProviderJsonConfig = {\n chainId: number;\n providers: ProviderJson[];\n};\n\nexport type ProviderJson = {\n priority: number;\n weight: number;\n provider: string;\n stallTimeout?: number;\n};\n\nexport const createFallbackProviderFromJsonConfig = (\n config: FallbackProviderJsonConfig,\n): FallbackProvider => {\n const network: Networkish = Number(config.chainId);\n try {\n const providers = config.providers.map(json => {\n const isWebsocket = json.provider.startsWith('wss');\n const provider = isWebsocket\n ? new WebSocketProvider(json.provider, network)\n : new PollingJsonRpcProvider(json.provider, network);\n return {\n ...json,\n provider,\n };\n });\n return new FallbackProvider(providers, network);\n } catch (err) {\n if (!(err instanceof Error)) {\n throw err;\n }\n throw new Error(`Invalid fallback provider config: ${err.message}`);\n }\n};\n"]}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -23,5 +23,6 @@ __exportStar(require("./format"), exports);
|
|
|
23
23
|
__exportStar(require("./gas"), exports);
|
|
24
24
|
__exportStar(require("./network"), exports);
|
|
25
25
|
__exportStar(require("./promises"), exports);
|
|
26
|
+
__exportStar(require("./util"), exports);
|
|
26
27
|
__exportStar(require("./versions"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,4CAA0B;AAC1B,sDAAoC;AACpC,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B","sourcesContent":["export * from './artifact-v2';\nexport * from './available-rpc';\nexport * from './compare';\nexport * from './fallback-provider';\nexport * from './error';\nexport * from './format';\nexport * from './gas';\nexport * from './network';\nexport * from './promises';\nexport * from './versions';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,4CAA0B;AAC1B,sDAAoC;AACpC,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,yCAAuB;AACvB,6CAA2B","sourcesContent":["export * from './artifact-v2';\nexport * from './available-rpc';\nexport * from './compare';\nexport * from './fallback-provider';\nexport * from './error';\nexport * from './format';\nexport * from './gas';\nexport * from './network';\nexport * from './promises';\nexport * from './util';\nexport * from './versions';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeUndefineds = exports.isDefined = void 0;
|
|
4
|
+
const isDefined = (a) => {
|
|
5
|
+
return typeof a !== 'undefined' && a !== null;
|
|
6
|
+
};
|
|
7
|
+
exports.isDefined = isDefined;
|
|
8
|
+
const removeUndefineds = (a) => {
|
|
9
|
+
const newArray = [];
|
|
10
|
+
for (const item of a) {
|
|
11
|
+
if ((0, exports.isDefined)(item)) {
|
|
12
|
+
newArray.push(item);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return newArray;
|
|
16
|
+
};
|
|
17
|
+
exports.removeUndefineds = removeUndefineds;
|
|
18
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/utils/util.ts"],"names":[],"mappings":";;;AAAO,MAAM,SAAS,GAAG,CAAI,CAAuB,EAAU,EAAE;IAC9D,OAAO,OAAO,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,IAAI,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,gBAAgB,GAAG,CAAI,CAAgB,EAAO,EAAE;IAC3D,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,CAAC,EAAE;QACpB,IAAI,IAAA,iBAAS,EAAC,IAAI,CAAC,EAAE;YACnB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B","sourcesContent":["export const isDefined = <T>(a: T | undefined | null): a is T => {\n return typeof a !== 'undefined' && a !== null;\n};\n\nexport const removeUndefineds = <T>(a: Optional<T>[]): T[] => {\n const newArray: T[] = [];\n for (const item of a) {\n if (isDefined(item)) {\n newArray.push(item);\n }\n }\n return newArray;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@railgun-community/shared-models",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"test": "npm run compile-test && mocha 'src/**/__tests__/*.test.ts'"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"ethers": "^6.
|
|
25
|
+
"ethers": "^6.5.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"ethers": "^6.
|
|
28
|
+
"ethers": "^6.5.1",
|
|
29
29
|
"@types/chai": "^4.3.4",
|
|
30
30
|
"@types/chai-as-promised": "^7.1.5",
|
|
31
31
|
"@types/mocha": "^10.0.1",
|