@cityofzion/bs-ethereum 1.1.0 → 1.2.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/dist/BSEthereum.d.ts +3 -2
- package/dist/BSEthereum.js +27 -7
- package/dist/BitqueryBDSEthereum.d.ts +1 -2
- package/dist/BitqueryBDSEthereum.js +27 -12
- package/dist/BitqueryEDSEthereum.d.ts +1 -2
- package/dist/BitqueryEDSEthereum.js +20 -5
- package/dist/GhostMarketNDSEthereum.d.ts +1 -1
- package/dist/GhostMarketNDSEthereum.js +17 -3
- package/dist/LedgerServiceEthereum.d.ts +4 -2
- package/dist/LedgerServiceEthereum.js +13 -5
- package/dist/RpcBDSEthereum.d.ts +1 -1
- package/dist/RpcBDSEthereum.js +21 -7
- package/package.json +5 -2
- package/.eslintignore +0 -13
- package/.eslintrc.cjs +0 -22
- package/.rush/temp/operation/build/all.log +0 -1
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/package-deps_build.json +0 -30
- package/.rush/temp/shrinkwrap-deps.json +0 -531
- package/CHANGELOG.json +0 -126
- package/CHANGELOG.md +0 -68
- package/bs-ethereum.build.log +0 -1
- package/jest.config.ts +0 -13
- package/jest.setup.ts +0 -1
- package/src/BSEthereum.ts +0 -208
- package/src/BitqueryBDSEthereum.ts +0 -231
- package/src/BitqueryEDSEthereum.ts +0 -67
- package/src/GhostMarketNDSEthereum.ts +0 -125
- package/src/LedgerServiceEthereum.ts +0 -44
- package/src/RpcBDSEthereum.ts +0 -88
- package/src/__tests__/BSEthereum.spec.ts +0 -172
- package/src/__tests__/BitqueryBDSEthereum.spec.ts +0 -106
- package/src/__tests__/BitqueryEDSEthereum.spec.ts +0 -55
- package/src/__tests__/GhostMarketNDSEthereum.spec.ts +0 -49
- package/src/__tests__/RpcBDSEthereum.spec.ts +0 -62
- package/src/assets/tokens/common.json +0 -8
- package/src/constants.ts +0 -36
- package/src/graphql.ts +0 -288
- package/src/index.ts +0 -6
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -15
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { GhostMarketNDSEthereum } from '../GhostMarketNDSEthereum'
|
|
2
|
-
|
|
3
|
-
let ghostMarketNDSEthereum: GhostMarketNDSEthereum
|
|
4
|
-
|
|
5
|
-
describe('GhostMarketNDSEthereum', () => {
|
|
6
|
-
beforeAll(() => {
|
|
7
|
-
ghostMarketNDSEthereum = new GhostMarketNDSEthereum('mainnet')
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('Get NFT', async () => {
|
|
11
|
-
const nft = await ghostMarketNDSEthereum.getNft({
|
|
12
|
-
contractHash: '0xeb3a9a839dfeeaf71db1b4ed6a8ae0ccb171b227',
|
|
13
|
-
tokenId: '379',
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
expect(nft).toEqual(
|
|
17
|
-
expect.objectContaining({
|
|
18
|
-
id: '379',
|
|
19
|
-
contractHash: '0xeb3a9a839dfeeaf71db1b4ed6a8ae0ccb171b227',
|
|
20
|
-
symbol: 'MOAR',
|
|
21
|
-
collectionImage: expect.any(String),
|
|
22
|
-
collectionName: '"MOAR" by Joan Cornella',
|
|
23
|
-
image: expect.any(String),
|
|
24
|
-
isSVG: expect.any(Boolean),
|
|
25
|
-
name: 'MOAR #379',
|
|
26
|
-
creator: {
|
|
27
|
-
address: '0xd71ef31e9d4e8674d9177c28cc2d0d633580615b',
|
|
28
|
-
name: undefined,
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('Get NFTS by address', async () => {
|
|
35
|
-
const nfts = await ghostMarketNDSEthereum.getNftsByAddress({
|
|
36
|
-
address: '0xd773c81a4a855556ce2f2372b12272710b95b26c',
|
|
37
|
-
})
|
|
38
|
-
expect(nfts.items.length).toBeGreaterThan(0)
|
|
39
|
-
nfts.items.forEach(nft => {
|
|
40
|
-
expect(nft).toEqual(
|
|
41
|
-
expect.objectContaining({
|
|
42
|
-
symbol: expect.any(String),
|
|
43
|
-
id: expect.any(String),
|
|
44
|
-
contractHash: expect.any(String),
|
|
45
|
-
})
|
|
46
|
-
)
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { RpcBDSEthereum } from '../RpcBDSEthereum'
|
|
2
|
-
import { DEFAULT_URL_BY_NETWORK_TYPE } from '../constants'
|
|
3
|
-
|
|
4
|
-
const rpcBDSEthereum = new RpcBDSEthereum({ type: 'testnet', url: DEFAULT_URL_BY_NETWORK_TYPE.testnet })
|
|
5
|
-
|
|
6
|
-
describe('RpcBDSEthereum', () => {
|
|
7
|
-
it('Should be able to get transaction', async () => {
|
|
8
|
-
const hash = '0x48eac645fac2280d7ac89a319372d7a38d52516f8b3003574bfaaed31b471ff3'
|
|
9
|
-
const transaction = await rpcBDSEthereum.getTransaction(hash)
|
|
10
|
-
|
|
11
|
-
expect(transaction).toEqual(
|
|
12
|
-
expect.objectContaining({
|
|
13
|
-
block: expect.any(Number),
|
|
14
|
-
hash,
|
|
15
|
-
notifications: [],
|
|
16
|
-
time: expect.any(Number),
|
|
17
|
-
})
|
|
18
|
-
)
|
|
19
|
-
transaction.transfers.forEach(transfer => {
|
|
20
|
-
expect(transfer).toEqual(
|
|
21
|
-
expect.objectContaining({
|
|
22
|
-
from: expect.any(String),
|
|
23
|
-
to: expect.any(String),
|
|
24
|
-
contractHash: expect.any(String),
|
|
25
|
-
amount: expect.any(String),
|
|
26
|
-
type: expect.any(String),
|
|
27
|
-
})
|
|
28
|
-
)
|
|
29
|
-
})
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('Should be able to get eth info', async () => {
|
|
33
|
-
const hash = '-'
|
|
34
|
-
const token = await rpcBDSEthereum.getTokenInfo(hash)
|
|
35
|
-
|
|
36
|
-
expect(token).toEqual({
|
|
37
|
-
symbol: 'ETH',
|
|
38
|
-
name: 'Ethereum',
|
|
39
|
-
hash: '-',
|
|
40
|
-
decimals: 18,
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('Should be able to get balance', async () => {
|
|
45
|
-
const address = '0xbA65F285D1F9E0bf76Ab01211547979a3b60011A'
|
|
46
|
-
const balance = await rpcBDSEthereum.getBalance(address)
|
|
47
|
-
|
|
48
|
-
balance.forEach(balance => {
|
|
49
|
-
expect(balance).toEqual(
|
|
50
|
-
expect.objectContaining({
|
|
51
|
-
amount: expect.any(String),
|
|
52
|
-
token: {
|
|
53
|
-
hash: expect.any(String),
|
|
54
|
-
name: expect.any(String),
|
|
55
|
-
symbol: expect.any(String),
|
|
56
|
-
decimals: expect.any(Number),
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
)
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
})
|
package/src/constants.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { NetworkType, Token } from '@cityofzion/blockchain-service'
|
|
2
|
-
import commom from './assets/tokens/common.json'
|
|
3
|
-
|
|
4
|
-
export type BitqueryNetwork = 'ethereum' | 'goerli'
|
|
5
|
-
|
|
6
|
-
export const TOKENS: Record<NetworkType, Token[]> = {
|
|
7
|
-
mainnet: [...commom],
|
|
8
|
-
testnet: commom,
|
|
9
|
-
custom: commom,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const NATIVE_ASSETS = commom
|
|
13
|
-
|
|
14
|
-
export const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string> = {
|
|
15
|
-
mainnet: 'https://ethereum-mainnet-rpc.allthatnode.com',
|
|
16
|
-
testnet: 'https://ethereum-sepolia-rpc.publicnode.com',
|
|
17
|
-
custom: 'http://127.0.0.1:8545',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const BITQUERY_URL = 'https://graphql.bitquery.io'
|
|
21
|
-
export const BITQUERY_NETWORK_BY_NETWORK_TYPE: Record<Exclude<NetworkType, 'custom'>, BitqueryNetwork> = {
|
|
22
|
-
mainnet: 'ethereum',
|
|
23
|
-
testnet: 'goerli',
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const GHOSTMARKET_URL_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>> = {
|
|
27
|
-
mainnet: 'https://api.ghostmarket.io/api/v2',
|
|
28
|
-
testnet: 'https://api-testnet.ghostmarket.io/api/v2',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const GHOSTMARKET_CHAIN_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>> = {
|
|
32
|
-
mainnet: 'eth',
|
|
33
|
-
testnet: 'etht',
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const DERIVATION_PATH = "m/44'/60'/0'/0/?"
|
package/src/graphql.ts
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
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(
|
|
60
|
-
options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
|
|
61
|
-
sender: { is: $address }
|
|
62
|
-
) {
|
|
63
|
-
block {
|
|
64
|
-
timestamp {
|
|
65
|
-
unixtime
|
|
66
|
-
}
|
|
67
|
-
height
|
|
68
|
-
}
|
|
69
|
-
amount
|
|
70
|
-
currency {
|
|
71
|
-
address
|
|
72
|
-
tokenType
|
|
73
|
-
symbol
|
|
74
|
-
decimals
|
|
75
|
-
name
|
|
76
|
-
}
|
|
77
|
-
sender {
|
|
78
|
-
address
|
|
79
|
-
}
|
|
80
|
-
receiver {
|
|
81
|
-
address
|
|
82
|
-
}
|
|
83
|
-
transaction {
|
|
84
|
-
gasValue
|
|
85
|
-
hash
|
|
86
|
-
}
|
|
87
|
-
entityId
|
|
88
|
-
}
|
|
89
|
-
received: transfers(
|
|
90
|
-
options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
|
|
91
|
-
receiver: { is: $address }
|
|
92
|
-
) {
|
|
93
|
-
block {
|
|
94
|
-
timestamp {
|
|
95
|
-
unixtime
|
|
96
|
-
}
|
|
97
|
-
height
|
|
98
|
-
}
|
|
99
|
-
amount
|
|
100
|
-
currency {
|
|
101
|
-
address
|
|
102
|
-
tokenType
|
|
103
|
-
}
|
|
104
|
-
sender {
|
|
105
|
-
address
|
|
106
|
-
}
|
|
107
|
-
receiver {
|
|
108
|
-
address
|
|
109
|
-
}
|
|
110
|
-
transaction {
|
|
111
|
-
gasValue
|
|
112
|
-
hash
|
|
113
|
-
}
|
|
114
|
-
entityId
|
|
115
|
-
}
|
|
116
|
-
sentCount: transfers(sender: { is: $address }) {
|
|
117
|
-
count
|
|
118
|
-
}
|
|
119
|
-
receiverCount: transfers(receiver: { is: $address }) {
|
|
120
|
-
count
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
`
|
|
125
|
-
|
|
126
|
-
type BitQueryGetTransactionResponse = {
|
|
127
|
-
ethereum: {
|
|
128
|
-
transfers: BitqueryTransaction[]
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
type BitQueryGetTransactionVariables = {
|
|
132
|
-
hash: string
|
|
133
|
-
network: BitqueryNetwork
|
|
134
|
-
}
|
|
135
|
-
export const bitqueryGetTransactionQuery = gql<BitQueryGetTransactionResponse, BitQueryGetTransactionVariables>`
|
|
136
|
-
query getTransaction($hash: String!, $network: EthereumNetwork!) {
|
|
137
|
-
ethereum(network: $network) {
|
|
138
|
-
transfers(txHash: { is: $hash }) {
|
|
139
|
-
block {
|
|
140
|
-
timestamp {
|
|
141
|
-
unixtime
|
|
142
|
-
}
|
|
143
|
-
height
|
|
144
|
-
}
|
|
145
|
-
amount
|
|
146
|
-
currency {
|
|
147
|
-
address
|
|
148
|
-
tokenType
|
|
149
|
-
}
|
|
150
|
-
sender {
|
|
151
|
-
address
|
|
152
|
-
}
|
|
153
|
-
receiver {
|
|
154
|
-
address
|
|
155
|
-
}
|
|
156
|
-
transaction {
|
|
157
|
-
gasValue
|
|
158
|
-
hash
|
|
159
|
-
}
|
|
160
|
-
entityId
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
`
|
|
165
|
-
|
|
166
|
-
type BitQueryGetContractResponse = {
|
|
167
|
-
ethereum: {
|
|
168
|
-
smartContractCalls: {
|
|
169
|
-
smartContract: {
|
|
170
|
-
address: {
|
|
171
|
-
address: string
|
|
172
|
-
}
|
|
173
|
-
currency: {
|
|
174
|
-
symbol: string
|
|
175
|
-
name: string
|
|
176
|
-
decimals: number
|
|
177
|
-
tokenType: string
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}[]
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
type BitQueryGetTokenInfoVariables = {
|
|
184
|
-
hash: string
|
|
185
|
-
network: BitqueryNetwork
|
|
186
|
-
}
|
|
187
|
-
export const bitqueryGetTokenInfoQuery = gql<BitQueryGetContractResponse, BitQueryGetTokenInfoVariables>`
|
|
188
|
-
query getTokenInfo($hash: String!, $network: EthereumNetwork!) {
|
|
189
|
-
ethereum(network: $network) {
|
|
190
|
-
smartContractCalls(smartContractAddress: { is: $hash }, options: { limit: 1 }) {
|
|
191
|
-
smartContract {
|
|
192
|
-
address {
|
|
193
|
-
address
|
|
194
|
-
}
|
|
195
|
-
currency {
|
|
196
|
-
symbol
|
|
197
|
-
name
|
|
198
|
-
decimals
|
|
199
|
-
tokenType
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
`
|
|
206
|
-
|
|
207
|
-
type BitQueryGetBalanceResponse = {
|
|
208
|
-
ethereum: {
|
|
209
|
-
address: {
|
|
210
|
-
balance: number
|
|
211
|
-
balances:
|
|
212
|
-
| {
|
|
213
|
-
currency: {
|
|
214
|
-
address: string
|
|
215
|
-
symbol: string
|
|
216
|
-
name: string
|
|
217
|
-
decimals: number
|
|
218
|
-
}
|
|
219
|
-
value: number
|
|
220
|
-
}[]
|
|
221
|
-
| null
|
|
222
|
-
}[]
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
type BitQueryGetBalanceVariables = {
|
|
226
|
-
address: string
|
|
227
|
-
network: BitqueryNetwork
|
|
228
|
-
}
|
|
229
|
-
export const bitqueryGetBalanceQuery = gql<BitQueryGetBalanceResponse, BitQueryGetBalanceVariables>`
|
|
230
|
-
query getBalance($address: String!, $network: EthereumNetwork!) {
|
|
231
|
-
ethereum(network: $network) {
|
|
232
|
-
address(address: { is: $address }) {
|
|
233
|
-
balance
|
|
234
|
-
balances {
|
|
235
|
-
currency {
|
|
236
|
-
address
|
|
237
|
-
symbol
|
|
238
|
-
name
|
|
239
|
-
decimals
|
|
240
|
-
}
|
|
241
|
-
value
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
`
|
|
247
|
-
type BitQueryGetTokenPricesResponse = {
|
|
248
|
-
ethereum: {
|
|
249
|
-
dexTrades: {
|
|
250
|
-
baseCurrency: {
|
|
251
|
-
address: string
|
|
252
|
-
symbol: string
|
|
253
|
-
}
|
|
254
|
-
quoteCurrency: {
|
|
255
|
-
address: string
|
|
256
|
-
symbol: string
|
|
257
|
-
}
|
|
258
|
-
date: {
|
|
259
|
-
date: string
|
|
260
|
-
}
|
|
261
|
-
quotePrice: number
|
|
262
|
-
}[]
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
export type BitQueryGetTokenPricesVariables = {
|
|
266
|
-
after: string
|
|
267
|
-
network: BitqueryNetwork
|
|
268
|
-
}
|
|
269
|
-
export const bitqueryGetPricesQuery = gql<BitQueryGetTokenPricesResponse, BitQueryGetTokenPricesVariables>`
|
|
270
|
-
query getPrice($after: ISO8601DateTime!, $network: EthereumNetwork!) {
|
|
271
|
-
ethereum(network: $network) {
|
|
272
|
-
dexTrades(options: { desc: "date.date" }, time: { after: $after }) {
|
|
273
|
-
quoteCurrency(quoteCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }) {
|
|
274
|
-
symbol
|
|
275
|
-
address
|
|
276
|
-
}
|
|
277
|
-
baseCurrency {
|
|
278
|
-
symbol
|
|
279
|
-
address
|
|
280
|
-
}
|
|
281
|
-
date {
|
|
282
|
-
date
|
|
283
|
-
}
|
|
284
|
-
quotePrice
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
`
|
package/src/index.ts
DELETED
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|