-
Notifications
You must be signed in to change notification settings - Fork 316
/
Copy pathfixtures.ts
104 lines (102 loc) · 2.58 KB
/
fixtures.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import nock from 'nock'
export const mockBalancesResponseSuccess = (): nock.Scope =>
nock('https://api.prime.coinbase.com', {
encodedQueryParams: true,
})
.get('/v1/portfolios/abcd1234-123a-1234-ab12-12a34bcd56e7/balances')
.query({
symbols: 'BTC',
balance_type: 'TOTAL_BALANCES',
})
.reply(
200,
() => ({
balances: [
{
symbol: 'btc',
amount: '100.00',
holds: '50.0',
bonded_amount: '0.0',
reserved_amount: '0.0',
unbonding_amount: '0.0',
unvested_amount: '0.0',
pending_rewards_amount: '0.0',
past_rewards_amount: '0.0',
bondable_amount: '0.0',
withdrawable_amount: '100.00',
fiat_amount: '701889235.50',
},
],
type: 'TOTAL_BALANCES',
trading_balances: {
total: '0',
holds: '0',
},
vault_balances: {
total: '701889235.5',
holds: '106683742.43',
},
}),
[
'Content-Type',
'application/json',
'Connection',
'close',
'Vary',
'Accept-Encoding',
'Vary',
'Origin',
],
)
.persist()
export const mockWalletsResponseSuccess = (): nock.Scope =>
nock('https://api.prime.coinbase.com', {
encodedQueryParams: true,
})
.get('/v1/portfolios/abcd1234-123a-1234-ab12-12a34bcd56e7/wallets')
.query({
symbols: { '': 'BTC' }, // unusual notation due to array query param
sort_direction: 'ASC',
cursor: '',
limit: 100,
type: 'VAULT',
})
.reply(
200,
() => ({
wallets: [
{
id: '1a1a1a1a-1a1a-1a1a-1a1a-1a1a1a1a1a1a',
name: 'Wallet 1',
symbol: 'BTC',
type: 'VAULT',
created_at: '2024-03-26T18:12:48.219Z',
address: 'bc1234567890123456789012345678901234567890',
},
{
id: '2b2b2b2b-2b2b-2b2b-2b2b-2b2b2b2b2b2b',
name: 'Wallet 2',
symbol: 'BTC',
type: 'VAULT',
created_at: '2024-03-27T18:12:48.219Z',
address: 'bc0987654321098765432109876543210987654321',
},
],
pagination: {
has_next: false,
next_cursor: '',
sort_direction: 'ASC',
},
}),
[
'Content-Type',
'application/json',
'Connection',
'close',
'Vary',
'Accept-Encoding',
'Vary',
'Origin',
],
)
.persist()