hive-stream 3.0.2 → 3.0.3

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 (197) hide show
  1. package/DOCUMENTATION.md +50 -2
  2. package/README.md +44 -3
  3. package/dist/adapters/base.adapter.d.ts +5 -0
  4. package/dist/adapters/base.adapter.js +9 -0
  5. package/dist/adapters/base.adapter.js.map +1 -1
  6. package/dist/adapters/mongodb.adapter.d.ts +6 -6
  7. package/dist/adapters/mongodb.adapter.js +36 -21
  8. package/dist/adapters/mongodb.adapter.js.map +1 -1
  9. package/dist/adapters/postgresql.adapter.d.ts +7 -0
  10. package/dist/adapters/postgresql.adapter.js +46 -19
  11. package/dist/adapters/postgresql.adapter.js.map +1 -1
  12. package/dist/adapters/sqlite.adapter.d.ts +4 -0
  13. package/dist/adapters/sqlite.adapter.js +10 -0
  14. package/dist/adapters/sqlite.adapter.js.map +1 -1
  15. package/dist/api.d.ts +13 -3
  16. package/dist/api.js +96 -62
  17. package/dist/api.js.map +1 -1
  18. package/dist/config.d.ts +7 -1
  19. package/dist/config.js +7 -1
  20. package/dist/config.js.map +1 -1
  21. package/dist/contracts/auctionhouse.contract.d.ts +4 -0
  22. package/dist/contracts/auctionhouse.contract.js +234 -0
  23. package/dist/contracts/auctionhouse.contract.js.map +1 -0
  24. package/dist/contracts/booking.contract.d.ts +4 -0
  25. package/dist/contracts/booking.contract.js +225 -0
  26. package/dist/contracts/booking.contract.js.map +1 -0
  27. package/dist/contracts/bountyboard.contract.d.ts +4 -0
  28. package/dist/contracts/bountyboard.contract.js +233 -0
  29. package/dist/contracts/bountyboard.contract.js.map +1 -0
  30. package/dist/contracts/bundlemarketplace.contract.d.ts +4 -0
  31. package/dist/contracts/bundlemarketplace.contract.js +195 -0
  32. package/dist/contracts/bundlemarketplace.contract.js.map +1 -0
  33. package/dist/contracts/charitymatch.contract.d.ts +4 -0
  34. package/dist/contracts/charitymatch.contract.js +172 -0
  35. package/dist/contracts/charitymatch.contract.js.map +1 -0
  36. package/dist/contracts/coinflip.contract.js +7 -1
  37. package/dist/contracts/coinflip.contract.js.map +1 -1
  38. package/dist/contracts/crowdfund.contract.d.ts +4 -0
  39. package/dist/contracts/crowdfund.contract.js +290 -0
  40. package/dist/contracts/crowdfund.contract.js.map +1 -0
  41. package/dist/contracts/dcabot.contract.d.ts +4 -0
  42. package/dist/contracts/dcabot.contract.js +217 -0
  43. package/dist/contracts/dcabot.contract.js.map +1 -0
  44. package/dist/contracts/dice.contract.js +7 -1
  45. package/dist/contracts/dice.contract.js.map +1 -1
  46. package/dist/contracts/domainregistry.contract.d.ts +4 -0
  47. package/dist/contracts/domainregistry.contract.js +232 -0
  48. package/dist/contracts/domainregistry.contract.js.map +1 -0
  49. package/dist/contracts/exchange.contract.js +209 -168
  50. package/dist/contracts/exchange.contract.js.map +1 -1
  51. package/dist/contracts/fanclub.contract.d.ts +4 -0
  52. package/dist/contracts/fanclub.contract.js +193 -0
  53. package/dist/contracts/fanclub.contract.js.map +1 -0
  54. package/dist/contracts/giftcard.contract.d.ts +4 -0
  55. package/dist/contracts/giftcard.contract.js +158 -0
  56. package/dist/contracts/giftcard.contract.js.map +1 -0
  57. package/dist/contracts/grantrounds.contract.d.ts +4 -0
  58. package/dist/contracts/grantrounds.contract.js +265 -0
  59. package/dist/contracts/grantrounds.contract.js.map +1 -0
  60. package/dist/contracts/groupbuy.contract.d.ts +4 -0
  61. package/dist/contracts/groupbuy.contract.js +198 -0
  62. package/dist/contracts/groupbuy.contract.js.map +1 -0
  63. package/dist/contracts/helpers.d.ts +64 -0
  64. package/dist/contracts/helpers.js +159 -0
  65. package/dist/contracts/helpers.js.map +1 -0
  66. package/dist/contracts/insurancepool.contract.d.ts +4 -0
  67. package/dist/contracts/insurancepool.contract.js +281 -0
  68. package/dist/contracts/insurancepool.contract.js.map +1 -0
  69. package/dist/contracts/invoice.contract.d.ts +4 -0
  70. package/dist/contracts/invoice.contract.js +193 -0
  71. package/dist/contracts/invoice.contract.js.map +1 -0
  72. package/dist/contracts/launchpad.contract.d.ts +4 -0
  73. package/dist/contracts/launchpad.contract.js +225 -0
  74. package/dist/contracts/launchpad.contract.js.map +1 -0
  75. package/dist/contracts/lotto.contract.js +53 -37
  76. package/dist/contracts/lotto.contract.js.map +1 -1
  77. package/dist/contracts/multisigtreasury.contract.d.ts +4 -0
  78. package/dist/contracts/multisigtreasury.contract.js +245 -0
  79. package/dist/contracts/multisigtreasury.contract.js.map +1 -0
  80. package/dist/contracts/nft.contract.d.ts +1 -0
  81. package/dist/contracts/nft.contract.js +236 -192
  82. package/dist/contracts/nft.contract.js.map +1 -1
  83. package/dist/contracts/oraclebounty.contract.d.ts +4 -0
  84. package/dist/contracts/oraclebounty.contract.js +250 -0
  85. package/dist/contracts/oraclebounty.contract.js.map +1 -0
  86. package/dist/contracts/payroll.contract.d.ts +4 -0
  87. package/dist/contracts/payroll.contract.js +232 -0
  88. package/dist/contracts/payroll.contract.js.map +1 -0
  89. package/dist/contracts/paywall.contract.d.ts +4 -0
  90. package/dist/contracts/paywall.contract.js +185 -0
  91. package/dist/contracts/paywall.contract.js.map +1 -0
  92. package/dist/contracts/poll.contract.js +2 -0
  93. package/dist/contracts/poll.contract.js.map +1 -1
  94. package/dist/contracts/predictionmarket.contract.d.ts +4 -0
  95. package/dist/contracts/predictionmarket.contract.js +213 -0
  96. package/dist/contracts/predictionmarket.contract.js.map +1 -0
  97. package/dist/contracts/proposaltimelock.contract.d.ts +4 -0
  98. package/dist/contracts/proposaltimelock.contract.js +250 -0
  99. package/dist/contracts/proposaltimelock.contract.js.map +1 -0
  100. package/dist/contracts/questpass.contract.d.ts +4 -0
  101. package/dist/contracts/questpass.contract.js +214 -0
  102. package/dist/contracts/questpass.contract.js.map +1 -0
  103. package/dist/contracts/referral.contract.d.ts +4 -0
  104. package/dist/contracts/referral.contract.js +238 -0
  105. package/dist/contracts/referral.contract.js.map +1 -0
  106. package/dist/contracts/rental.contract.d.ts +4 -0
  107. package/dist/contracts/rental.contract.js +221 -0
  108. package/dist/contracts/rental.contract.js.map +1 -0
  109. package/dist/contracts/revenuesplit.contract.d.ts +4 -0
  110. package/dist/contracts/revenuesplit.contract.js +211 -0
  111. package/dist/contracts/revenuesplit.contract.js.map +1 -0
  112. package/dist/contracts/rps.contract.js +17 -1
  113. package/dist/contracts/rps.contract.js.map +1 -1
  114. package/dist/contracts/savings.contract.d.ts +4 -0
  115. package/dist/contracts/savings.contract.js +208 -0
  116. package/dist/contracts/savings.contract.js.map +1 -0
  117. package/dist/contracts/subscription.contract.d.ts +4 -0
  118. package/dist/contracts/subscription.contract.js +241 -0
  119. package/dist/contracts/subscription.contract.js.map +1 -0
  120. package/dist/contracts/sweepstakes.contract.d.ts +4 -0
  121. package/dist/contracts/sweepstakes.contract.js +209 -0
  122. package/dist/contracts/sweepstakes.contract.js.map +1 -0
  123. package/dist/contracts/ticketing.contract.d.ts +4 -0
  124. package/dist/contracts/ticketing.contract.js +185 -0
  125. package/dist/contracts/ticketing.contract.js.map +1 -0
  126. package/dist/contracts/tipjar.contract.js +2 -0
  127. package/dist/contracts/tipjar.contract.js.map +1 -1
  128. package/dist/contracts/token.contract.js +135 -125
  129. package/dist/contracts/token.contract.js.map +1 -1
  130. package/dist/index.d.ts +39 -0
  131. package/dist/index.js +71 -1
  132. package/dist/index.js.map +1 -1
  133. package/dist/metadata.d.ts +7 -0
  134. package/dist/metadata.js +64 -1
  135. package/dist/metadata.js.map +1 -1
  136. package/dist/providers/block-provider.d.ts +22 -0
  137. package/dist/providers/block-provider.js +3 -0
  138. package/dist/providers/block-provider.js.map +1 -0
  139. package/dist/providers/haf-client.d.ts +30 -0
  140. package/dist/providers/haf-client.js +119 -0
  141. package/dist/providers/haf-client.js.map +1 -0
  142. package/dist/providers/haf-provider.d.ts +49 -0
  143. package/dist/providers/haf-provider.js +256 -0
  144. package/dist/providers/haf-provider.js.map +1 -0
  145. package/dist/providers/hive-provider.d.ts +13 -0
  146. package/dist/providers/hive-provider.js +25 -0
  147. package/dist/providers/hive-provider.js.map +1 -0
  148. package/dist/providers/index.d.ts +4 -0
  149. package/dist/providers/index.js +21 -0
  150. package/dist/providers/index.js.map +1 -0
  151. package/dist/streamer.d.ts +21 -1
  152. package/dist/streamer.js +187 -62
  153. package/dist/streamer.js.map +1 -1
  154. package/dist/utils.js +11 -2
  155. package/dist/utils.js.map +1 -1
  156. package/package.json +16 -1
  157. package/.claude/settings.local.json +0 -12
  158. package/.env.example +0 -3
  159. package/.travis.yml +0 -11
  160. package/AGENTS.md +0 -35
  161. package/CLAUDE.md +0 -75
  162. package/ecosystem.config.js +0 -17
  163. package/examples/contracts/README.md +0 -8
  164. package/examples/contracts/exchange.ts +0 -38
  165. package/examples/contracts/poll.ts +0 -21
  166. package/examples/contracts/rps.ts +0 -19
  167. package/examples/contracts/tipjar.ts +0 -19
  168. package/jest.config.js +0 -9
  169. package/test-contract-block.md +0 -19
  170. package/tests/actions.spec.ts +0 -252
  171. package/tests/adapters/actions-persistence.spec.ts +0 -144
  172. package/tests/adapters/postgresql.adapter.spec.ts +0 -127
  173. package/tests/adapters/sqlite.adapter.spec.ts +0 -181
  174. package/tests/config-input.spec.ts +0 -90
  175. package/tests/contracts/coinflip.contract.spec.ts +0 -94
  176. package/tests/contracts/dice.contract.spec.ts +0 -87
  177. package/tests/contracts/entrants.json +0 -729
  178. package/tests/contracts/exchange.contract.spec.ts +0 -84
  179. package/tests/contracts/lotto.contract.spec.ts +0 -59
  180. package/tests/contracts/nft.contract.spec.ts +0 -948
  181. package/tests/contracts/token.contract.spec.ts +0 -90
  182. package/tests/exchanges/coingecko.exchange.spec.ts +0 -169
  183. package/tests/exchanges/exchange.base.spec.ts +0 -246
  184. package/tests/helpers/mock-adapter.ts +0 -214
  185. package/tests/helpers/mock-fetch.ts +0 -165
  186. package/tests/hive-chain-features.spec.ts +0 -319
  187. package/tests/hive-rates.spec.ts +0 -443
  188. package/tests/integration/hive-rates.integration.spec.ts +0 -35
  189. package/tests/metadata.spec.ts +0 -63
  190. package/tests/setup.ts +0 -30
  191. package/tests/streamer-actions.spec.ts +0 -274
  192. package/tests/streamer.spec.ts +0 -342
  193. package/tests/types/rates.spec.ts +0 -216
  194. package/tests/utils.spec.ts +0 -113
  195. package/tsconfig.build.json +0 -4
  196. package/tslint.json +0 -21
  197. package/wallaby.js +0 -26
