@cityofzion/bs-ethereum 0.7.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/src/graphql.ts ADDED
@@ -0,0 +1,283 @@
1
+ import { gql } from '@urql/core'
2
+
3
+ type BitqueryNetwork = 'ethereum' | 'goerli'
4
+
5
+ export type BitqueryTransaction = {
6
+ block: {
7
+ timestamp: {
8
+ unixtime: number
9
+ }
10
+ height: number
11
+ }
12
+ transaction: {
13
+ gasValue: number
14
+ hash: string
15
+ }
16
+ amount: number
17
+ currency: {
18
+ address: string
19
+ tokenType: string
20
+ decimals: number
21
+ symbol: string
22
+ name: string
23
+ }
24
+ sender: {
25
+ address: string
26
+ }
27
+ receiver: {
28
+ address: string
29
+ }
30
+ entityId: string
31
+ }
32
+
33
+ type BitQueryGetTransactionsByAddressResponse = {
34
+ ethereum: {
35
+ sent: BitqueryTransaction[]
36
+ received: BitqueryTransaction[]
37
+ sentCount: {
38
+ count: number
39
+ }
40
+ receiverCount: {
41
+ count: number
42
+ }
43
+ }
44
+ }
45
+
46
+ type BitQueryGetTransactionsByAddressVariables = {
47
+ address: string
48
+ limit: number
49
+ offset: number
50
+ network: BitqueryNetwork
51
+ }
52
+
53
+ export const bitqueryGetTransactionsByAddressQuery = gql<
54
+ BitQueryGetTransactionsByAddressResponse,
55
+ BitQueryGetTransactionsByAddressVariables
56
+ >`
57
+ query getTransactions($address: String!, $limit: Int!, $offset: Int!, $network: EthereumNetwork!) {
58
+ ethereum(network: $network) {
59
+ sent: transfers(options: { limit: $limit, offset: $offset }, sender: { is: $address }) {
60
+ block {
61
+ timestamp {
62
+ unixtime
63
+ }
64
+ height
65
+ }
66
+ amount
67
+ currency {
68
+ address
69
+ tokenType
70
+ symbol
71
+ decimals
72
+ name
73
+ }
74
+ sender {
75
+ address
76
+ }
77
+ receiver {
78
+ address
79
+ }
80
+ transaction {
81
+ gasValue
82
+ hash
83
+ }
84
+ entityId
85
+ }
86
+ received: transfers(options: { limit: $limit, offset: $offset }, receiver: { is: $address }) {
87
+ block {
88
+ timestamp {
89
+ unixtime
90
+ }
91
+ height
92
+ }
93
+ amount
94
+ currency {
95
+ address
96
+ tokenType
97
+ }
98
+ sender {
99
+ address
100
+ }
101
+ receiver {
102
+ address
103
+ }
104
+ transaction {
105
+ gasValue
106
+ hash
107
+ }
108
+ entityId
109
+ }
110
+ sentCount: transfers(sender: { is: $address }) {
111
+ count
112
+ }
113
+ receiverCount: transfers(receiver: { is: $address }) {
114
+ count
115
+ }
116
+ }
117
+ }
118
+ `
119
+
120
+ type BitQueryGetTransactionResponse = {
121
+ ethereum: {
122
+ transfers: BitqueryTransaction[]
123
+ }
124
+ }
125
+ type BitQueryGetTransactionVariables = {
126
+ hash: string
127
+ network: BitqueryNetwork
128
+ }
129
+ export const bitqueryGetTransactionQuery = gql<BitQueryGetTransactionResponse, BitQueryGetTransactionVariables>`
130
+ query getTransaction($hash: String!, $network: EthereumNetwork!) {
131
+ ethereum(network: $network) {
132
+ transfers(txHash: { is: $hash }) {
133
+ block {
134
+ timestamp {
135
+ unixtime
136
+ }
137
+ height
138
+ }
139
+ amount
140
+ currency {
141
+ address
142
+ tokenType
143
+ }
144
+ sender {
145
+ address
146
+ }
147
+ receiver {
148
+ address
149
+ }
150
+ transaction {
151
+ gasValue
152
+ hash
153
+ }
154
+ entityId
155
+ }
156
+ }
157
+ }
158
+ `
159
+
160
+ type BitQueryGetContractResponse = {
161
+ ethereum: {
162
+ smartContractCalls: {
163
+ smartContract: {
164
+ address: {
165
+ address: string
166
+ }
167
+ currency: {
168
+ symbol: string
169
+ name: string
170
+ decimals: number
171
+ tokenType: string
172
+ }
173
+ }
174
+ }[]
175
+ }
176
+ }
177
+ type BitQueryGetTokenInfoVariables = {
178
+ hash: string
179
+ network: BitqueryNetwork
180
+ }
181
+ export const bitqueryGetTokenInfoQuery = gql<BitQueryGetContractResponse, BitQueryGetTokenInfoVariables>`
182
+ query getTokenInfo($hash: String!, $network: EthereumNetwork!) {
183
+ ethereum(network: $network) {
184
+ smartContractCalls(smartContractAddress: { is: $hash }) {
185
+ smartContract {
186
+ address {
187
+ address
188
+ }
189
+ currency {
190
+ symbol
191
+ name
192
+ decimals
193
+ tokenType
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ `
200
+
201
+ type BitQueryGetBalanceResponse = {
202
+ ethereum: {
203
+ address: {
204
+ balances:
205
+ | {
206
+ currency: {
207
+ address: string
208
+ symbol: string
209
+ name: string
210
+ decimals: number
211
+ }
212
+ value: number
213
+ }[]
214
+ | null
215
+ }[]
216
+ }
217
+ }
218
+ type BitQueryGetBalanceVariables = {
219
+ address: string
220
+ network: BitqueryNetwork
221
+ }
222
+ export const bitqueryGetBalanceQuery = gql<BitQueryGetBalanceResponse, BitQueryGetBalanceVariables>`
223
+ query getBalance($address: String!, $network: EthereumNetwork!) {
224
+ ethereum(network: $network) {
225
+ address(address: { is: $address }) {
226
+ balances {
227
+ currency {
228
+ address
229
+ symbol
230
+ name
231
+ decimals
232
+ }
233
+ value
234
+ }
235
+ }
236
+ }
237
+ }
238
+ `
239
+ type BitQueryGetTokenPricesResponse = {
240
+ ethereum: {
241
+ dexTrades: {
242
+ baseCurrency: {
243
+ address: string
244
+ symbol: string
245
+ }
246
+ quoteCurrency: {
247
+ address: string
248
+ symbol: string
249
+ }
250
+ date: {
251
+ date: string
252
+ }
253
+ quotePrice: number
254
+ }[]
255
+ }
256
+ }
257
+ export type BitQueryGetTokenPricesVariables = {
258
+ after: string
259
+ network: BitqueryNetwork
260
+ }
261
+ export const bitqueryGetPricesQuery = gql<BitQueryGetTokenPricesResponse, BitQueryGetTokenPricesVariables>`
262
+ query getPrice($after: ISO8601DateTime!, $network: EthereumNetwork!) {
263
+ ethereum(network: $network) {
264
+ dexTrades(
265
+ options: { limitBy: { each: "baseCurrency.address", limit: 1 }, desc: "date.date" }
266
+ time: { after: $after }
267
+ ) {
268
+ quoteCurrency(quoteCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }) {
269
+ symbol
270
+ address
271
+ }
272
+ baseCurrency {
273
+ symbol
274
+ address
275
+ }
276
+ date {
277
+ date
278
+ }
279
+ quotePrice
280
+ }
281
+ }
282
+ }
283
+ `
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './BSEthereum'
2
+ export * from './GhostMarketNDSEthereum'
3
+ export * from './constants'
4
+ export * from './BitqueryBDSEthereum'
5
+ export * from './BitqueryEDSEthereum'
6
+ export * from './RpcBDSEthereum'
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["src/__tests__"]
4
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["ESNext"],
5
+ "outDir": "./dist",
6
+ "strict": true
7
+ },
8
+ "include": ["src"],
9
+ "exclude": ["node_modules"],
10
+ "typedocOptions": {
11
+ "entryPoints": ["./src/index.ts"],
12
+ "out": "docs",
13
+ "exclude": "**/node_modules/**"
14
+ }
15
+ }