Skip to content

Commit 743c954

Browse files
committed
feat: add TokenApi.fetchAssets api
1 parent 82f2dbb commit 743c954

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

Diff for: CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
## 1.3.2
2+
3+
* add `TokenApi.fetchAssets` api
4+
15
## 1.3.1
26

37
* Revert to 1.2.10 with following exceptions preserved:
4-
* Mark `deactive` and `deactiveVerification` as deprecated in favor of `deactivate` and `deactivateVerification`
8+
* Mark `deactive` and `deactiveVerification` as deprecated in favor of `deactivate` and `deactivateVerification`
59
* Fix `queryAsset` and `search` api
610

711
## 1.3.0

Diff for: example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ packages:
175175
path: ".."
176176
relative: true
177177
source: path
178-
version: "1.2.12"
178+
version: "1.3.2"
179179
path:
180180
dependency: transitive
181181
description:

Diff for: lib/src/api/token_api.dart

+6
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,10 @@ class TokenApi {
122122
dio.get('/safe/inscriptions/items/$id'),
123123
InscriptionItem.fromJson,
124124
);
125+
126+
Future<MixinResponse<List<Token>>> fetchAssets(List<String> assetIds) =>
127+
MixinResponse.requestList<Token>(
128+
dio.post('/safe/assets/fetch', data: assetIds),
129+
Token.fromJson,
130+
);
125131
}

Diff for: pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mixin_bot_sdk_dart
22
description: Mixin Messenger API for Dart/Flutter, build decentrialized applications on Mixin
3-
version: 1.3.1
3+
version: 1.3.2
44
homepage: https://github.com/MixinNetwork/mixin_bot_sdk_dart
55

66
environment:

Diff for: test/token_api_test.dart

+16
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,20 @@ void main() {
2323
}
2424
}
2525
});
26+
27+
test('test fetch assets', () async {
28+
try {
29+
final resp = await client.tokenApi.fetchAssets([
30+
btcId,
31+
'965e5c6e-434c-3fa9-b780-c50f43cd955c',
32+
]);
33+
// ignore: avoid_print
34+
print(jsonEncode(resp.data));
35+
} catch (e) {
36+
if (e is MixinApiError) {
37+
// ignore: avoid_print
38+
print(e.error);
39+
}
40+
}
41+
});
2642
}

0 commit comments

Comments
 (0)