Skip to content

Commit 914e3c9

Browse files
Merge pull request #1430 from multiversx/development
merge development to main
2 parents dbec8bd + c38c4fa commit 914e3c9

43 files changed

Lines changed: 1065 additions & 322 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/load-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Load Tests
22

33
on:
4-
push:
5-
branches: [main, development]
64
pull_request:
75
branches: [main, development]
86

config/config.placeholder.yaml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
network: 'DAPP_CONFIG'
2+
metaChainShardId: 4294967295
3+
api:
4+
public: true
5+
publicPort: 3001
6+
private: true
7+
privatePort: 4001
8+
websocket: true
9+
cron:
10+
cacheWarmer: true
11+
fastWarm: true
12+
queueWorker: true
13+
elasticUpdater: false
14+
flags:
15+
useRequestCaching: true
16+
useKeepAliveAgent: true
17+
useTracing: false
18+
useRequestLogging: false
19+
useVmQueryTracing: false
20+
processNfts: true
21+
collectionPropertiesFromGateway: false
22+
features:
23+
eventsNotifier:
24+
enabled: false
25+
port: 5674
26+
url: 'amqp://guest:guest@127.0.0.1:5673'
27+
exchange: 'all_events'
28+
queue: 'api-process-logs-and-events'
29+
guestCaching:
30+
enabled: false
31+
hitsThreshold: 100
32+
ttl: 12
33+
transactionPool:
34+
enabled: false
35+
transactionPoolWarmer:
36+
enabled: false
37+
cronExpression: '*/5 * * * * *'
38+
ttlInSeconds: 60
39+
updateCollectionExtraDetails:
40+
enabled: false
41+
updateAccountExtraDetails:
42+
enabled: false
43+
marketplace:
44+
enabled: false
45+
serviceUrl: 'MARKETPLACE_URL'
46+
exchange:
47+
enabled: false
48+
serviceUrl: 'EXCHANGE_URL'
49+
dataApi:
50+
enabled: false
51+
serviceUrl: 'DATAAPI_URL'
52+
assetsFetch:
53+
enabled: true
54+
assetesUrl: 'ASSETSFETCH_URL'
55+
auth:
56+
enabled: false
57+
maxExpirySeconds: 86400
58+
acceptedOrigins:
59+
- ''
60+
admins:
61+
- ''
62+
jwtSecret: ''
63+
stakingV4:
64+
enabled: false
65+
cronExpression: '*/5 * * * * *'
66+
activationEpoch: 1043
67+
nodeEpochsLeft:
68+
enabled: false
69+
transactionProcessor:
70+
enabled: false
71+
maxLookBehind: 100
72+
transactionCompleted:
73+
enabled: false
74+
maxLookBehind: 100
75+
logLevel: 'Error'
76+
transactionBatch:
77+
enabled: true
78+
maxLookBehind: 100
79+
statusChecker:
80+
enabled: false
81+
thresholds:
82+
tokens: 500
83+
nodes: 3000
84+
providers: 10
85+
tokenSupplyCount: 20
86+
tokenAssets: 20
87+
tokenAccounts: 500
88+
tokenTransactions: 500
89+
nodeValidators: 300
90+
nftScamInfo:
91+
enabled: false
92+
processNfts:
93+
enabled: false
94+
nftQueueName: 'api-process-nfts'
95+
deadLetterQueueName: 'api-process-nfts-dlq'
96+
tps:
97+
enabled: false
98+
maxLookBehindNonces: 100
99+
nodesFetch:
100+
enabled: true
101+
serviceUrl: 'NODESFETCH_URL'
102+
tokensFetch:
103+
enabled: true
104+
serviceUrl: 'TOKENSFETCH_URL'
105+
providersFetch:
106+
enabled: true
107+
serviceUrl: 'PROVIDERSFETCH_URL'
108+
image:
109+
width: 600
110+
height: 600
111+
type: 'png'
112+
aws:
113+
s3KeyId: ''
114+
s3Secret: ''
115+
s3Bucket: 'devnet-media.elrond.com'
116+
s3Region: ''
117+
urls:
118+
self: 'https://devnet-api.multiversx.com'
119+
elastic:
120+
- 'ELASTICSEARCH_URL'
121+
gateway:
122+
- 'GATEWAY_URL'
123+
verifier: 'https://play-api.multiversx.com'
124+
redis: 'REDIS_IP'
125+
rabbitmq: 'RABBITMQ_URL'
126+
providers: 'PROVIDERS_URL'
127+
delegation: 'DELEGATION_URL'
128+
media: 'https://devnet-media.elrond.com'
129+
nftThumbnails: 'https://devnet-media.elrond.com/nfts/thumbnail'
130+
tmp: '/tmp'
131+
ipfs: 'https://ipfs.io/ipfs'
132+
socket: 'SOCKET_URL'
133+
maiarId: 'https://devnet-id-api.multiversx.com'
134+
indexer:
135+
type: 'elastic'
136+
maxPagination: 10000
137+
database:
138+
enabled: false
139+
url: 'mongodb://127.0.0.1:27017/api?authSource=admin'
140+
type: 'mysql'
141+
host: 'localhost'
142+
port: 3306
143+
username: 'root'
144+
password: 'root'
145+
database: 'api'
146+
caching:
147+
cacheTtl: 6
148+
processTtl: 600
149+
poolLimit: 50
150+
cacheDuration: 3
151+
keepAliveTimeout:
152+
downstream: 61000
153+
upstream: 60000
154+
contracts:
155+
esdt: 'erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u'
156+
auction: 'erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqplllst77y4l'
157+
staking: 'erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqllls0lczs7'
158+
delegationManager: 'erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6'
159+
delegation: 'erd1qqqqqqqqqqqqqpgq97wezxw6l7lgg7k9rxvycrz66vn92ksh2tssxwf7ep'
160+
metabonding: 'erd1qqqqqqqqqqqqqpgqkg7we73j769ew5we4yyx7uyvnn0nefqgd8ssm6vjc2'
161+
inflation:
162+
- 1952123
163+
- 1746637
164+
- 1541150
165+
- 1335663
166+
- 1130177
167+
- 924690
168+
- 719203
169+
nftProcess:
170+
parallelism: 1
171+
maxRetries: 3
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"id": "PLACEHOLDER_DAPP_id",
3+
"name": "PLACEHOLDER_DAPP_name",
4+
"egldLabel": "PLACEHOLDER_DAPP_egldLabel",
5+
"decimals": "4",
6+
"egldDenomination": "18",
7+
"gasPerDataByte": "1500",
8+
"apiTimeout": "4000",
9+
"walletConnectDeepLink": "https://maiar.page.link/?apn=com.multiversx.maiar.wallet&isi=1519405832&ibi=com.multiversx.maiar.wallet&link=https://maiar.com/",
10+
"walletConnectBridgeAddresses": [
11+
"https://bridge.walletconnect.org"
12+
],
13+
"walletAddress": "PLACEHOLDER_DAPP_walletAddress",
14+
"apiAddress": "PLACEHOLDER_DAPP_apiAddress",
15+
"explorerAddress": "PLACEHOLDER_DAPP_explorerAddress",
16+
"chainId": "PLACEHOLDER_DAPP_chainId"
17+
}

