Skip to content

Commit 3ae03ba

Browse files
Merge pull request #54 from web3data/doc/transactions
Doc/transactions
2 parents afab3e3 + f4ef1ce commit 3ae03ba

File tree

4 files changed

+386
-6
lines changed

4 files changed

+386
-6
lines changed

dist/web3data.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web3data.min.js.map

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api.md

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,303 @@ const batTokenAddress = web3data.market.getAssetAddresses('bat') const assetAddr
10201020

10211021

10221022

1023+
### src/transaction.js
1024+
1025+
1026+
1027+
#### Class: Transaction
1028+
1029+
1030+
Contains methods pertaining to the `/address` endpoint of Amberdata's API.
1031+
See [documentation](https://docs.amberdata.io/reference#get-all-transactions) details about our transaction endpoints.
1032+
1033+
1034+
1035+
1036+
1037+
1038+
1039+
1040+
1041+
#### constructor(web3data)
1042+
1043+
1044+
Creates an instance of Transaction. Meant to be used in conjunction with the Web3Data class.
1045+
1046+
1047+
1048+
1049+
##### Parameters
1050+
1051+
| Name | Type | Description | |
1052+
| ---- | ---- | ----------- | -------- |
1053+
| web3data | | The web3data instance. |   |
1054+
1055+
1056+
1057+
1058+
##### Examples
1059+
1060+
```javascript
1061+
1062+
```
1063+
1064+
1065+
##### Returns
1066+
1067+
1068+
- `Void`
1069+
1070+
1071+
1072+
1073+
1074+
#### getTransactions(filterOptions)
1075+
1076+
1077+
Retrieves all transactions matching the specified filters.
1078+
1079+
1080+
1081+
1082+
##### Parameters
1083+
1084+
| Name | Type | Description | |
1085+
| ---- | ---- | ----------- | -------- |
1086+
| filterOptions | | The filter options associated with the request. |   |
1087+
| filterOptions.status | | Filter by the status of the transactions to retrieve (all, completed, failed, pending). |   |
1088+
| filterOptions.includePrice | | Indicates whether or not to include price data with the results. |   |
1089+
1090+
1091+
1092+
1093+
##### Examples
1094+
1095+
```javascript
1096+
const transactions = await web3data.transaction.getTransactions()
1097+
// Include pricing data with transactions
1098+
const transactions = await web3data.transaction.getTransactions({
1099+
includePrice: true
1100+
})
1101+
```
1102+
1103+
1104+
##### Returns
1105+
1106+
1107+
- All transactions matched by the specified filters.
1108+
1109+
1110+
1111+
1112+
1113+
#### getTransaction(hash, filterOptions)
1114+
1115+
1116+
Retrieves the transaction data for the specified hash.
1117+
1118+
1119+
1120+
1121+
##### Parameters
1122+
1123+
| Name | Type | Description | |
1124+
| ---- | ---- | ----------- | -------- |
1125+
| hash | | The transaction hash. |   |
1126+
| filterOptions | | The filter options associated with the request. See [docs](https://docs.amberdata.io/reference#gettransaction) for more details. |   |
1127+
| filterOptions.validationMethod=none | | The validation method to be added to the response: `none`, `basic`, `full`. |   |
1128+
| filterOptions.includePrice=true | | Indicates whether or not to include price data with the results. |   |
1129+
1130+
1131+
1132+
1133+
##### Examples
1134+
1135+
```javascript
1136+
const transaction = await web3data.transaction.getTransaction('0xd0a5a0912fdf87993b3cebd696f1ee667a8fbbe8fc890a22dcbdf114f36de4cf')
1137+
```
1138+
1139+
1140+
##### Returns
1141+
1142+
1143+
- The data for the specified transaction hash.
1144+
1145+
1146+
1147+
1148+
1149+
#### getPendingTransactions()
1150+
1151+
1152+
Retrieves all pending transaction.
1153+
1154+
1155+
1156+
1157+
1158+
1159+
##### Examples
1160+
1161+
```javascript
1162+
const pendingTransactions = await web3data.transaction.getPendingTransactions()
1163+
```
1164+
1165+
1166+
##### Returns
1167+
1168+
1169+
- The pending transactions.
1170+
1171+
1172+
1173+
1174+
1175+
#### getGasPrediction()
1176+
1177+
1178+
Retrieves the latest gas predictions for the transactions.
1179+
1180+
1181+
1182+
1183+
1184+
1185+
##### Examples
1186+
1187+
```javascript
1188+
const gasPredictions = await web3data.transaction.getGasPrediction()
1189+
```
1190+
1191+
1192+
##### Returns
1193+
1194+
1195+
- The latest gas predictions for the transactions.
1196+
1197+
1198+
1199+
1200+
1201+
#### getGasPercentiles(filterOptions)
1202+
1203+
1204+
Retrieves the latest gas price percentiles for the transactions.
1205+
1206+
1207+
1208+
1209+
##### Parameters
1210+
1211+
| Name | Type | Description | |
1212+
| ---- | ---- | ----------- | -------- |
1213+
| filterOptions | | The filter options associated with the request. |   |
1214+
| filterOptions.numBlocks | | Number of past blocks on which to base the percentiles. |   |
1215+
1216+
1217+
1218+
1219+
##### Examples
1220+
1221+
```javascript
1222+
const gasPercentiles = await web3data.transaction.getGasPercentiles()
1223+
```
1224+
1225+
1226+
##### Returns
1227+
1228+
1229+
- The latest gas price percentiles for the transactions.
1230+
1231+
1232+
1233+
1234+
1235+
#### getGasPrice()
1236+
1237+
1238+
Retrieves the latest average gas price. Uses `getGasPrediction` under the hood.
1239+
1240+
1241+
1242+
1243+
1244+
1245+
##### Examples
1246+
1247+
```javascript
1248+
const gasPrice = await web3data.transaction.getGasPrice()
1249+
```
1250+
1251+
1252+
##### Returns
1253+
1254+
1255+
- The latest gas price.
1256+
1257+
1258+
1259+
1260+
1261+
#### getVolume(filterOptions)
1262+
1263+
1264+
Retrieves the historical (time series) volume of transactions.
1265+
1266+
1267+
1268+
1269+
##### Parameters
1270+
1271+
| Name | Type | Description | |
1272+
| ---- | ---- | ----------- | -------- |
1273+
| filterOptions | | The filter options associated with the request. See [docs](https://docs.amberdata.io/reference#gethistoricaltransactionvolume) for more details. |   |
1274+
1275+
1276+
1277+
1278+
##### Examples
1279+
1280+
```javascript
1281+
const volume = await web3data.transaction.getVolume()
1282+
```
1283+
1284+
1285+
##### Returns
1286+
1287+
1288+
- The historical (time series) volume of transactions.
1289+
1290+
1291+
1292+
1293+
1294+
#### getMetrics()
1295+
1296+
1297+
Get metrics for recent confirmed transactions for a given blockchain. Default metrics are over a 24h period.
1298+
1299+
1300+
1301+
1302+
1303+
1304+
##### Examples
1305+
1306+
```javascript
1307+
const metrics = await web3data.transaction.getMetrics()
1308+
```
1309+
1310+
1311+
##### Returns
1312+
1313+
1314+
- Metrics for recent confirmed transactions.
1315+
1316+
1317+
1318+
1319+
10231320
### src/utils.js
10241321

10251322

0 commit comments

Comments
 (0)