Skip to content

Commit 652f6b9

Browse files
Update/df 21571 solv trading por address list (#3928)
* DF-21571 update por-address-list to replace solv ENA with TRADING and update URL * add changeset * review fixes, adding tests & adding ENA URL back * update changeset * update readme
1 parent 1e111e7 commit 652f6b9

File tree

8 files changed

+310
-21
lines changed

8 files changed

+310
-21
lines changed

.changeset/blue-trains-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/por-address-list-adapter': minor
3+
---
4+
5+
Add solv TRADING type

packages/sources/por-address-list/README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@ This document was generated automatically. Please see [README Generator](../../s
66

77
## Environment Variables
88

9-
| Required? | Name | Description | Type | Options | Default |
10-
| :-------: | :-------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------: | :----: | :-----: | :----------------------------------------------------------------------: |
11-
|| RPC_URL | The RPC URL to connect to the EVM chain the address manager contract is deployed to. | string | | |
12-
| | CHAIN_ID | The chain id to connect to for the RPC URL | number | | `1` |
13-
| | GROUP_SIZE | The number of concurrent batched contract calls to make at a time. Setting this lower than the default may result in lower performance from the adapter. | number | | `100` |
14-
| | BACKGROUND_EXECUTE_MS | The amount of time the background execute should sleep before performing the next request | number | | `10000` |
15-
| | COINBASE_CBBTC_API_ENDPOINT | An API endpoint for Coinbase cbBTC native BTC wallet address | string | | `https://coinbase.com/cbbtc/proof-of-reserves.json` |
16-
| | BEDROCK_UNIBTC_API_ENDPOINT | An API endpoint for Bedrock uniBTC native BTC wallet address | string | | `https://bedrock-datacenter.rockx.com/data/tvl/reserve_with_native.json` |
17-
| | SOLVBTC_API_ENDPOINT | An API endpoint for SolvBTC native BTC wallet address | string | | `https://por.sft-api.com/solv-btc-addresses.json` |
18-
| | SOLVBTC_BBN_API_ENDPOINT | An API endpoint for SolvBTC.BBN native BTC wallet address | string | | `https://por.sft-api.com/x-solv-btc-addresses.json` |
19-
| | SOLVBTC_ENA_API_ENDPOINT | An API endpoint for SolvBTC.ENA native BTC wallet address | string | | `https://por.sft-api.com/solv-btc-ena-addresses.json` |
20-
| | SOLVBTC_CORE_API_ENDPOINT | An API endpoint for SolvBTC.CORE native BTC wallet address | string | | `https://por.sft-api.com/solv-btc-core-addresses.json` |
21-
| | SOLVBTC_JUP_API_ENDPOINT | An API endpoint for SolvBTC.JUP MirrorX AccountIDs on CEFFU | string | | `https://por.sft-api.com/solv-btc-jup-mirrorx.json` |
22-
| | ZEUS_ZBTC_API_URL | An API endpoint for Zeus native BTC wallet address | string | | `https://indexer.zeuslayer.io/api/v2/chainlink/proof-of-reserves` |
9+
| Required? | Name | Description | Type | Options | Default |
10+
| :-------: | :--------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------: | :----: | :-----: | :----------------------------------------------------------------------: |
11+
|| RPC_URL | The RPC URL to connect to the EVM chain the address manager contract is deployed to. | string | | |
12+
| | CHAIN_ID | The chain id to connect to for the RPC URL | number | | `1` |
13+
| | GROUP_SIZE | The number of concurrent batched contract calls to make at a time. Setting this lower than the default may result in lower performance from the adapter. | number | | `100` |
14+
| | BACKGROUND_EXECUTE_MS | The amount of time the background execute should sleep before performing the next request | number | | `10000` |
15+
| | COINBASE_CBBTC_API_ENDPOINT | An API endpoint for Coinbase cbBTC native BTC wallet address | string | | `https://coinbase.com/cbbtc/proof-of-reserves.json` |
16+
| | BEDROCK_UNIBTC_API_ENDPOINT | An API endpoint for Bedrock uniBTC native BTC wallet address | string | | `https://bedrock-datacenter.rockx.com/data/tvl/reserve_with_native.json` |
17+
| | SOLVBTC_API_ENDPOINT | An API endpoint for SolvBTC native BTC wallet address | string | | `https://por.sft-api.com/solv-btc-addresses.json` |
18+
| | SOLVBTC_BBN_API_ENDPOINT | An API endpoint for SolvBTC.BBN native BTC wallet address | string | | `https://por.sft-api.com/x-solv-btc-addresses.json` |
19+
| | SOLVBTC_ENA_API_ENDPOINT | An API endpoint for SolvBTC.ENA native BTC wallet address. Deprecated | string | | `https://por.sft-api.com/solv-btc-ena-addresses.json` |
20+
| | SOLVBTC_TRADING_API_ENDPOINT | An API endpoint for SolvBTC.TRADING native BTC wallet address | string | | `https://por.sft-api.com/solv-btc-trading-addresses.json` |
21+
| | SOLVBTC_CORE_API_ENDPOINT | An API endpoint for SolvBTC.CORE native BTC wallet address | string | | `https://por.sft-api.com/solv-btc-core-addresses.json` |
22+
| | SOLVBTC_JUP_API_ENDPOINT | An API endpoint for SolvBTC.JUP MirrorX AccountIDs on CEFFU | string | | `https://por.sft-api.com/solv-btc-jup-mirrorx.json` |
23+
| | ZEUS_ZBTC_API_URL | An API endpoint for Zeus native BTC wallet address | string | | `https://indexer.zeuslayer.io/api/v2/chainlink/proof-of-reserves` |
2324

2425
---
2526

@@ -81,9 +82,9 @@ Request:
8182

8283
### Input Params
8384

84-
| Required? | Name | Aliases | Description | Type | Options | Default | Depends On | Not Valid With |
85-
| :-------: | :--: | :-----: | :-----------------------------------------------------: | :----: | :--------------------------------: | :-----: | :--------: | :------------: |
86-
| | type | | The type of bitcoin which we are fetching addresses for | string | `BBN`, `BTC`, `CORE`, `ENA`, `JUP` | `BTC` | | |
85+
| Required? | Name | Aliases | Description | Type | Options | Default | Depends On | Not Valid With |
86+
| :-------: | :--: | :-----: | :-----------------------------------------------------: | :----: | :-------------------------------------------: | :-----: | :--------: | :------------: |
87+
| | type | | The type of bitcoin which we are fetching addresses for | string | `BBN`, `BTC`, `CORE`, `ENA`, `JUP`, `TRADING` | `BTC` | | |
8788

8889
### Example
8990

packages/sources/por-address-list/src/config/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ export const config = new AdapterConfig({
4545
default: 'https://por.sft-api.com/x-solv-btc-addresses.json',
4646
},
4747
SOLVBTC_ENA_API_ENDPOINT: {
48-
description: 'An API endpoint for SolvBTC.ENA native BTC wallet address',
48+
description: 'An API endpoint for SolvBTC.ENA native BTC wallet address. Deprecated',
4949
type: 'string',
5050
default: 'https://por.sft-api.com/solv-btc-ena-addresses.json',
5151
},
52+
SOLVBTC_TRADING_API_ENDPOINT: {
53+
description: 'An API endpoint for SolvBTC.TRADING native BTC wallet address',
54+
type: 'string',
55+
default: 'https://por.sft-api.com/solv-btc-trading-addresses.json',
56+
},
5257
SOLVBTC_CORE_API_ENDPOINT: {
5358
description: 'An API endpoint for SolvBTC.CORE native BTC wallet address',
5459
type: 'string',

packages/sources/por-address-list/src/endpoint/solvBTC.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const inputParameters = new InputParameters(
1010
{
1111
type: {
1212
description: 'The type of bitcoin which we are fetching addresses for',
13-
options: ['BTC', 'BBN', 'ENA', 'CORE', 'JUP'],
13+
options: ['BTC', 'BBN', 'ENA', 'CORE', 'JUP', 'TRADING'],
1414
type: 'string',
1515
default: 'BTC',
1616
},

packages/sources/por-address-list/src/transport/solvBTC.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { PoRAddress } from '@chainlink/external-adapter-framework/adapter/por'
12
import { HttpTransport } from '@chainlink/external-adapter-framework/transports'
23
import { BaseEndpointTypes } from '../endpoint/solvBTC'
3-
import { PoRAddress } from '@chainlink/external-adapter-framework/adapter/por'
44

55
interface ResponseSchema {
66
accountName: string
@@ -35,6 +35,8 @@ export const solvHttpTransport = new HttpTransport<HttpTransportTypes>({
3535
return config.SOLVBTC_BBN_API_ENDPOINT
3636
case 'ENA':
3737
return config.SOLVBTC_ENA_API_ENDPOINT
38+
case 'TRADING':
39+
return config.SOLVBTC_TRADING_API_ENDPOINT
3840
case 'CORE':
3941
return config.SOLVBTC_CORE_API_ENDPOINT
4042
case 'JUP':

packages/sources/por-address-list/test/integration/__snapshots__/adapter.test.ts.snap

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,136 @@ exports[`execute apiAddress endpoint coinbase BTC should return success 1`] = `
174174
}
175175
`;
176176

177+
exports[`execute apiAddress endpoint solv BBN should return success 1`] = `
178+
{
179+
"data": {
180+
"result": [
181+
{
182+
"address": "bbn_s_1",
183+
"chainId": "mainnet",
184+
"network": "bitcoin",
185+
},
186+
{
187+
"address": "bbn_s_2",
188+
"chainId": "mainnet",
189+
"network": "bitcoin",
190+
},
191+
],
192+
},
193+
"result": null,
194+
"statusCode": 200,
195+
"timestamps": {
196+
"providerDataReceivedUnixMs": 978347471111,
197+
"providerDataRequestedUnixMs": 978347471111,
198+
"providerIndicatedTimeUnixMs": 1609499471112,
199+
},
200+
}
201+
`;
202+
203+
exports[`execute apiAddress endpoint solv CORE should return success 1`] = `
204+
{
205+
"data": {
206+
"result": [
207+
{
208+
"address": "core_s_1",
209+
"chainId": "mainnet",
210+
"network": "bitcoin",
211+
},
212+
{
213+
"address": "core_s_2",
214+
"chainId": "mainnet",
215+
"network": "bitcoin",
216+
},
217+
],
218+
},
219+
"result": null,
220+
"statusCode": 200,
221+
"timestamps": {
222+
"providerDataReceivedUnixMs": 978347471111,
223+
"providerDataRequestedUnixMs": 978347471111,
224+
"providerIndicatedTimeUnixMs": 1609499471112,
225+
},
226+
}
227+
`;
228+
229+
exports[`execute apiAddress endpoint solv ENA should return success 1`] = `
230+
{
231+
"data": {
232+
"result": [
233+
{
234+
"address": "ena_s_1",
235+
"chainId": "mainnet",
236+
"network": "bitcoin",
237+
},
238+
{
239+
"address": "ena_s_2",
240+
"chainId": "mainnet",
241+
"network": "bitcoin",
242+
},
243+
],
244+
},
245+
"result": null,
246+
"statusCode": 200,
247+
"timestamps": {
248+
"providerDataReceivedUnixMs": 978347471111,
249+
"providerDataRequestedUnixMs": 978347471111,
250+
"providerIndicatedTimeUnixMs": 1609499471112,
251+
},
252+
}
253+
`;
254+
255+
exports[`execute apiAddress endpoint solv JUP should return success 1`] = `
256+
{
257+
"data": {
258+
"result": [
259+
{
260+
"address": "jup_s_1",
261+
"chainId": "solv",
262+
"network": "ceffu",
263+
},
264+
{
265+
"address": "jup_s_2",
266+
"chainId": "solv",
267+
"network": "ceffu",
268+
},
269+
],
270+
},
271+
"result": null,
272+
"statusCode": 200,
273+
"timestamps": {
274+
"providerDataReceivedUnixMs": 978347471111,
275+
"providerDataRequestedUnixMs": 978347471111,
276+
"providerIndicatedTimeUnixMs": 1609499471112,
277+
},
278+
}
279+
`;
280+
281+
exports[`execute apiAddress endpoint solv TRADING should return success 1`] = `
282+
{
283+
"data": {
284+
"result": [
285+
{
286+
"address": "trading_s_1",
287+
"chainId": "mainnet",
288+
"network": "bitcoin",
289+
},
290+
{
291+
"address": "trading_s_2",
292+
"chainId": "mainnet",
293+
"network": "bitcoin",
294+
},
295+
],
296+
},
297+
"result": null,
298+
"statusCode": 200,
299+
"timestamps": {
300+
"providerDataReceivedUnixMs": 978347471111,
301+
"providerDataRequestedUnixMs": 978347471111,
302+
"providerIndicatedTimeUnixMs": 1609499471112,
303+
},
304+
}
305+
`;
306+
177307
exports[`execute apiAddress endpoint solv should return success 1`] = `
178308
{
179309
"data": {

packages/sources/por-address-list/test/integration/adapter.test.ts

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import {
22
TestAdapter,
33
setEnvVariables,
44
} from '@chainlink/external-adapter-framework/util/testing-utils'
5-
import * as nock from 'nock'
65
import { ethers } from 'ethers'
6+
import * as nock from 'nock'
77
import {
88
mockBedRockResponseSuccess,
99
mockCoinbaseResponseSuccess,
10+
mockSolvJupResponseSuccess,
1011
mockSolvResponseSuccess,
12+
mockSolvTypeResponseSuccess,
1113
mockZeusResponseSuccess,
1214
} from './fixtures-api'
1315

@@ -64,6 +66,11 @@ describe('execute', () => {
6466
process.env.BEDROCK_UNIBTC_API_ENDPOINT = 'http://bedrock'
6567
process.env.COINBASE_CBBTC_API_ENDPOINT = 'http://coinbase'
6668
process.env.SOLVBTC_API_ENDPOINT = 'http://solv'
69+
process.env.SOLVBTC_BBN_API_ENDPOINT = 'http://solv-bbn'
70+
process.env.SOLVBTC_ENA_API_ENDPOINT = 'http://solv-ena'
71+
process.env.SOLVBTC_TRADING_API_ENDPOINT = 'http://solv-trading'
72+
process.env.SOLVBTC_CORE_API_ENDPOINT = 'http://solv-core'
73+
process.env.SOLVBTC_JUP_API_ENDPOINT = 'http://solv-jup'
6774
process.env.BACKGROUND_EXECUTE_MS = '0'
6875
process.env.RATE_LIMIT_CAPACITY_SECOND = '500'
6976
const mockDate = new Date('2001-01-01T11:11:11.111Z')
@@ -140,6 +147,65 @@ describe('execute', () => {
140147
expect(response.json()).toMatchSnapshot()
141148
})
142149

150+
it('solv BBN should return success', async () => {
151+
const type = 'BBN'
152+
const data = {
153+
endpoint: 'solvBtcAddress',
154+
type,
155+
}
156+
mockSolvTypeResponseSuccess(type)
157+
const response = await testAdapter.request(data)
158+
expect(response.statusCode).toBe(200)
159+
expect(response.json()).toMatchSnapshot()
160+
})
161+
162+
it('solv ENA should return success', async () => {
163+
const type = 'ENA'
164+
const data = {
165+
endpoint: 'solvBtcAddress',
166+
type,
167+
}
168+
mockSolvTypeResponseSuccess(type)
169+
const response = await testAdapter.request(data)
170+
expect(response.statusCode).toBe(200)
171+
expect(response.json()).toMatchSnapshot()
172+
})
173+
174+
it('solv TRADING should return success', async () => {
175+
const type = 'TRADING'
176+
const data = {
177+
endpoint: 'solvBtcAddress',
178+
type,
179+
}
180+
mockSolvTypeResponseSuccess(type)
181+
const response = await testAdapter.request(data)
182+
expect(response.statusCode).toBe(200)
183+
expect(response.json()).toMatchSnapshot()
184+
})
185+
186+
it('solv CORE should return success', async () => {
187+
const type = 'CORE'
188+
const data = {
189+
endpoint: 'solvBtcAddress',
190+
type,
191+
}
192+
mockSolvTypeResponseSuccess(type)
193+
const response = await testAdapter.request(data)
194+
expect(response.statusCode).toBe(200)
195+
expect(response.json()).toMatchSnapshot()
196+
})
197+
198+
it('solv JUP should return success', async () => {
199+
const data = {
200+
endpoint: 'solvBtcAddress',
201+
type: 'JUP',
202+
}
203+
mockSolvJupResponseSuccess()
204+
const response = await testAdapter.request(data)
205+
expect(response.statusCode).toBe(200)
206+
expect(response.json()).toMatchSnapshot()
207+
})
208+
143209
it('coinbase BTC should return success', async () => {
144210
const data = {
145211
endpoint: 'coinbaseBtcAddress',

0 commit comments

Comments
 (0)