@@ -1,216 +0,0 @@
1
- import {
2
- RatesError,
3
- NetworkError,
4
- ValidationError,
5
- ExchangeRates,
6
- HiveRates,
7
- CryptoRates,
8
- ExchangeResponse,
9
- FiatResponse,
10
- RateConfig,
11
- CurrencyPair,
12
- SupportedCrypto,
13
- SupportedFiat
14
- } from '../../src/types/rates';
15
-
16
- describe('Types and Error Classes', () => {
17
- describe('RatesError', () => {
18
- it('should create basic RatesError', () => {
19
- const error = new RatesError('Test message', 'TEST_CODE');
20
-
21
- expect(error.message).toBe('Test message');
22
- expect(error.code).toBe('TEST_CODE');
23
- expect(error.name).toBe('RatesError');
24
- expect(error.source).toBeUndefined();
25
- });
26
-
27
- it('should create RatesError with source', () => {
28
- const error = new RatesError('Test message', 'TEST_CODE', 'test-source');
29
-
30
- expect(error.source).toBe('test-source');
31
- });
32
-
33
- it('should be instance of Error', () => {
34
- const error = new RatesError('Test', 'CODE');
35
- expect(error).toBeInstanceOf(Error);
36
- expect(error).toBeInstanceOf(RatesError);
37
- });
38
- });
39
-
40
- describe('NetworkError', () => {
41
- it('should create NetworkError', () => {
42
- const error = new NetworkError('Network failed');
43
-
44
- expect(error.message).toBe('Network failed');
45
- expect(error.code).toBe('NETWORK_ERROR');
46
- expect(error.name).toBe('NetworkError');
47
- });
48
-
49
- it('should create NetworkError with source', () => {
50
- const error = new NetworkError('Network failed', 'api-endpoint');
51
-
52
- expect(error.source).toBe('api-endpoint');
53
- });
54
-
55
- it('should be instance of RatesError', () => {
56
- const error = new NetworkError('Test');
57
- expect(error).toBeInstanceOf(Error);
58
- expect(error).toBeInstanceOf(RatesError);
59
- expect(error).toBeInstanceOf(NetworkError);
60
- });
61
- });
62
-
63
- describe('ValidationError', () => {
64
- it('should create ValidationError', () => {
65
- const error = new ValidationError('Invalid data');
66
-
67
- expect(error.message).toBe('Invalid data');
68
- expect(error.code).toBe('VALIDATION_ERROR');
69
- expect(error.name).toBe('ValidationError');
70
- });
71
-
72
- it('should create ValidationError with source', () => {
73
- const error = new ValidationError('Invalid data', 'response-parser');
74
-
75
- expect(error.source).toBe('response-parser');
76
- });
77
-
78
- it('should be instance of RatesError', () => {
79
- const error = new ValidationError('Test');
80
- expect(error).toBeInstanceOf(Error);
81
- expect(error).toBeInstanceOf(RatesError);
82
- expect(error).toBeInstanceOf(ValidationError);
83
- });
84
- });
85
-
86
- describe('Type Definitions', () => {
87
- it('should accept valid ExchangeRates', () => {
88
- const rates: ExchangeRates = {
89
- EUR: 0.85,
90
- GBP: 0.73,
91
- JPY: 110
92
- };
93
-
94
- expect(typeof rates.EUR).toBe('number');
95
- expect(typeof rates.GBP).toBe('number');
96
- expect(typeof rates.JPY).toBe('number');
97
- });
98
-
99
- it('should accept valid HiveRates', () => {
100
- const rates: HiveRates = {
101
- 'USD_EUR': 0.85,
102
- 'EUR_HIVE': 0.425,
103
- 'GBP_HBD': 0.73
104
- };
105
-
106
- expect(typeof rates['USD_EUR']).toBe('number');
107
- expect(typeof rates['EUR_HIVE']).toBe('number');
108
- expect(typeof rates['GBP_HBD']).toBe('number');
109
- });
110
-
111
- it('should accept valid CryptoRates', () => {
112
- const rates: CryptoRates = {
113
- usdHive: 0.5,
114
- usdHbd: 1.0
115
- };
116
-
117
- expect(rates.usdHive).toBe(0.5);
118
- expect(rates.usdHbd).toBe(1.0);
119
- });
120
-
121
- it('should accept valid ExchangeResponse', () => {
122
- const successResponse: ExchangeResponse = {
123
- success: true,
124
- rates: { usdHive: 0.5, usdHbd: 1.0 }
125
- };
126
-
127
- const errorResponse: ExchangeResponse = {
128
- success: false,
129
- error: 'API failed'
130
- };
131
-
132
- expect(successResponse.success).toBe(true);
133
- expect(successResponse.rates).toBeDefined();
134
- expect(errorResponse.success).toBe(false);
135
- expect(errorResponse.error).toBe('API failed');
136
- });
137
-
138
- it('should accept valid FiatResponse', () => {
139
- const successResponse: FiatResponse = {
140
- success: true,
141
- rates: { EUR: 0.85, GBP: 0.73 }
142
- };
143
-
144
- const errorResponse: FiatResponse = {
145
- success: false,
146
- error: 'API failed'
147
- };
148
-
149
- expect(successResponse.success).toBe(true);
150
- expect(successResponse.rates).toBeDefined();
151
- expect(errorResponse.success).toBe(false);
152
- expect(errorResponse.error).toBe('API failed');
153
- });
154
-
155
- it('should accept valid RateConfig', () => {
156
- const config: RateConfig = {
157
- cacheDuration: 3600000,
158
- maxRetries: 3,
159
- retryDelay: 1000,
160
- timeout: 10000
161
- };
162
-
163
- expect(config.cacheDuration).toBe(3600000);
164
- expect(config.maxRetries).toBe(3);
165
- expect(config.retryDelay).toBe(1000);
166
- expect(config.timeout).toBe(10000);
167
- });
168
-
169
- it('should accept partial RateConfig', () => {
170
- const config: RateConfig = {
171
- cacheDuration: 5000
172
- };
173
-
174
- expect(config.cacheDuration).toBe(5000);
175
- expect(config.maxRetries).toBeUndefined();
176
- });
177
-
178
- it('should work with CurrencyPair type', () => {
179
- const pair1: CurrencyPair = 'USD_EUR';
180
- const pair2: CurrencyPair = 'EUR_HIVE';
181
- const pair3: CurrencyPair = 'GBP_HBD';
182
-
183
- expect(pair1).toBe('USD_EUR');
184
- expect(pair2).toBe('EUR_HIVE');
185
- expect(pair3).toBe('GBP_HBD');
186
- });
187
-
188
- it('should work with SupportedCrypto type', () => {
189
- const crypto1: SupportedCrypto = 'HIVE';
190
- const crypto2: SupportedCrypto = 'HBD';
191
-
192
- expect(crypto1).toBe('HIVE');
193
- expect(crypto2).toBe('HBD');
194
- });
195
-
196
- it('should work with SupportedFiat type', () => {
197
- const fiat1: SupportedFiat = 'USD';
198
- const fiat2: SupportedFiat = 'EUR';
199
- const fiat3: SupportedFiat = 'GBP';
200
- const fiat4: SupportedFiat = 'JPY';
201
- const fiat5: SupportedFiat = 'CAD';
202
- const fiat6: SupportedFiat = 'AUD';
203
- const fiat7: SupportedFiat = 'CHF';
204
- const fiat8: SupportedFiat = 'CNY';
205
-
206
- expect(fiat1).toBe('USD');
207
- expect(fiat2).toBe('EUR');
208
- expect(fiat3).toBe('GBP');
209
- expect(fiat4).toBe('JPY');
210
- expect(fiat5).toBe('CAD');
211
- expect(fiat6).toBe('AUD');
212
- expect(fiat7).toBe('CHF');
213
- expect(fiat8).toBe('CNY');
214
- });
215
- });
216
- });
@@ -1,113 +0,0 @@
1
- import { Utils } from './../src/utils';
2
-
3
- describe('Utils', () => {
4
-
5
- describe('Round Precision', () => {
6
- test('Properly rounds precision of number to 3 places', () => {
7
- const value = 99.299223;
8
-
9
- expect(Utils.roundPrecision(value, 3)).toStrictEqual(99.299);
10
- });
11
-
12
- test('Properly rounds precision of number up and to 3 places', () => {
13
- const value = 99.2966;
14
-
15
- expect(Utils.roundPrecision(value, 3)).toStrictEqual(99.297);
16
- });
17
-
18
- test('Invalid numeric values passed', () => {
19
- expect(Utils.roundPrecision('dasd' as any, 3)).toBeNaN();
20
- });
21
- });
22
-
23
- test('Should generate two deterministic numbers', () => {
24
- // Should generate a deterministic random number
25
- expect(Utils.randomNumber('dasdasdas', '2312fsdfsdfsdf', 'kfjlksdjflksdjf999')).toStrictEqual(26);
26
-
27
- expect(Utils.randomNumber('fdfsdfsdfsdfsf', '2312fsdfsdfsdf', 'kfjlksdjflksdjf999')).toStrictEqual(43);
28
- });
29
-
30
- test('Should shuffle array in a non-deterministic way', () => {
31
- const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
32
- const arrayCloned = [...array];
33
-
34
- Utils.shuffle(array);
35
-
36
- expect(array).not.toMatchObject(arrayCloned);
37
- });
38
-
39
- describe('Generate String', () => {
40
- test('Generates a memo 6 characters in length', () => {
41
- expect(Utils.randomString(6)).toHaveLength(6);
42
- });
43
-
44
- test('Generates a memo using default 12 character length', () => {
45
- expect(Utils.randomString()).toHaveLength(12);
46
- });
47
- });
48
-
49
- describe('Random Range', () => {
50
- test('Should generate a random number between 0 and 10', () => {
51
- expect(Utils.randomRange(0, 10)).toBeLessThanOrEqual(10);
52
- });
53
-
54
- test('Should generate the number 10', () => {
55
- expect(Utils.randomRange(10, 10)).toStrictEqual(10);
56
- });
57
-
58
- test('Only pass min and not max', () => {
59
- expect(Utils.randomRange(0)).toBeLessThanOrEqual(2000);
60
- });
61
-
62
- test('Pass non numeric values to random range', () => {
63
- expect(Utils.randomRange('dd' as any, 'asjj' as any)).toBeNaN();
64
- });
65
- });
66
-
67
- describe('Convert Hive Amount', () => {
68
- test('Converts amount', async () => {
69
- const amount = 25;
70
- const fiatSymbol = 'USD';
71
- const hiveSymbol = 'HIVE';
72
-
73
- (fetch as any)
74
- .once(JSON.stringify({'hive':{'usd':0.229951},'hive_dollar':{'usd':0.99805}})) // CoinGecko HIVE/HBD prices
75
- .once(JSON.stringify({'date':'2025-07-31','usd':{'cad':1.38249328,'hkd':7.84969296,'isk':124.40606356,'php':58.05502018,'dkk':6.52928985,'huf':350.43324994,'czk':21.5182452,'gbp':0.75416895,'ron':4.43971718,'sek':9.77798397,'idr':16437.63140133,'inr':87.62805331,'brl':5.57697598,'rub':81.01377784,'hrk':6.59133796,'jpy':148.8919467,'thb':32.6921739,'chf':0.81307502,'eur':0.87482089,'myr':4.2526877,'bgn':1.71100093,'try':40.59221009,'cny':7.19127973,'nok':10.30319488,'nzd':1.69157541,'zar':17.98114271,'usd':1.0,'mxn':18.84341987,'sgd':1.29367688,'aud':1.5491513,'ils':3.38255864,'krw':1389.43611488,'pln':3.73980141}})); // Currency API fiat rates
76
-
77
- const value = await Utils.convertHiveAmount(amount, fiatSymbol, hiveSymbol);
78
-
79
- expect(fetch).toHaveBeenNthCalledWith(
80
- 1,
81
- 'https://api.coingecko.com/api/v3/simple/price?ids=hive,hive_dollar&vs_currencies=usd',
82
- expect.objectContaining({
83
- headers: expect.objectContaining({
84
- 'User-Agent': 'hive-stream/3.0.0',
85
- 'Accept': 'application/json'
86
- })
87
- })
88
- );
89
- expect(fetch).toHaveBeenNthCalledWith(
90
- 2,
91
- 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json',
92
- expect.objectContaining({
93
- headers: expect.objectContaining({
94
- 'User-Agent': 'hive-stream/3.0.0',
95
- 'Accept': 'application/json',
96
- 'Cache-Control': 'no-cache'
97
- })
98
- })
99
- );
100
-
101
- expect(value).toStrictEqual(Number((amount / 0.229951).toFixed(3))); // amount / HIVE price from CoinGecko (fiat to HIVE conversion)
102
- });
103
- });
104
-
105
- describe('Get transfer URL', () => {
106
- test('Gets a transfer URL string with proper URL encoding', () => {
107
- const result = Utils.getTransferUrl('beggars', 'TEST123', '10.000 HIVE', 'http://localhost:5001');
108
- const expected = 'https://hivesigner.com/sign/transfer?to=beggars&memo=TEST123&amount=10.000%20HIVE&redirect_uri=http%3A%2F%2Flocalhost%3A5001';
109
- expect(result).toStrictEqual(expected);
110
- });
111
- });
112
-
113
- });
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "exclude": ["node_modules", ".vscode", "dist", "tests"]
4
- }
package/tslint.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "extends": [
3
- "tslint:recommended"
4
- ],
5
- "jsRules": {},
6
- "rules": {
7
- "quotemark": [true, "single"],
8
- "ordered-imports": false,
9
- "interface-name": false,
10
- "object-literal-sort-keys": false,
11
- "eofline": false,
12
- "no-console": false,
13
- "member-ordering": false,
14
- "max-line-length": false,
15
- "trailing-comma": false,
16
- "no-string-literal": false,
17
- "arrow-parens": false,
18
- "object-literal-key-quotes": false
19
- },
20
- "rulesDirectory": []
21
- }
package/wallaby.js DELETED
@@ -1,26 +0,0 @@
1
- module.exports = function (wallaby) {
2
- return {
3
- files: [
4
- "**/*.css",
5
- "**/*.json",
6
- "src/**/*.ts",
7
- "src/**/*.html",
8
- "tests/setup.ts",
9
- "tsconfig.json",
10
- ],
11
-
12
- tests: ["tests/**/*.spec.ts"],
13
-
14
- compilers: {
15
- "**/*.ts": wallaby.compilers.typeScript({
16
- module: "commonjs",
17
- typescript: require("typescript"),
18
- }),
19
- },
20
-
21
- env: {
22
- runner: "node",
23
- type: "node",
24
- },
25
- };
26
- };