Skip to content

Commit 07644a2

Browse files
Fix underscore in token allocation (#3537)
* Fix underscore in token allocation * Fix typo --------- Co-authored-by: mmcallister-cll <[email protected]>
1 parent d8023b9 commit 07644a2

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/token-allocation-adapter': minor
3+
---
4+
5+
Fix blocksize-capital as source

packages/non-deployable/token-allocation/src/endpoint/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export const inputParameters: InputParameters<TInputParameters> = {
136136
}
137137

138138
export const execute = async (input: AdapterRequest, config: Config): Promise<AdapterResponse> => {
139+
if (input.data) {
140+
input.data.source = (input.data.source as string)?.replace('-', '_') || ''
141+
}
142+
139143
const paramOptions = makeOptions(config)
140144
const validator = new Validator(input, inputParameters, paramOptions)
141145
if (validator.error) throw validator.error

packages/non-deployable/token-allocation/test/integration/__snapshots__/adapter.test.ts.snap

+90
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,36 @@ exports[`execute additional input parameter pass through should return the corre
6060
}
6161
`;
6262

63+
exports[`execute additional input parameter pass through should return the correct price for source blocksize-capital with additional input 1`] = `
64+
{
65+
"data": {
66+
"payload": {
67+
"DAI": {
68+
"quote": {
69+
"EUR": {
70+
"price": 130.27,
71+
},
72+
},
73+
},
74+
"WBTC": {
75+
"quote": {
76+
"EUR": {
77+
"price": 130.27,
78+
},
79+
},
80+
},
81+
},
82+
"result": 260.54,
83+
"sources": [],
84+
},
85+
"debug": undefined,
86+
"jobRunID": "1",
87+
"providerStatusCode": 200,
88+
"result": 260.54,
89+
"statusCode": 200,
90+
}
91+
`;
92+
6393
exports[`execute additional input parameter pass through should return the correct price for source coinapi with additional input 1`] = `
6494
{
6595
"data": {
@@ -360,6 +390,36 @@ exports[`execute marketcap method should return the correct price for source blo
360390
}
361391
`;
362392

393+
exports[`execute marketcap method should return the correct price for source blocksize-capital 1`] = `
394+
{
395+
"data": {
396+
"payload": {
397+
"DAI": {
398+
"quote": {
399+
"EUR": {
400+
"marketCap": 130.27,
401+
},
402+
},
403+
},
404+
"WBTC": {
405+
"quote": {
406+
"EUR": {
407+
"marketCap": 130.27,
408+
},
409+
},
410+
},
411+
},
412+
"result": 260.54,
413+
"sources": [],
414+
},
415+
"debug": undefined,
416+
"jobRunID": "1",
417+
"providerStatusCode": 200,
418+
"result": 260.54,
419+
"statusCode": 200,
420+
}
421+
`;
422+
363423
exports[`execute marketcap method should return the correct price for source coinapi 1`] = `
364424
{
365425
"data": {
@@ -690,6 +750,36 @@ exports[`execute price method should return the correct price for source blocksi
690750
}
691751
`;
692752

753+
exports[`execute price method should return the correct price for source blocksize-capital 1`] = `
754+
{
755+
"data": {
756+
"payload": {
757+
"DAI": {
758+
"quote": {
759+
"EUR": {
760+
"price": 130.27,
761+
},
762+
},
763+
},
764+
"WBTC": {
765+
"quote": {
766+
"EUR": {
767+
"price": 130.27,
768+
},
769+
},
770+
},
771+
},
772+
"result": 260.54,
773+
"sources": [],
774+
},
775+
"debug": undefined,
776+
"jobRunID": "1",
777+
"providerStatusCode": 200,
778+
"result": 260.54,
779+
"statusCode": 200,
780+
}
781+
`;
782+
693783
exports[`execute price method should return the correct price for source coinapi 1`] = `
694784
{
695785
"data": {

packages/non-deployable/token-allocation/test/integration/fixtures.ts

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ export const dataProviderConfig: TokenAllocationTest = {
5151
providerUrlEnvVar: 'TIINGO_ADAPTER_URL',
5252
additional: {},
5353
},
54+
'blocksize-capital': {
55+
providerUrl: 'http://localhost:3010',
56+
providerUrlEnvVar: 'BLOCKSIZE_CAPITAL_ADAPTER_URL',
57+
additional: {},
58+
},
5459
blocksize_capital: {
5560
providerUrl: 'http://localhost:3010',
5661
providerUrlEnvVar: 'BLOCKSIZE_CAPITAL_ADAPTER_URL',

0 commit comments

Comments
 (0)