@chainlink/external-adapter-framework 0.32.0 → 0.33.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/README.md +1 -1
- package/adapter/index.d.ts +1 -0
- package/adapter/index.js +1 -0
- package/adapter/index.js.map +1 -1
- package/adapter/lwba.d.ts +47 -0
- package/adapter/lwba.js +41 -0
- package/adapter/lwba.js.map +1 -0
- package/adapter/por.js +8 -1
- package/adapter/por.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# EA Framework v3
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@chainlink/external-adapter-framework)
|
|
4
|
-

|
|
5
5
|
|
|
6
6
|
> **Warning**
|
|
7
7
|
> This framework is in a Beta state, and under active development. While many of the features from version 2 are present, they have not been tested extensively enough to mark this as production ready. You can find v2 in the [External Adapters Monorepo](https://github.com/smartcontractkit/external-adapters-js)
|
package/adapter/index.d.ts
CHANGED
package/adapter/index.js
CHANGED
package/adapter/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,0CAAuB;AACvB,6CAA0B;AAC1B,0CAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,0CAAuB;AACvB,6CAA0B;AAC1B,0CAAuB;AACvB,yCAAsB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TransportGenerics } from '../transports';
|
|
2
|
+
import { AdapterEndpoint } from './endpoint';
|
|
3
|
+
import { AdapterEndpointParams, PriceEndpointInputParametersDefinition } from './index';
|
|
4
|
+
/**
|
|
5
|
+
* Type for the base input parameter config that any [[LwbaEndpoint]] must extend
|
|
6
|
+
*/
|
|
7
|
+
export type LwbaEndpointInputParametersDefinition = PriceEndpointInputParametersDefinition;
|
|
8
|
+
/**
|
|
9
|
+
* Base input parameter config that any [[LwbaEndpoint]] must extend
|
|
10
|
+
*/
|
|
11
|
+
export declare const lwbaEndpointInputParametersDefinition: {
|
|
12
|
+
readonly base: {
|
|
13
|
+
readonly aliases: readonly ["from", "coin"];
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly description: "The symbol of symbols of the currency to query";
|
|
16
|
+
readonly required: true;
|
|
17
|
+
};
|
|
18
|
+
readonly quote: {
|
|
19
|
+
readonly aliases: readonly ["to", "market"];
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "The symbol of the currency to convert to";
|
|
22
|
+
readonly required: true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type LwbaResponseDataFields = {
|
|
26
|
+
Result: null;
|
|
27
|
+
Data: {
|
|
28
|
+
mid: number;
|
|
29
|
+
bid: number;
|
|
30
|
+
ask: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Helper type structure that contains the different types passed to the generic parameters of a PriceEndpoint
|
|
35
|
+
*/
|
|
36
|
+
export type LwbaEndpointGenerics = TransportGenerics & {
|
|
37
|
+
Parameters: LwbaEndpointInputParametersDefinition;
|
|
38
|
+
Response: LwbaResponseDataFields;
|
|
39
|
+
};
|
|
40
|
+
export declare const DEFAULT_LWBA_ALIASES: string[];
|
|
41
|
+
/**
|
|
42
|
+
* An LwbaEndpoint is a specific type of AdapterEndpoint. Meant to comply with standard practices for
|
|
43
|
+
* LWBA (lightweight bid/ask) Data Feeds, its InputParameters must extend the basic ones (base/quote).
|
|
44
|
+
*/
|
|
45
|
+
export declare class LwbaEndpoint<T extends LwbaEndpointGenerics> extends AdapterEndpoint<T> {
|
|
46
|
+
constructor(params: AdapterEndpointParams<T>);
|
|
47
|
+
}
|
package/adapter/lwba.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LwbaEndpoint = exports.DEFAULT_LWBA_ALIASES = exports.lwbaEndpointInputParametersDefinition = void 0;
|
|
4
|
+
const endpoint_1 = require("./endpoint");
|
|
5
|
+
/**
|
|
6
|
+
* Base input parameter config that any [[LwbaEndpoint]] must extend
|
|
7
|
+
*/
|
|
8
|
+
exports.lwbaEndpointInputParametersDefinition = {
|
|
9
|
+
base: {
|
|
10
|
+
aliases: ['from', 'coin'],
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The symbol of symbols of the currency to query',
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
quote: {
|
|
16
|
+
aliases: ['to', 'market'],
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'The symbol of the currency to convert to',
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
exports.DEFAULT_LWBA_ALIASES = ['crypto-lwba', 'crypto_lwba', 'cryptolwba'];
|
|
23
|
+
/**
|
|
24
|
+
* An LwbaEndpoint is a specific type of AdapterEndpoint. Meant to comply with standard practices for
|
|
25
|
+
* LWBA (lightweight bid/ask) Data Feeds, its InputParameters must extend the basic ones (base/quote).
|
|
26
|
+
*/
|
|
27
|
+
class LwbaEndpoint extends endpoint_1.AdapterEndpoint {
|
|
28
|
+
constructor(params) {
|
|
29
|
+
if (!params.aliases) {
|
|
30
|
+
params.aliases = [];
|
|
31
|
+
}
|
|
32
|
+
for (const alias of exports.DEFAULT_LWBA_ALIASES) {
|
|
33
|
+
if (params.name !== alias && !params.aliases.includes(alias)) {
|
|
34
|
+
params.aliases.push(alias);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
super(params);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.LwbaEndpoint = LwbaEndpoint;
|
|
41
|
+
//# sourceMappingURL=lwba.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lwba.js","sourceRoot":"","sources":["../../../src/adapter/lwba.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAQ5C;;GAEG;AACU,QAAA,qCAAqC,GAAG;IACnD,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACzB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,IAAI;KACf;IACD,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC;QACzB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0CAA0C;QACvD,QAAQ,EAAE,IAAI;KACf;CACuD,CAAA;AAmB7C,QAAA,oBAAoB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,YAAY,CAAC,CAAA;AAEhF;;;GAGG;AACH,MAAa,YAA6C,SAAQ,0BAAkB;IAClF,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAA;SACpB;QACD,KAAK,MAAM,KAAK,IAAI,4BAAoB,EAAE;YACxC,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBAC5D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;aAC3B;SACF;QAED,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;CACF;AAbD,oCAaC"}
|
package/adapter/por.js
CHANGED
|
@@ -53,7 +53,13 @@ class PoRAdapter extends basic_1.Adapter {
|
|
|
53
53
|
// PoR requests take longer to process than normal feeds, that's why by default we set
|
|
54
54
|
// BACKGROUND_EXECUTE_TIMEOUT to the highest value
|
|
55
55
|
if (!params.config) {
|
|
56
|
-
params.config = new config_1.AdapterConfig({}, {
|
|
56
|
+
params.config = new config_1.AdapterConfig({}, {
|
|
57
|
+
envDefaultOverrides: {
|
|
58
|
+
BACKGROUND_EXECUTE_TIMEOUT: 180000,
|
|
59
|
+
API_TIMEOUT: 60000,
|
|
60
|
+
CACHE_MAX_AGE: 360000,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
57
63
|
}
|
|
58
64
|
else {
|
|
59
65
|
params.config.options = {
|
|
@@ -62,6 +68,7 @@ class PoRAdapter extends basic_1.Adapter {
|
|
|
62
68
|
...(params.config.options?.envDefaultOverrides || {}),
|
|
63
69
|
BACKGROUND_EXECUTE_TIMEOUT: params.config.options?.envDefaultOverrides?.BACKGROUND_EXECUTE_TIMEOUT ?? 180000,
|
|
64
70
|
API_TIMEOUT: params.config.options?.envDefaultOverrides?.API_TIMEOUT ?? 60000,
|
|
71
|
+
CACHE_MAX_AGE: params.config.options?.envDefaultOverrides?.CACHE_MAX_AGE ?? 360000,
|
|
65
72
|
},
|
|
66
73
|
};
|
|
67
74
|
}
|
package/adapter/por.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"por.js","sourceRoot":"","sources":["../../../src/adapter/por.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAC5C,sCAAgE;AAChE,mCAAiC;AAIjC,wCAAoC;AAsBpC;;;GAGG;AACH,MAAa,kBAAyD,SAAQ,0BAAkB;CAAG;AAAnG,gDAAmG;AAgCnG;;GAEG;AACU,QAAA,2CAA2C,GAAG;IACzD,SAAS,EAAE;QACT,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;gBAC/C,QAAQ,EAAE,IAAI;aACf;SACF;QACD,WAAW,EACT,mGAAmG;QACrG,QAAQ,EAAE,IAAI;KACf;CAC6D,CAAA;AAUhE;;;GAGG;AACH,MAAa,kBAAyD,SAAQ,0BAAkB;CAAG;AAAnG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