entrypoint.sh

100644100755
Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,65 @@
11
#!/bin/sh
22
# ENV VARIABLES
3-
# MVX_ENV - defines what config to copy (default devnet)
4-
# ELASTICSEARCH_URL - defines custom elasticsearch url - eg https://devnet-index.multiversx.com
5-
# GATEWAY_URL - defines custom gateway url - eg https://devnet-gateway.multiversx.com
6-
# REDIS_IP - defines redis ip - default 127.0.0.1
7-
8-
# CHECK IF ENV IS DEFINED
9-
if [ -n "$MVX_ENV" ] && [ "$MVX_ENV" = "devnet" ]; then
10-
# Copy config file
11-
cp ./config/config.${MVX_ENV}.yaml /app/dist/config/config.yaml
12-
13-
if [ $? -eq 0 ]; then
14-
echo "Config file copied successfully from config/config.${MVX_ENV}.yaml /app/dist/config/config.yaml"
15-
else
16-
echo "Failed to copy the file."
17-
fi
18-
19-
else
20-
cp ./config/config.devnet.yaml /app/dist/config/config.yaml
21-
22-
if [ $? -eq 0 ]; then
23-
echo "Default config file copied successfully from config/config.devnet.yaml /app/dist/config/config.yaml"
24-
else
25-
echo "Failed to copy the file."
26-
fi
27-
fi
28-
29-
# Replaces urls if defined
30-
if [ -n "$REDIS_IP" ]; then
31-
echo "Redis IP defined: ${REDIS_IP}, replacing in config"
32-
sed -i "s|redis: '127.0.0.1'|redis: '${REDIS_IP}'|g" /app/dist/config/config.yaml
33-
fi
34-
35-
if [ -n "$ELASTICSEARCH_URL" ]; then
36-
echo "Elasticsearch url defined: ${ELASTICSEARCH_URL}, replacing in config"
37-
sed -i "/^ elastic:/!b; n; s|.*| - '${ELASTICSEARCH_URL}'|" /app/dist/config/config.yaml
38-
fi
39-
40-
if [ -n "$GATEWAY_URL" ]; then
41-
echo "Gateway url defined: ${GATEWAY_URL}, replacing in config"
42-
sed -i "/^ gateway:/!b; n; s|.*| - '${GATEWAY_URL}'|" /app/dist/config/config.yaml
43-
fi
3+
# MVX_ENV=devnet
4+
# DAPP_CONFIG=devnet
5+
# REDIS_IP=127.0.0.1
6+
# ELASTICSEARCH_URL=https://devnet-index.multiversx.com
7+
# GATEWAY_URL=https://devnet-gateway.multiversx.com
8+
# RABBITMQ_URL=amqp://127.0.0.1:5672
9+
# PROVIDERS_URL=https://devnet-delegation-api.multiversx.com/providers
10+
# DELEGATION_URL=https://devnet-delegation-api.multiversx.com
11+
# SOCKET_URL=devnet-socket-api.multiversx.com
12+
# NODESFETCH_URL= https://devnet-api.multiversx.com
13+
# TOKENSFETCH_URL= https://devnet-api.multiversx.com
14+
# PROVIDERSFETCH_URL= https://devnet-api.multiversx.com
15+
# DATAAPI_URL=https://devnet-data-api.multiversx.com
16+
# EXCHANGE_URL=https://devnet-graph.xexchange.com/graphql
17+
# MARKETPLACE_URL=https://devnet-nfts-graph.multiversx.com/graphql
18+
# ASSETSFETCH_URL=https://tools.multiversx.com/assets-cdn
19+
# PLACEHOLDER_DAPP_id=devnet
20+
# PLACEHOLDER_DAPP_name=Devnet
21+
# PLACEHOLDER_DAPP_egldLabel=xEGLD
22+
# PLACEHOLDER_DAPP_walletAddress=https://devnet-wallet.multiversx.com
23+
# PLACEHOLDER_DAPP_apiAddress=https://devnet-api.multiversx.com
24+
# PLACEHOLDER_DAPP_explorerAddress=http://devnet-explorer.multiversx.com
25+
# PLACEHOLDER_DAPP_chainId=D
4426

