Skip to content

Commit 3230c49

Browse files
committed
fix: stamps api, closes #4845
1 parent 3556390 commit 3230c49

File tree

1 file changed

+55
-5
lines changed

1 file changed

+55
-5
lines changed

src/app/query/bitcoin/stamps/stamps-by-address.query.ts

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,70 @@ import { AppUseQueryConfig } from '@app/query/query-config';
55
import { QueryPrefixes } from '@app/query/query-prefixes';
66

77
export interface Stamp {
8-
asset: string;
8+
stamp: number;
99
block_index: number;
10+
cpid: string;
11+
asset_longname: string;
12+
creator: string;
13+
divisible: number;
14+
keyburn: number;
15+
locked: number;
1016
message_index: number;
11-
stamp: number;
17+
stamp_base64: string;
1218
stamp_mimetype: string;
1319
stamp_url: string;
14-
timestamp: number;
20+
supply: number;
21+
timestamp: string;
1522
tx_hash: string;
1623
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+
};
1762
}
1863

64+
/**
65+
* @see https://stampchain.io/docs#/default/get_api_v2_balance__address_
66+
*/
1967
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;
2272
}
2373

2474
type FetchStampsByAddressResp = Awaited<ReturnType<typeof fetchStampsByAddress>>;

0 commit comments

Comments
 (0)