@hu-fi/subgraph-sdk 1.0.0-beta.4 → 1.1.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
CHANGED
|
@@ -16,6 +16,44 @@ Set your Graph Studio API key (used as a Bearer token):
|
|
|
16
16
|
export HUFI_SUBGRAPH_API_KEY="your_api_key"
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
### Usage Examples
|
|
20
|
+
|
|
21
|
+
#### Fetching Campaigns
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import hufiSdk, { CampaignOrderBy, OrderDirection } from '@hu-fi/subgraph-sdk';
|
|
25
|
+
|
|
26
|
+
const campaigns = await hufiSdk.getCampaigns(137, {
|
|
27
|
+
first: 3,
|
|
28
|
+
filters: {
|
|
29
|
+
fundTokenAddress: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',
|
|
30
|
+
},
|
|
31
|
+
orderBy: CampaignOrderBy.FUND_AMOUNT,
|
|
32
|
+
orderDirection: OrderDirection.DESC,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
console.log('Campaigns:', campaigns);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Fetching Statistics
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import hufiSdk from '@hu-fi/subgraph-sdk';
|
|
42
|
+
|
|
43
|
+
// Get overall statistics
|
|
44
|
+
const overallStats = await hufiSdk.getOverallStats(137);
|
|
45
|
+
console.log('Overall stats:', overallStats);
|
|
46
|
+
|
|
47
|
+
// Get statistics by oracles
|
|
48
|
+
const oraclesStats = await hufiSdk.getStatsByOracles(
|
|
49
|
+
137,
|
|
50
|
+
'0x5b74d007ea08217bcde942a2132df43d568a6dca',
|
|
51
|
+
'0x3a2292c684e289fe5f07737b598fe0027ead5a0e',
|
|
52
|
+
'0x1519964f5cd2d9ef162b2b1b66f33669cca065c8',
|
|
53
|
+
);
|
|
54
|
+
console.log('Oracles stats:', oraclesStats);
|
|
55
|
+
```
|
|
56
|
+
|
|
19
57
|
## Local Development
|
|
20
58
|
|
|
21
59
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,OAAO,MAAM;IACb,YAAY,QAAQ;CACrB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAKtD,CAAC;AAEF,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,uBAAuB,4BAA4B,CAAC"}
|
package/dist/common/constants.js
CHANGED
|
@@ -4,9 +4,11 @@ exports.CAMPAIGNS_STATISTICS_ID = exports.DEFAULT_PAGE_SIZE = exports.MAX_PAGE_S
|
|
|
4
4
|
var ChainId;
|
|
5
5
|
(function (ChainId) {
|
|
6
6
|
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
|
|
7
|
+
ChainId[ChainId["POLYGON_AMOY"] = 80002] = "POLYGON_AMOY";
|
|
7
8
|
})(ChainId || (exports.ChainId = ChainId = {}));
|
|
8
9
|
exports.SubgraphUrlByChain = {
|
|
9
|
-
[ChainId.POLYGON]: 'https://api.studio.thegraph.com/query/74256/
|
|
10
|
+
[ChainId.POLYGON]: 'https://api.studio.thegraph.com/query/74256/hufi-campaigns-polygon/version/latest',
|
|
11
|
+
[ChainId.POLYGON_AMOY]: 'https://api.studio.thegraph.com/query/74256/hufi-campaigns-amoy/version/latest',
|
|
10
12
|
};
|
|
11
13
|
exports.MAX_PAGE_SIZE = 1000;
|
|
12
14
|
exports.DEFAULT_PAGE_SIZE = 100;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,6CAAa,CAAA;IACb,yDAAoB,CAAA;AACtB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAEY,QAAA,kBAAkB,GAA4B;IACzD,CAAC,OAAO,CAAC,OAAO,CAAC,EACf,mFAAmF;IACrF,CAAC,OAAO,CAAC,YAAY,CAAC,EACpB,gFAAgF;CACnF,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,CAAC;AACrB,QAAA,iBAAiB,GAAG,GAAG,CAAC;AAExB,QAAA,uBAAuB,GAAG,yBAAyB,CAAC"}
|