@@ -14,12 +14,7 @@ describe('Account balance', () => {
14
14
15
15
it ( 'fulfilled balance Ethereum address' , async ( ) => {
16
16
let resp : any = await httpClient . get (
17
- `${ baseUrl } /v1/account/${ fulfilled_eth_address } /balance?projectId=${ projectId } ¤cy=${ currency } ` ,
18
- {
19
- headers : {
20
- 'x-sdk-version' : sdk_version ,
21
- }
22
- }
17
+ `${ baseUrl } /v1/account/${ fulfilled_eth_address } /balance?projectId=${ projectId } ¤cy=${ currency } &sv=${ sdk_version } `
23
18
)
24
19
expect ( resp . status ) . toBe ( 200 )
25
20
expect ( typeof resp . data . balances ) . toBe ( 'object' )
@@ -40,10 +35,9 @@ describe('Account balance', () => {
40
35
}
41
36
} )
42
37
43
- it ( 'fulfilled balance Solana address' , async ( ) => {
44
- let chainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
38
+ it ( 'fulfilled balance Ethereum address (deprecated \'x-sdk-version\')' , async ( ) => {
45
39
let resp : any = await httpClient . get (
46
- `${ baseUrl } /v1/account/${ fulfilled_solana_address } /balance?projectId=${ projectId } ¤cy=${ currency } &chainId= ${ chainId } ` ,
40
+ `${ baseUrl } /v1/account/${ fulfilled_eth_address } /balance?projectId=${ projectId } ¤cy=${ currency } ` ,
47
41
{
48
42
headers : {
49
43
'x-sdk-version' : sdk_version ,
@@ -53,6 +47,16 @@ describe('Account balance', () => {
53
47
expect ( resp . status ) . toBe ( 200 )
54
48
expect ( typeof resp . data . balances ) . toBe ( 'object' )
55
49
expect ( resp . data . balances . length ) . toBeGreaterThan ( 1 )
50
+ } )
51
+
52
+ it ( 'fulfilled balance Solana address' , async ( ) => {
53
+ let chainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
54
+ let resp : any = await httpClient . get (
55
+ `${ baseUrl } /v1/account/${ fulfilled_solana_address } /balance?projectId=${ projectId } ¤cy=${ currency } &chainId=${ chainId } &sv=${ sdk_version } `
56
+ )
57
+ expect ( resp . status ) . toBe ( 200 )
58
+ expect ( typeof resp . data . balances ) . toBe ( 'object' )
59
+ expect ( resp . data . balances . length ) . toBeGreaterThan ( 1 )
56
60
57
61
for ( const item of resp . data . balances ) {
58
62
expect ( item . chainId ) . toEqual ( chainId )
@@ -76,12 +80,7 @@ describe('Account balance', () => {
76
80
77
81
it ( 'empty balance Ethereum address' , async ( ) => {
78
82
let resp : any = await httpClient . get (
79
- `${ baseUrl } /v1/account/${ empty_eth_address } /balance?projectId=${ projectId } ¤cy=${ currency } ` ,
80
- {
81
- headers : {
82
- 'x-sdk-version' : sdk_version ,
83
- }
84
- }
83
+ `${ baseUrl } /v1/account/${ empty_eth_address } /balance?projectId=${ projectId } ¤cy=${ currency } &sv=${ sdk_version } `
85
84
)
86
85
expect ( resp . status ) . toBe ( 200 )
87
86
expect ( typeof resp . data . balances ) . toBe ( 'object' )
@@ -91,12 +90,7 @@ describe('Account balance', () => {
91
90
it ( 'empty balance Solana address' , async ( ) => {
92
91
let chainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
93
92
let resp : any = await httpClient . get (
94
- `${ baseUrl } /v1/account/${ empty_solana_address } /balance?projectId=${ projectId } ¤cy=${ currency } &chainId=${ chainId } ` ,
95
- {
96
- headers : {
97
- 'x-sdk-version' : sdk_version ,
98
- }
99
- }
93
+ `${ baseUrl } /v1/account/${ empty_solana_address } /balance?projectId=${ projectId } ¤cy=${ currency } &chainId=${ chainId } &sv=${ sdk_version } `
100
94
)
101
95
expect ( resp . status ) . toBe ( 200 )
102
96
expect ( typeof resp . data . balances ) . toBe ( 'object' )
@@ -107,12 +101,9 @@ describe('Account balance', () => {
107
101
// USDC token contract address on Base
108
102
const token_contract_address = 'eip155:8453:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
109
103
const endpoint = `/v1/account/${ fulfilled_eth_address } /balance` ;
110
- const queryParams = `?projectId=${ projectId } ¤cy=${ currency } &forceUpdate=${ token_contract_address } ` ;
104
+ const queryParams = `?projectId=${ projectId } ¤cy=${ currency } &sv= ${ sdk_version } & forceUpdate=${ token_contract_address } ` ;
111
105
const url = `${ baseUrl } ${ endpoint } ${ queryParams } ` ;
112
- const headers = {
113
- 'x-sdk-version' : sdk_version ,
114
- } ;
115
- let resp = await httpClient . get ( url , { headers } ) ;
106
+ let resp = await httpClient . get ( url ) ;
116
107
expect ( resp . status ) . toBe ( 200 )
117
108
expect ( typeof resp . data . balances ) . toBe ( 'object' )
118
109
expect ( resp . data . balances . length ) . toBeGreaterThan ( 1 )
@@ -140,20 +131,17 @@ describe('Account balance', () => {
140
131
const zero_balance_address = '0x5b6262592954B925B510651462b63ddEbcc22eaD'
141
132
const token_contract_address = 'eip155:8453:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
142
133
const endpoint = `/v1/account/${ zero_balance_address } /balance` ;
143
- let queryParams = `?projectId=${ projectId } ¤cy=${ currency } ` ;
134
+ let queryParams = `?projectId=${ projectId } ¤cy=${ currency } &sv= ${ sdk_version } ` ;
144
135
let url = `${ baseUrl } ${ endpoint } ${ queryParams } ` ;
145
- const headers = {
146
- 'x-sdk-version' : sdk_version ,
147
- } ;
148
- let resp = await httpClient . get ( url , { headers } ) ;
136
+ let resp = await httpClient . get ( url ) ;
149
137
expect ( resp . status ) . toBe ( 200 )
150
138
expect ( typeof resp . data . balances ) . toBe ( 'object' )
151
139
expect ( resp . data . balances . length ) . toBe ( 0 )
152
140
153
141
// Forcing update and checking injected balance in response
154
142
queryParams = `${ queryParams } &forceUpdate=${ token_contract_address } ` ;
155
143
url = `${ baseUrl } ${ endpoint } ${ queryParams } ` ;
156
- resp = await httpClient . get ( url , { headers } ) ;
144
+ resp = await httpClient . get ( url ) ;
157
145
expect ( resp . status ) . toBe ( 200 )
158
146
expect ( typeof resp . data . balances ) . toBe ( 'object' )
159
147
expect ( resp . data . balances . length ) . toBe ( 1 )
@@ -167,12 +155,9 @@ describe('Account balance', () => {
167
155
// We are using `0xe...` as a contract address for native tokens
168
156
const token_contract_address = 'eip155:1:0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
169
157
const endpoint = `/v1/account/${ fulfilled_eth_address } /balance` ;
170
- const queryParams = `?projectId=${ projectId } ¤cy=${ currency } &forceUpdate=${ token_contract_address } ` ;
158
+ const queryParams = `?projectId=${ projectId } ¤cy=${ currency } &sv= ${ sdk_version } & forceUpdate=${ token_contract_address } ` ;
171
159
const url = `${ baseUrl } ${ endpoint } ${ queryParams } ` ;
172
- const headers = {
173
- 'x-sdk-version' : sdk_version ,
174
- } ;
175
- let resp = await httpClient . get ( url , { headers } ) ;
160
+ let resp = await httpClient . get ( url ) ;
176
161
expect ( resp . status ) . toBe ( 200 )
177
162
expect ( typeof resp . data . balances ) . toBe ( 'object' )
178
163
expect ( resp . data . balances . length ) . toBeGreaterThan ( 1 )
0 commit comments