@bigmi/core 0.6.3-alpha.1 → 0.6.3-alpha.2

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.
Files changed (43) hide show
  1. package/dist/cjs/version.d.ts +1 -1
  2. package/dist/cjs/version.js +1 -1
  3. package/dist/esm/version.d.ts +1 -1
  4. package/dist/esm/version.js +1 -1
  5. package/dist/types/version.d.ts +1 -1
  6. package/package.json +10 -1
  7. package/src/version.ts +1 -1
  8. package/.env +0 -4
  9. package/CHANGELOG.md +0 -158
  10. package/package.json.tmp +0 -73
  11. package/src/chains/signet.spec.ts +0 -33
  12. package/src/transports/ankr/__mocks__/getBalance/valid.json +0 -9
  13. package/src/transports/ankr/__mocks__/getTransactionFee/invalid.json +0 -3
  14. package/src/transports/ankr/__mocks__/getTransactionFee/valid.json +0 -51
  15. package/src/transports/ankr/__mocks__/getTransactions/valid.json +0 -1186
  16. package/src/transports/ankr/ankr.spec.ts +0 -103
  17. package/src/transports/blockchair/__mocks__/getBalance/invalidAddress.json +0 -29
  18. package/src/transports/blockchair/__mocks__/getBalance/valid.json +0 -29
  19. package/src/transports/blockchair/__mocks__/getBalance/zeroBalance.json +0 -29
  20. package/src/transports/blockchair/__mocks__/getTransactionFee/invalid.json +0 -7
  21. package/src/transports/blockchair/__mocks__/getTransactionFee/valid.json +0 -37
  22. package/src/transports/blockchair/__mocks__/getUTXOs/invalidAddress.json +0 -28
  23. package/src/transports/blockchair/__mocks__/getUTXOs/rateLimited.json +0 -28
  24. package/src/transports/blockchair/__mocks__/getUTXOs/valid.json +0 -95
  25. package/src/transports/blockchair/__mocks__/getUTXOs/validPaginated.json +0 -869
  26. package/src/transports/blockchair/blockchair.spec.ts +0 -284
  27. package/src/transports/blockcypher/__mocks__/getBalance/invalid.json +0 -3
  28. package/src/transports/blockcypher/__mocks__/getBalance/valid.json +0 -13
  29. package/src/transports/blockcypher/__mocks__/getTransactionFee/invalid.json +0 -3
  30. package/src/transports/blockcypher/__mocks__/getTransactionFee/valid.json +0 -22
  31. package/src/transports/blockcypher/__mocks__/getUTXOs/empty.json +0 -12
  32. package/src/transports/blockcypher/__mocks__/getUTXOs/paginated.json +0 -2786
  33. package/src/transports/blockcypher/__mocks__/getUTXOs/rateLimited.json +0 -3
  34. package/src/transports/blockcypher/__mocks__/getUTXOs/valid.json +0 -27
  35. package/src/transports/blockcypher/blockcyper.spec.ts +0 -161
  36. package/src/transports/fallback.spec.ts +0 -128
  37. package/src/transports/mempool/__mocks__/getBalance/invalid.json +0 -1
  38. package/src/transports/mempool/__mocks__/getBalance/valid.json +0 -17
  39. package/src/transports/mempool/__mocks__/getTransactionFee/invalid.json +0 -1
  40. package/src/transports/mempool/__mocks__/getTransactionFee/valid.json +0 -58
  41. package/src/transports/mempool/__mocks__/getTransactions/valid.json +0 -1268
  42. package/src/transports/mempool/mempool.spec.ts +0 -126
  43. package/tsconfig.json +0 -12