27+
env_vars_with_defaults="MVX_ENV=devnet DAPP_CONFIG=devnet REDIS_IP=127.0.0.1 ELASTICSEARCH_URL=https://devnet-index.multiversx.com GATEWAY_URL=https://devnet-gateway.multiversx.com RABBITMQ_URL=amqp://127.0.0.1:5672 PROVIDERS_URL=https://devnet-delegation-api.multiversx.com/providers DATAAPI_URL=https://devnet-data-api.multiversx.com EXCHANGE_URL=https://devnet-graph.xexchange.com/graphql MARKETPLACE_URL=https://devnet-nfts-graph.multiversx.com/graphql ASSETSFETCH_URL=https://tools.multiversx.com/assets-cdn DELEGATION_URL=https://devnet-delegation-api.multiversx.com SOCKET_URL=devnet-socket-api.multiversx.com NODESFETCH_URL=https://devnet-api.multiversx.com TOKENSFETCH_URL=https://devnet-api.multiversx.com PROVIDERSFETCH_URL=https://devnet-api.multiversx.com PLACEHOLDER_DAPP_id=devnet PLACEHOLDER_DAPP_name=Devnet PLACEHOLDER_DAPP_egldLabel=xEGLD PLACEHOLDER_DAPP_walletAddress=https://devnet-wallet.multiversx.com PLACEHOLDER_DAPP_apiAddress=https://devnet-api.multiversx.com PLACEHOLDER_DAPP_explorerAddress=http://devnet-explorer.multiversx.com PLACEHOLDER_DAPP_chainId=D"
28+
29+
replace_placeholder() {
30+
local var_name=$1
31+
local var_value=$2
32+
33+
case $var_name in
34+
PLACEHOLDER_DAPP*)
35+
echo "Var ${var_name} defined, replacing ${var_value} in /app/config/dapp.config.placeholder.json"
36+
sed -i "s|${var_name}|${var_value}|g" /app/config/dapp.config.placeholder.json
37+
;;
38+
*)
39+
echo "Var ${var_name} defined, replacing ${var_value} in /app/dist/config/config.yaml"
40+
sed -i "s|${var_name}|${var_value}|g" /app/dist/config/config.yaml
41+
;;
42+
esac
43+
44+
}
45+
46+
# Loop through each environment variable
47+
for entry in $env_vars_with_defaults; do
48+
# Split the entry into name and value
49+
var_name=$(echo $entry | cut -d= -f1)
50+
default_value=$(echo $entry | cut -d= -f2)
51+
52+
# Use the environment variable value if defined; otherwise, use the default
53+
eval "value=\${$var_name:-$default_value}"
54+
55+
cp ./config/config.placeholder.yaml /app/dist/config/config.yaml
56+
if [ $? -eq 0 ]; then
57+
echo "Config file copied successfully from config/config.placeholder.yaml /app/dist/config/config.yaml"
58+
fi
59+
60+
# Execute the function with the variable name and value
61+
replace_placeholder "$var_name" "$value"
62+
63+
done
4564

