Skip to content

Commit ee59645

Browse files
committed
Update transaction response
1 parent 82d6d49 commit ee59645

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

library/src/main/kotlin/one/mixin/bot/vo/TransactionResponse.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,29 @@ data class TransactionResponse(
66
val type: String,
77
@SerializedName("snapshot_id")
88
val snapshotId: String,
9+
@SerializedName("opponent_key")
10+
val opponentKey:String?,
911
@SerializedName("opponent_receivers")
1012
val opponentReceivers: List<String>,
1113
@SerializedName("opponent_threshold")
1214
val opponentThreshold: Int,
1315
@SerializedName("asset_id")
1416
val assetId: String,
1517
val amount: String,
18+
@SerializedName("opening_balance")
19+
val openingBalance:String?,
20+
@SerializedName("closing_balance")
21+
val closingBalance:String?,
1622
@SerializedName("trace_id")
1723
val traceId: String,
1824
val memo: String?,
25+
val state:String?,
1926
@SerializedName("created_at")
20-
val createdAt: String
27+
val createdAt: String,
28+
@SerializedName("transaction_hash")
29+
val transactionHash: String?,
30+
@SerializedName("snapshot_hash")
31+
val snapshotHash: String?,
32+
@SerializedName("snapshot_at")
33+
val snapshotAt: String?,
2134
)

samples/src/main/java/jvmMain/java/Sample.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public static void main(String[] args) {
8383
receivers.add("105f6e8b-d249-4b4d-9beb-e03cefaebc37");
8484
transactions(client, receivers, pinToken, pin);
8585

86+
transactionsOpponentKey(client, "XINQTmRReDuPEUAVEyDyE2mBgxa1ojVRAvpYcKs5nSA7FDBBfAEeVRn8s9vAm3Cn1qzQ7JtjG62go4jSJU6yWyRUKHpamWAM", pinToken, pin);
87+
8688
networkSnapshot(client, "c8e73a02-b543-4100-bd7a-879ed4accdfc");
8789
networkSnapshots(client, CNB_assetId);
8890
} catch (InterruptedException | IOException e) {
@@ -245,7 +247,10 @@ private static SessionToken getUserToken(User user, KeyPair sessionKey, boolean
245247

246248
private static void transactions(HttpClient client, List<String> receivers, String aseKey, String pin) throws IOException {
247249
MixinResponse<TransactionResponse> transactionResponse = client.getAssetService().transactionsCall(
248-
new TransactionRequest(Sample.CNB_assetId, null,"XINQTmRReDuPEUAVEyDyE2mBgxa1ojVRAvpYcKs5nSA7FDBBfAEeVRn8s9vAm3Cn1qzQ7JtjG62go4jSJU6yWyRUKHpamWAM", Sample.amount, encryptPin(aseKey, pin, System.nanoTime())
250+
new TransactionRequest(Sample.CNB_assetId, new OpponentMultisig(
251+
receivers,
252+
2
253+
), null, Sample.amount, encryptPin(aseKey, pin, System.nanoTime())
249254
, null, null)).execute().body();
250255
assert transactionResponse != null;
251256
if (transactionResponse.isSuccess()) {
@@ -255,6 +260,19 @@ private static void transactions(HttpClient client, List<String> receivers, Stri
255260
}
256261
}
257262

263+
private static void transactionsOpponentKey(HttpClient client, String opponentKey, String aseKey, String pin) throws IOException {
264+
MixinResponse<TransactionResponse> transactionResponse = client.getAssetService().transactionsCall(
265+
new TransactionRequest(Sample.CNB_assetId, null, opponentKey, Sample.amount, encryptPin(aseKey, pin, System.nanoTime())
266+
, null, null)).execute().body();
267+
assert transactionResponse != null;
268+
if (transactionResponse.isSuccess()) {
269+
System.out.printf("TransactionsResponse success: %s%n", Objects.requireNonNull(transactionResponse.getData()).getTransactionHash());
270+
} else {
271+
System.out.printf("Transactions fail: %s", Objects.requireNonNull(transactionResponse.getError()).getDescription());
272+
}
273+
}
274+
275+
258276
private static void networkSnapshot(HttpClient client, String snapshotId) throws IOException {
259277
MixinResponse<NetworkSnapshot> snapshotResponse = client.getSnapshotService().networkSnapshotCall(snapshotId).execute().body();
260278
assert snapshotResponse != null;

0 commit comments

Comments
 (0)