File tree Expand file tree Collapse file tree 1 file changed +55
-5
lines changed
src/app/query/bitcoin/stamps Expand file tree Collapse file tree 1 file changed +55
-5
lines changed Original file line number Diff line number Diff line change @@ -5,20 +5,70 @@ import { AppUseQueryConfig } from '@app/query/query-config';
5
5
import { QueryPrefixes } from '@app/query/query-prefixes' ;
6
6
7
7
export interface Stamp {
8
- asset : string ;
8
+ stamp : number ;
9
9
block_index : number ;
10
+ cpid : string ;
11
+ asset_longname : string ;
12
+ creator : string ;
13
+ divisible : number ;
14
+ keyburn : number ;
15
+ locked : number ;
10
16
message_index : number ;
11
- stamp : number ;
17
+ stamp_base64 : string ;
12
18
stamp_mimetype : string ;
13
19
stamp_url : string ;
14
- timestamp : number ;
20
+ supply : number ;
21
+ timestamp : string ;
15
22
tx_hash : string ;
16
23
tx_index : number ;
24
+ src_data : string ;
25
+ ident : string ;
26
+ creator_name : string ;
27
+ stamp_gen : string ;
28
+ stamp_hash : string ;
29
+ is_btc_stamp : number ;
30
+ is_reissue : number ;
31
+ file_hash : string ;
32
+ }
33
+
34
+ interface Src20 {
35
+ id : string ;
36
+ address : string ;
37
+ cpid : string ;
38
+ p : string ;
39
+ tick : string ;
40
+ amt : number ;
41
+ block_time : string ;
42
+ last_update : number ;
43
+ }
44
+
45
+ interface StampsByAddressQueryResponse {
46
+ page : number ;
47
+ limit : number ;
48
+ totalPages : number ;
49
+ total : number ;
50
+ last_block : number ;
51
+ btc : {
52
+ address : string ;
53
+ balance : number ;
54
+ txCount : number ;
55
+ unconfirmedBalance : number ;
56
+ unconfirmedTxCount : number ;
57
+ } ;
58
+ data : {
59
+ stamps : Stamp [ ] ;
60
+ src20 : Src20 [ ] ;
61
+ } ;
17
62
}
18
63
64
+ /**
65
+ * @see https://stampchain.io/docs#/default/get_api_v2_balance__address_
66
+ */
19
67
async function fetchStampsByAddress ( address : string ) : Promise < Stamp [ ] > {
20
- const resp = await axios . get ( `https://stampchain.io/api/stamps?wallet_address=${ address } ` ) ;
21
- return resp . data ;
68
+ const resp = await axios . get < StampsByAddressQueryResponse > (
69
+ `https://stampchain.io/api/v2/balance/${ address } `
70
+ ) ;
71
+ return resp . data . data . stamps ;
22
72
}
23
73
24
74
type FetchStampsByAddressResp = Awaited < ReturnType < typeof fetchStampsByAddress > > ;
You can’t perform that action at this time.
0 commit comments