4665
exec /usr/local/bin/node dist/src/main.js

src/common/data-api/data-api.service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,18 @@ export class DataApiService {
7272
}
7373

7474
try {
75-
const [cexTokensRaw, xExchangeTokensRaw, hatomTokensRaw] = await Promise.all([
75+
const [cexTokensRaw, xExchangeTokensRaw, hatomTokensRaw, xoxnoTokensRaw] = await Promise.all([
7676
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/cex?fields=identifier`),
7777
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/xexchange?fields=identifier`),
7878
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/hatom?fields=identifier`),
79+
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/xoxno?fields=identifier`),
7980
]);
8081

8182
const cexTokens: DataApiToken[] = cexTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'cex' }));
8283
const xExchangeTokens: DataApiToken[] = xExchangeTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'xexchange' }));
8384
const hatomTokens: DataApiToken[] = hatomTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'hatom' }));
84-
85-
const tokens = [...cexTokens, ...xExchangeTokens, ...hatomTokens].toRecord<DataApiToken>(x => x.identifier);
85+
const xoxnoTokens: DataApiToken[] = xoxnoTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'xoxno' }));
86+
const tokens = [...cexTokens, ...xExchangeTokens, ...hatomTokens, ...xoxnoTokens].toRecord<DataApiToken>(x => x.identifier);
8687
return tokens;
8788
} catch (error) {
8889
this.logger.error(`An unexpected error occurred while fetching tokens from Data API.`);

src/common/data-api/entities/data-api.token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export class DataApiToken {
44
}
55

66
identifier: string = '';
7-
market: 'cex' | 'xexchange' | 'hatom' = 'cex';
7+
market: 'cex' | 'xexchange' | 'hatom' | 'xoxno' = 'cex';
88
}

src/common/gateway/entities/gateway.component.request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export enum GatewayComponentRequest {
55
networkEconomics = 'networkEconomics',
66
networkTotalStaked = 'networkTotalStaked',
77
addressDetails = 'addressDetails',
8+
addressesBulk = 'addressesBulk',
89
addressEsdt = 'addressEsdt',
910
addressEsdtHistorical = 'addressEsdtHistorical',
1011
addressEsdtBalance = 'addressEsdtBalance',

src/common/gateway/gateway.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ export class GatewayService {
9595
return result;
9696
}
9797

98+
async getAccountsBulk(addresses: string[]): Promise<Account[]> {
99+
const result = await this.create('address/bulk', GatewayComponentRequest.addressesBulk, addresses);
100+
return result.accounts;
101+
}
102+
98103
async getEsdtSupply(identifier: string): Promise<EsdtSupply> {
99104
const result = await this.get(`network/esdt/supply/${identifier}`, GatewayComponentRequest.esdtSupply);
100105
return result;

0 commit comments

Comments
 (0)