@@ -1,103 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { getBalance } from '../../actions/getBalance.js'
3
- import { getTransactionFee } from '../../actions/getTransactionFee.js'
4
- import { getTransactions } from '../../actions/getTransactions.js'
5
- import { bitcoin } from '../../chains/bitcoin.js'
6
- import { createClient, rpcSchema } from '../../factories/createClient.js'
7
- import { createMockResponse } from '../../test/utils.js'
8
- import {
9
- INVALID_TX_ID,
10
- TX_FEE,
11
- VALID_TX_ID,
12
- } from '../__mocks__/getTransactionFee.js'
13
- import type { UTXOSchema } from '../types.js'
14
- import getBalanceResponse from './__mocks__/getBalance/valid.json'
15
- import getInValidTransactionFeeResponse from './__mocks__/getTransactionFee/invalid.json'
16
- import getValidTransactionFeeResponse from './__mocks__/getTransactionFee/valid.json'
17
- import getTransactionsValidResponse from './__mocks__/getTransactions/valid.json'
18
- import { ankr } from './ankr.js'
19
- import type {
20
- AnkrAddressWithTxnsResponse,
21
- AnkrBalanceResponse,
22
- AnkrTxnResponse,
23
- } from './ankr.types.js'
24
-
25
- const ANKR_KEY = import.meta.env.VITE_TEST_ANKR_KEY
26
- const address = import.meta.env.VITE_TEST_ADDRESS
27
-
28
- const USE_MOCK = true
29
-
30
- const publicClient = createClient({
31
- chain: bitcoin,
32
- rpcSchema: rpcSchema<UTXOSchema>(),
33
- transport: ankr({ apiKey: ANKR_KEY }),
34
- })
35
-
36
- describe('Ankr Transport', () => {
37
- beforeEach(() => {
38
- vi.restoreAllMocks()
39
- })
40
-
41
- describe('getBalance action', async () => {
42
- vi.spyOn(global, 'fetch').mockResolvedValue(
43
- createMockResponse(getBalanceResponse as AnkrBalanceResponse)
44
- )
45
- const balance = await getBalance(publicClient, { address })
46
- it('should fetch correct balance', () => {
47
- expect(balance).toBeTypeOf('bigint')
48
- })
49
- })
50
-
51
- describe('getTransactionFee action', async () => {
52
- it('should get transaction fee', async () => {
53
- if (USE_MOCK) {
54
- getValidTransactionFeeResponse.txid = VALID_TX_ID
55
- getValidTransactionFeeResponse.fees = TX_FEE
56
-
57
- vi.spyOn(global, 'fetch').mockResolvedValue(
58
- createMockResponse(
59
- getValidTransactionFeeResponse as unknown as AnkrTxnResponse
60
- )
61
- )
62
- }
63
-
64
- const result = await getTransactionFee(publicClient, {
65
- txId: VALID_TX_ID,
66
- })
67
- expect(result).toBeDefined()
68
- expect(result).toBe(BigInt(TX_FEE))
69
- })
70
-
71
- it('should throw error when txid is invalid', async () => {
72
- if (USE_MOCK) {
73
- vi.spyOn(global, 'fetch').mockResolvedValue(
74
- createMockResponse(
75
- getInValidTransactionFeeResponse as unknown as AnkrTxnResponse
76
- )
77
- )
78
- }
79
- await expect(
80
- getTransactionFee(publicClient, { txId: INVALID_TX_ID })
81
- ).rejects.toThrowError()
82
- })
83
- })
84
-
85
- describe('getTransactions action', async () => {
86
- it('should get transactions', async () => {
87
- vi.spyOn(global, 'fetch').mockResolvedValue(
88
- createMockResponse(
89
- getTransactionsValidResponse as unknown as AnkrAddressWithTxnsResponse
90
- )
91
- )
92
- const results = await getTransactions(publicClient, {
93
- address,
94
- limit: 100,
95
- })
96
- const { transactions } = results
97
- expect(transactions.length > 0)
98
- expect(transactions[0]).toHaveProperty('hash')
99
- expect(transactions[0]).toHaveProperty('vout')
100
- expect(transactions[0]).toHaveProperty('vin')
101
- })
102
- })
103
- })
@@ -1,29 +0,0 @@
1
- {
2
- "data": [],
3
- "context": {
4
- "code": 200,
5
- "source": "A",
6
- "results": 0,
7
- "state": 897406,
8
- "market_price_usd": 103002,
9
- "cache": {
10
- "live": true,
11
- "duration": 120,
12
- "since": "2025-05-19 11:43:01",
13
- "until": "2025-05-19 11:45:01",
14
- "time": null
15
- },
16
- "api": {
17
- "version": "2.0.95-ie",
18
- "last_major_update": "2022-11-07 02:00:00",
19
- "next_major_update": "2023-11-12 02:00:00",
20
- "documentation": "https://blockchair.com/api/docs",
21
- "notice": "Try out our new API v.3: https://3xpl.com/data"
22
- },
23
- "servers": "API4,BTC5",
24
- "time": 0.7667789459228516,
25
- "render_time": 0.012541055679321289,
26
- "full_time": 0.7793200016021729,
27
- "request_cost": 1.001
28
- }
29
- }
@@ -1,29 +0,0 @@
1
- {
2
- "data": { "bc1qpvk0kjdg0kantu9z78qz7gqk53q643auz33yaw": 33206 },
3
- "context": {
4
- "code": 200,
5
- "source": "A",
6
- "results": 1,
7
- "state": 897404,
8
- "market_price_usd": 102998,
9
- "cache": {
10
- "live": true,
11
- "duration": 120,
12
- "since": "2025-05-19 11:19:49",
13
- "until": "2025-05-19 11:21:49",
14
- "time": null
15
- },
16
- "api": {
17
- "version": "2.0.95-ie",
18
- "last_major_update": "2022-11-07 02:00:00",
19
- "next_major_update": "2023-11-12 02:00:00",
20
- "documentation": "https://blockchair.com/api/docs",
21
- "notice": "Try out our new API v.3: https://3xpl.com/data"
22
- },
23
- "servers": "API4,BTC5",
24
- "time": 0.6847109794616699,
25
- "render_time": 0.012706995010375977,
26
- "full_time": 0.6974179744720459,
27
- "request_cost": 1.001
28
- }
29
- }
@@ -1,29 +0,0 @@
1
- {
2
- "data": [],
3
- "context": {
4
- "code": 200,
5
- "source": "A",
6
- "results": 0,
7
- "state": 916465,
8
- "market_price_usd": 109158,
9
- "cache": {
10
- "live": true,
11
- "duration": 120,
12
- "since": "2025-09-26 10:32:00",
13
- "until": "2025-09-26 10:34:00",
14
- "time": null
15
- },
16
- "api": {
17
- "version": "2.0.95-ie",
18
- "last_major_update": "2022-11-07 02:00:00",
19
- "next_major_update": "2023-11-12 02:00:00",
20
- "documentation": "https://blockchair.com/api/docs",
21
- "notice": "Try out our new API v.3: https://3xpl.com/data"
22
- },
23
- "servers": "API4,BTC5",
24
- "time": 1.4955880641937256,
25
- "render_time": 0.014816761016845703,
26
- "full_time": 1.5104048252105713,
27
- "request_cost": 1.001
28
- }
29
- }
@@ -1,7 +0,0 @@
1
- {
2
- "data": {},
3
- "context": {
4
- "code": 404,
5
- "error": "Transaction not found"
6
- }
7
- }
@@ -1,37 +0,0 @@
1
- {
2
- "data": {
3
- "8f210660cd99c5e6dc77b6cb09d4d522d3fbc5fd97ad3e65403d49aa7aa5dc23": {
4
- "transaction": {
5
- "block_id": 896390,
6
- "id": 123456,
7
- "hash": "8f210660cd99c5e6dc77b6cb09d4d522d3fbc5fd97ad3e65403d49aa7aa5dc23",
8
- "date": "2024-03-15",
9
- "time": "12:00:00",
10
- "size": 450,
11
- "weight": 1149,
12
- "version": 1,
13
- "lock_time": 0,
14
- "is_coinbase": false,
15
- "has_witness": true,
16
- "input_count": 2,
17
- "output_count": 3,
18
- "input_total": 10269002928,
19
- "input_total_usd": 102690.02928,
20
- "output_total": 10269001908,
21
- "output_total_usd": 102690.01908,
22
- "fee": 1020,
23
- "fee_usd": 1.02,
24
- "fee_per_kb": 2266,
25
- "fee_per_kb_usd": 2.266,
26
- "fee_per_kwu": 887,
27
- "fee_per_kwu_usd": 0.887,
28
- "cdd_total": 0,
29
- "is_rbf": false
30
- }
31
- }
32
- },
33
- "context": {
34
- "code": 200,
35
- "error": null
36
- }
37
- }
@@ -1,28 +0,0 @@
1
- {
2
- "data": null,
3
- "context": {
4
- "code": 404,
5
- "optimized": false,
6
- "error": "We couldn't find any of the addresses",
7
- "market_price_usd": 102926,
8
- "cache": {
9
- "live": true,
10
- "duration": 120,
11
- "since": "2025-05-19 12:22:44",
12
- "until": "2025-05-19 12:24:44",
13
- "time": null
14
- },
15
- "api": {
16
- "version": "2.0.95-ie",
17
- "last_major_update": "2022-11-07 02:00:00",
18
- "next_major_update": "2023-11-12 02:00:00",
19
- "documentation": "https://blockchair.com/api/docs",
20
- "notice": "Try out our new API v.3: https://3xpl.com/data"
21
- },
22
- "servers": "API4,BTC5",
23
- "time": 1.0055019855499268,
24
- "render_time": 0.01248788833618164,
25
- "full_time": 1.0179898738861084,
26
- "request_cost": 1
27
- }
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- "data": null,
3
- "context": {
4
- "code": 429,
5
- "optimized": false,
6
- "error": "Rate limit exceeded",
7
- "market_price_usd": 102926,
8
- "cache": {
9
- "live": true,
10
- "duration": 120,
11
- "since": "2025-05-19 12:22:44",
12
- "until": "2025-05-19 12:24:44",
13
- "time": null
14
- },
15
- "api": {
16
- "version": "2.0.95-ie",
17
- "last_major_update": "2022-11-07 02:00:00",
18
- "next_major_update": "2023-11-12 02:00:00",
19
- "documentation": "https://blockchair.com/api/docs",
20
- "notice": "Try out our new API v.3: https://3xpl.com/data"
21
- },
22
- "servers": "API4,BTC5",
23
- "time": 1.0055019855499268,
24
- "render_time": 0.01248788833618164,
25
- "full_time": 1.0179898738861084,
26
- "request_cost": 0
27
- }
28
- }
@@ -1,95 +0,0 @@
1
- {
2
- "data": {
3
- "set": {
4
- "address_count": 1,
5
- "balance": 33206,
6
- "balance_usd": 34.19520674,
7
- "received": 424052,
8
- "spent": 390846,
9
- "output_count": 18,
10
- "unspent_output_count": 1,
11
- "first_seen_receiving": "2025-02-19 16:23:59",
12
- "last_seen_receiving": "2025-05-16 19:17:40",
13
- "first_seen_spending": "2025-02-21 09:12:18",
14
- "last_seen_spending": "2025-05-16 19:17:40",
15
- "transaction_count": 19
16
- },
17
- "addresses": {
18
- "bc1qpvk0kjdg0kantu9z78qz7gqk53q643auz33yaw": {
19
- "type": "witness_v0_scripthash",
20
- "script_hex": "00140b2cfb49a87dbb35f0a2f1c02f2016a441aac7bc",
21
- "balance": 33206,
22
- "balance_usd": 34.19520674,
23
- "received": 424052,
24
- "received_usd": 387.6347,
25
- "spent": 390846,
26
- "spent_usd": 355.7633,
27
- "output_count": 18,
28
- "unspent_output_count": 1,
29
- "first_seen_receiving": "2025-02-19 16:23:59",
30
- "last_seen_receiving": "2025-05-16 19:17:40",
31
- "first_seen_spending": "2025-02-21 09:12:18",
32
- "last_seen_spending": "2025-05-16 19:17:40"
33
- }
34
- },
35
- "transactions": [
36
- "4b6ee974f1dd179071d027562e1fd1c83965efa4a171ec84f00b6c638e36fa4e",
37
- "e77cbe6d061f43672968834bce324a1984797f5cfbb463697df238bd385917be",
38
- "6fb47290d31b4601e9882dafaf446c4ad412ba7ef875f25a274b1dd0db22c087",
39
- "0901dfa8f1576586b481918d623ac6677d7d7ca6bdec108683853cfe220f5bd5",
40
- "1438c9115f819b42213e64628be549e5b57f6a3920a0f2de74c36dcb38e20273",
41
- "9ad7e397142514c5c73a576bd4d0c4e0b630e678e53f197fa4b0e94dfcdace71",
42
- "4dc7273ad40053046b8000325fe2512dfdc08495969662b78cd77e9997fa08de",
43
- "cb6567b37e741055b2f63b96697a882719760a74109f156f19653fa9117b8fb5",
44
- "18d8089743078c7660e9ab04871193d649c9696fc7c3cb7adbb31f7c388d34a5",
45
- "e7a25c215a75057a849a3f1be47e3fc37fc4c6f9579d8760c487229ee57ebec0",
46
- "b64f157ba8473ad12c598a973e35283c8070e662f6c6927a2550175fd491b1c5",
47
- "c38a0df6ccd23945180558ffb7c0c0f041e311994a6cb590b37568dbe3d5a309",
48
- "8f210660cd99c5e6dc77b6cb09d4d522d3fbc5fd97ad3e65403d49aa7aa5dc23",
49
- "a76c4e97ca7becbaa7fc3e47ecb6e2f5abc0e8a82a47b5a32661769c17903c3d",
50
- "bc03f829054f68279efb328f3f16c00f6c3be2465b10fe75180ea468475b70e8",
51
- "57db1a9db8f2da0f05d0ec3b055c19c6ab8df5e6bc35142bff122c5933a2f958",
52
- "fdce2091a5b477aa889a114d4959b51b7026562983837e9b16d780111ddf0ecb",
53
- "40f3c3bf567ee8caea4bd4209f42325285a12c5127666f203ec33d725317aad4",
54
- "c947acaef3cc7b3bf15447e7c992394a489df623d27ca4c925d8b4444374e913"
55
- ],
56
- "utxo": [
57
- {
58
- "block_id": 897002,
59
- "transaction_hash": "4b6ee974f1dd179071d027562e1fd1c83965efa4a171ec84f00b6c638e36fa4e",
60
- "index": 2,
61
- "value": 33206,
62
- "address": "bc1qpvk0kjdg0kantu9z78qz7gqk53q643auz33yaw"
63
- }
64
- ]
65
- },
66
- "context": {
67
- "code": 200,
68
- "source": "D",
69
- "limit": "100,100",
70
- "offset": "0,0",
71
- "results": 1,
72
- "optimized": false,
73
- "state": 897410,
74
- "market_price_usd": 102979,
75
- "cache": {
76
- "live": true,
77
- "duration": 120,
78
- "since": "2025-05-19 12:11:47",
79
- "until": "2025-05-19 12:13:47",
80
- "time": null
81
- },
82
- "api": {
83
- "version": "2.0.95-ie",
84
- "last_major_update": "2022-11-07 02:00:00",
85
- "next_major_update": "2023-11-12 02:00:00",
86
- "documentation": "https://blockchair.com/api/docs",
87
- "notice": "Try out our new API v.3: https://3xpl.com/data"
88
- },
89
- "servers": "API4,BTC5",
90
- "time": 1.095700979232788,
91
- "render_time": 0.056569814682006836,
92
- "full_time": 1.152270793914795,
93
- "request_cost": 1
94
- }
95
- }