11import * as envalid from 'envalid' ;
2- import { Cardano , ChainHistoryProvider , InvalidStringError } from '@cardano-sdk/core' ;
2+ import { Cardano , ChainHistoryProvider } from '@cardano-sdk/core' ;
33import { chainHistoryProviderFactory } from '../../src/factories' ;
44import { logger } from '@cardano-sdk/util-dev' ;
55
@@ -25,7 +25,7 @@ describe('blockfrostChainHistoryProvider', () => {
2525 const [ tx ] = await chainHistoryProvider . transactionsByHashes ( {
2626 ids : [ Cardano . TransactionId ( '84801fb64a9c5078c406ead24017ba0b069ef6ac6446fef8bdb8f97bade3cfa5' ) ]
2727 } ) ;
28- expect ( tx . auxiliaryData ! . body . blob ! . get ( 9_223_372_036_854_775_707n ) ) . toEqual (
28+ expect ( tx . auxiliaryData ! . blob ! . get ( 9_223_372_036_854_775_707n ) ) . toEqual (
2929 '9223372036854775707922337203685477570792233720368547757079223372'
3030 ) ;
3131 } ) ;
@@ -91,8 +91,10 @@ describe('blockfrostChainHistoryProvider', () => {
9191 } ) ;
9292 expect ( tx . body . certificates ! [ 0 ] ) . toEqual ( {
9393 __typename : 'StakeKeyRegistrationCertificate' ,
94- stakeKeyHash : Cardano . Ed25519KeyHash . fromRewardAccount (
95- Cardano . RewardAccount ( 'stake_test1upqykkjq3zhf4085s6n70w8cyp57dl87r0ezduv9rnnj2uqk5zmdv' )
94+ stakeKeyHash : Cardano . RewardAccount . toHash (
95+ Cardano . RewardAccount (
96+ Cardano . RewardAccount ( 'stake_test1upqykkjq3zhf4085s6n70w8cyp57dl87r0ezduv9rnnj2uqk5zmdv' )
97+ )
9698 )
9799 } ) ;
98100 } ) ;
@@ -103,8 +105,10 @@ describe('blockfrostChainHistoryProvider', () => {
103105 expect ( tx . body . certificates ! [ 1 ] ) . toEqual ( {
104106 __typename : 'StakeDelegationCertificate' ,
105107 poolId : 'pool167u07rzwu6dr40hx2pr4vh592vxp4zen9ct2p3h84wzqzv6fkgv' ,
106- stakeKeyHash : Cardano . Ed25519KeyHash . fromRewardAccount (
107- Cardano . RewardAccount ( 'stake_test1upqykkjq3zhf4085s6n70w8cyp57dl87r0ezduv9rnnj2uqk5zmdv' )
108+ stakeKeyHash : Cardano . RewardAccount . toHash (
109+ Cardano . RewardAccount (
110+ Cardano . RewardAccount ( 'stake_test1upqykkjq3zhf4085s6n70w8cyp57dl87r0ezduv9rnnj2uqk5zmdv' )
111+ )
108112 )
109113 } ) ;
110114 } ) ;
@@ -114,8 +118,10 @@ describe('blockfrostChainHistoryProvider', () => {
114118 } ) ;
115119 expect ( tx . body . certificates ! [ 0 ] ) . toEqual ( {
116120 __typename : 'StakeKeyDeregistrationCertificate' ,
117- stakeKeyHash : Cardano . Ed25519KeyHash . fromRewardAccount (
118- Cardano . RewardAccount ( 'stake_test1uqe2twywhfjwt88ghas4sfgq7pp7m8wq64hlhz0vr4uhu2sj2tuzt' )
121+ stakeKeyHash : Cardano . RewardAccount . toHash (
122+ Cardano . RewardAccount (
123+ Cardano . RewardAccount ( 'stake_test1uqe2twywhfjwt88ghas4sfgq7pp7m8wq64hlhz0vr4uhu2sj2tuzt' )
124+ )
119125 )
120126 } ) ;
121127 } ) ;
@@ -160,7 +166,7 @@ describe('blockfrostChainHistoryProvider', () => {
160166 describe ( 'transactionsByAddresses' , ( ) => {
161167 it ( 'Shelley address (addr_test1)' , async ( ) => {
162168 const response = await chainHistoryProvider . transactionsByAddresses ( {
163- addresses : [ Cardano . Address ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ] ,
169+ addresses : [ Cardano . PaymentAddress ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ] ,
164170 pagination : { limit : 20 , startAt : 0 }
165171 } ) ;
166172
@@ -181,7 +187,7 @@ describe('blockfrostChainHistoryProvider', () => {
181187 it ( 'extended Shelley address (addr_test1)' , async ( ) => {
182188 const response = await chainHistoryProvider . transactionsByAddresses ( {
183189 addresses : [
184- Cardano . Address (
190+ Cardano . PaymentAddress (
185191 'addr_test1qph5x6uahxhxyvtqatzj77sjtjmdjycemt5ncjuj2r4e' +
186192 'yflkdap42xncd6cazjarce6jh8mx52fcf8ugststvyklj70qhzhe9h'
187193 )
@@ -204,7 +210,7 @@ describe('blockfrostChainHistoryProvider', () => {
204210 } ) ;
205211 it ( 'Icarus Byron address (2c)' , async ( ) => {
206212 const response = await chainHistoryProvider . transactionsByAddresses ( {
207- addresses : [ Cardano . Address ( '2cWKMJemoBai9J7kVvRTukMmdfxtjL9z7c396rTfrrzfAZ6EeQoKLC2y1k34hswwm4SVr' ) ] ,
213+ addresses : [ Cardano . PaymentAddress ( '2cWKMJemoBai9J7kVvRTukMmdfxtjL9z7c396rTfrrzfAZ6EeQoKLC2y1k34hswwm4SVr' ) ] ,
208214 pagination : { limit : 20 , startAt : 0 }
209215 } ) ;
210216 expect ( response . totalResultCount ) . toBeGreaterThanOrEqual ( 1 ) ;
@@ -220,9 +226,9 @@ describe('blockfrostChainHistoryProvider', () => {
220226 it . skip ( 'multiple address types' , async ( ) => {
221227 const response = await chainHistoryProvider . transactionsByAddresses ( {
222228 addresses : [
223- Cardano . Address ( '2cWKMJemoBai9J7kVvRTukMmdfxtjL9z7c396rTfrrzfAZ6EeQoKLC2y1k34hswwm4SVr' ) ,
224- Cardano . Address ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ,
225- Cardano . Address (
229+ Cardano . PaymentAddress ( '2cWKMJemoBai9J7kVvRTukMmdfxtjL9z7c396rTfrrzfAZ6EeQoKLC2y1k34hswwm4SVr' ) ,
230+ Cardano . PaymentAddress ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ,
231+ Cardano . PaymentAddress (
226232 'addr_test1qph5x6uahxhxyvtqatzj77sjtjmdjycemt5ncjuj2r4e' +
227233 'yflkdap42xncd6cazjarce6jh8mx52fcf8ugststvyklj70qhzhe9h'
228234 )
@@ -245,14 +251,14 @@ describe('blockfrostChainHistoryProvider', () => {
245251 } ) ;
246252 it ( 'Shelley address not used - no transactions' , async ( ) => {
247253 const response = await chainHistoryProvider . transactionsByAddresses ( {
248- addresses : [ Cardano . Address ( 'addr_test1vrfxjeunkc9xu8rpnhgkluptaq0rm8kyxh8m3q9vtcetjwshvpnsm' ) ] ,
254+ addresses : [ Cardano . PaymentAddress ( 'addr_test1vrfxjeunkc9xu8rpnhgkluptaq0rm8kyxh8m3q9vtcetjwshvpnsm' ) ] ,
249255 pagination : { limit : 20 , startAt : 0 }
250256 } ) ;
251257 expect ( response . totalResultCount ) . toBe ( 0 ) ;
252258 } ) ;
253259 it ( 'queries successfully invalid transaction (script failure)' , async ( ) => {
254260 const response = await chainHistoryProvider . transactionsByAddresses ( {
255- addresses : [ Cardano . Address ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ] ,
261+ addresses : [ Cardano . PaymentAddress ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ] ,
256262 pagination : { limit : 20 , startAt : 0 }
257263 } ) ;
258264
@@ -264,18 +270,18 @@ describe('blockfrostChainHistoryProvider', () => {
264270 } ) ;
265271
266272 it ( 'stake address throws error' , async ( ) => {
267- expect ( ( ) => Cardano . Address ( 'stake_test1ur676rnu57m272uvflhm8ahgu8xk980vxg382zye2wpxnjs2dnddx' ) ) . toThrowError (
268- InvalidStringError
269- ) ;
273+ expect ( ( ) =>
274+ Cardano . PaymentAddress ( 'stake_test1ur676rnu57m272uvflhm8ahgu8xk980vxg382zye2wpxnjs2dnddx' )
275+ ) . toThrowError ( ) ;
270276 } ) ;
271277
272278 it ( 'returns transactions starting from blockRange param' , async ( ) => {
273- const address = Cardano . Address (
279+ const address = Cardano . PaymentAddress (
274280 'addr_test1qp88yvfup4eykezr2dytygwyglfzflyn32dh83ftxkzeg4jrdz3th865e0s2cm6xuzc4xkd8desmtu3p5jfmzkazmxwsm2tk5a'
275281 ) ;
276282 const response = await chainHistoryProvider . transactionsByAddresses ( {
277283 addresses : [ address ] ,
278- blockRange : { lowerBound : 3_348_548 } ,
284+ blockRange : { lowerBound : Cardano . BlockNo ( 3_348_548 ) } ,
279285 pagination : { limit : 20 , startAt : 0 }
280286 } ) ;
281287
0 commit comments