Skip to content

Commit a815b03

Browse files
author
Hubert Marteau
committed
fix issues
1 parent cdfc8de commit a815b03

File tree

11 files changed

+1046
-823
lines changed

11 files changed

+1046
-823
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>MultiChainJavaAPI</groupId>
55
<artifactId>MultiChainJavaAPI</artifactId>
6-
<version>0.4.3-SNAPSHOT</version>
6+
<version>0.4.4-SNAPSHOT</version>
77

88
<properties>
99
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/multichain/command/AddressCommand.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* @author Ub - H. MARTEAU
23-
* @version 4.3
23+
* @version 4.4
2424
*/
2525
public class AddressCommand extends QueryBuilderAddress {
2626

@@ -68,8 +68,7 @@ public List<KeyPairs> createKeyPairs(int numberOfPairs) throws MultichainExcepti
6868
List<KeyPairs> listKeyPairs = new ArrayList<KeyPairs>();
6969
Object objectKeyPairs = executeCreateKeyPairs(numberOfPairs);
7070

71-
if (verifyInstance(objectKeyPairs, ArrayList.class)
72-
&& verifyInstanceofList((ArrayList<Object>) objectKeyPairs, KeyPairs.class)) {
71+
if (verifyInstance(objectKeyPairs, ArrayList.class) && verifyInstanceofList((ArrayList<Object>) objectKeyPairs, KeyPairs.class)) {
7372
listKeyPairs = AddressFormatter.formatKeyPairsList((ArrayList<Object>) objectKeyPairs);
7473
}
7574

@@ -159,8 +158,7 @@ public final List<String> getAddressesStringList() throws MultichainException {
159158
List<String> addresses = new ArrayList<String>();
160159

161160
Object objectAddresses = executeGetAddresses(false);
162-
if (verifyInstance(objectAddresses, ArrayList.class)
163-
&& verifyInstanceofList((ArrayList<Object>) objectAddresses, String.class)) {
161+
if (verifyInstance(objectAddresses, ArrayList.class) && verifyInstanceofList((ArrayList<Object>) objectAddresses, String.class)) {
164162
addresses = (ArrayList<String>) objectAddresses;
165163
}
166164

@@ -200,8 +198,7 @@ public final List<Address> getAddressesList() throws MultichainException {
200198
List<Address> addresses = new ArrayList<Address>();
201199

202200
Object objectAddresses = executeGetAddresses(true);
203-
if (verifyInstance(objectAddresses, ArrayList.class)
204-
&& verifyInstanceofList((ArrayList<Object>) objectAddresses, Address.class)) {
201+
if (verifyInstance(objectAddresses, ArrayList.class) && verifyInstanceofList((ArrayList<Object>) objectAddresses, Address.class)) {
205202
addresses = AddressFormatter.formatAddressesList((ArrayList<Object>) objectAddresses);
206203
}
207204

@@ -338,10 +335,7 @@ public List<BalanceAsset> getAddressBalances(String address) throws MultichainEx
338335
List<BalanceAsset> balance = new ArrayList<BalanceAsset>();
339336

340337
Object objectBalances = executeGetAddressBalances(address);
341-
if (verifyInstance(objectBalances, BalanceAsset.class)
342-
&& verifyInstanceofList((ArrayList<Object>) objectBalances, BalanceAsset.class)) {
343-
balance = BalanceFormatter.formatBalanceAssets((ArrayList<Object>) objectBalances);
344-
}
338+
balance = BalanceFormatter.formatBalanceAssets((ArrayList<Object>) objectBalances);
345339

346340
return balance;
347341
}

src/main/java/multichain/command/IssueCommand.java

Lines changed: 140 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
/**
2020
* @author Ub - H. MARTEAU
21-
* @version 2.0
21+
* @version 4.4
2222
*/
2323
public class IssueCommand extends QueryBuilderIssue {
2424

@@ -178,8 +178,11 @@ public String issue(String address, AssetParams assets, float quantity, float un
178178
* @return
179179
* @throws MultichainException
180180
*/
181-
public String issue(String address, String assetName, float quantity, float unit, float amount)
182-
throws MultichainException {
181+
public String issue(String address,
182+
String assetName,
183+
float quantity,
184+
float unit,
185+
float amount) throws MultichainException {
183186
return issue(address, assetName, quantity, unit, amount, null);
184187
}
185188

@@ -220,8 +223,11 @@ public String issue(String address, String assetName, float quantity, float unit
220223
* @return
221224
* @throws MultichainException
222225
*/
223-
public String issue(String address, AssetParams assets, float quantity, float unit, float amount)
224-
throws MultichainException {
226+
public String issue(String address,
227+
AssetParams assets,
228+
float quantity,
229+
float unit,
230+
float amount) throws MultichainException {
225231
return issue(address, assets, quantity, unit, amount, null);
226232
}
227233

@@ -263,8 +269,12 @@ public String issue(String address, AssetParams assets, float quantity, float un
263269
* @return
264270
* @throws MultichainException
265271
*/
266-
public String issue(String address, String assetName, float quantity, float unit, float amount,
267-
List<CustomParamString> customFields) throws MultichainException {
272+
public String issue(String address,
273+
String assetName,
274+
float quantity,
275+
float unit,
276+
float amount,
277+
List<CustomParamString> customFields) throws MultichainException {
268278
String issue = "";
269279

270280
Object objectIssue = executeIssue(address, assetName, quantity, unit, amount, customFields);
@@ -314,8 +324,12 @@ public String issue(String address, String assetName, float quantity, float unit
314324
* @return
315325
* @throws MultichainException
316326
*/
317-
public String issue(String address, AssetParams assets, float quantity, float unit, float amount,
318-
List<CustomParamString> customFields) throws MultichainException {
327+
public String issue(String address,
328+
AssetParams assets,
329+
float quantity,
330+
float unit,
331+
float amount,
332+
List<CustomParamString> customFields) throws MultichainException {
319333
String issue = "";
320334

321335
Object objectIssue = executeIssue(address, assets, quantity, unit, amount, customFields);
@@ -362,11 +376,63 @@ public String issue(String address, AssetParams assets, float quantity, float un
362376
* @return
363377
* @throws MultichainException
364378
*/
365-
public String issueFrom(String fromAddress, String toAddress, String assetName, int quantity, float unit)
366-
throws MultichainException {
379+
public String issueFrom(String fromAddress,
380+
String toAddress,
381+
String assetName,
382+
int quantity,
383+
float unit) throws MultichainException {
384+
return issueFrom(fromAddress, toAddress, assetName, quantity, unit, 0, null);
385+
}
386+
387+
/**
388+
* This works like issue, but with control over the from-address used to
389+
* issue the asset. If there are multiple addresses with asset issuing
390+
* permissions on one node, this allows control over which address is used.
391+
*
392+
* issuefrom "from-address" "to-address" asset-name|asset-params quantity (
393+
* smallest-unit native-amount custom-fields )
394+
*
395+
* Issue asset using specific address
396+
*
397+
* Arguments: 1. "from-address" (string, required) Address used for issuing.
398+
* 2. "to-address" (string, required) The address to send newly created
399+
* asset to. 3. "asset-name" (string, required) Asset name, if not "" should
400+
* be unique. or 3. "asset-params" (object, required) A json object of with
401+
* asset params { "name" : "asset-name" (string, optional) Asset name "open"
402+
* : true|false (boolean, optional, default false) True if follow-on issues
403+
* are allowed ,... } 4. "quantity" (numeric, required) The asset total
404+
* amount in display units. eg. 1234.56 5. "smallest-unit" (numeric,
405+
* optional, default=1) Number of raw units in one displayed unit, eg 0.01
406+
* for cents 6. "native-amount" (numeric, optional) native currency amount
407+
* to send. eg 0.1, Default: minimum-per-output. 7 "custom-fields" (object,
408+
* optional) a json object with custom fields { "param-name": "param-value"
409+
* (strings, required) The key is the parameter name, the value is parameter
410+
* value ,... }
411+
*
412+
* Result: "transactionid" (string) The transaction id.
413+
*
414+
* @param toAddress
415+
* @param assetName
416+
* @param open
417+
* @param quantity
418+
* @param unit
419+
* the smallest transactable unit is given by units, e.g. 0.01.
420+
* @param amount
421+
* @param customFields
422+
* @return
423+
* @throws MultichainException
424+
*/
425+
public String issueFrom(String fromAddress,
426+
String toAddress,
427+
String assetName,
428+
int quantity,
429+
float unit,
430+
float amount,
431+
List<CustomParamString> customFields) throws MultichainException {
367432
String issueFrom = "";
368433

369-
Object objectIssueFrom = executeIssueFrom(fromAddress, toAddress, assetName, quantity, unit);
434+
Object objectIssueFrom = executeIssueFrom(fromAddress, toAddress, assetName, quantity, unit, amount,
435+
customFields);
370436
if (verifyInstance(objectIssueFrom, String.class)) {
371437
issueFrom = (String) objectIssueFrom;
372438
}
@@ -410,11 +476,62 @@ public String issueFrom(String fromAddress, String toAddress, String assetName,
410476
* @return
411477
* @throws MultichainException
412478
*/
413-
public String issueFrom(String fromAddress, String toAddress, List<AssetParams> assets, int quantity, float unit)
414-
throws MultichainException {
479+
public String issueFrom(String fromAddress,
480+
String toAddress,
481+
AssetParams assets,
482+
float quantity,
483+
float unit) throws MultichainException {
484+
return issueFrom(fromAddress, toAddress, assets, quantity, unit, 0, null);
485+
}
486+
487+
/**
488+
* This works like issue, but with control over the from-address used to
489+
* issue the asset. If there are multiple addresses with asset issuing
490+
* permissions on one node, this allows control over which address is used.
491+
*
492+
* issuefrom "from-address" "to-address" asset-name|asset-params quantity (
493+
* smallest-unit native-amount custom-fields )
494+
*
495+
* Issue asset using specific address
496+
*
497+
* Arguments: 1. "from-address" (string, required) Address used for issuing.
498+
* 2. "to-address" (string, required) The address to send newly created
499+
* asset to. 3. "asset-name" (string, required) Asset name, if not "" should
500+
* be unique. or 3. "asset-params" (object, required) A json object of with
501+
* asset params { "name" : "asset-name" (string, optional) Asset name "open"
502+
* : true|false (boolean, optional, default false) True if follow-on issues
503+
* are allowed ,... } 4. "quantity" (numeric, required) The asset total
504+
* amount in display units. eg. 1234.56 5. "smallest-unit" (numeric,
505+
* optional, default=1) Number of raw units in one displayed unit, eg 0.01
506+
* for cents 6. "native-amount" (numeric, optional) native currency amount
507+
* to send. eg 0.1, Default: minimum-per-output. 7 "custom-fields" (object,
508+
* optional) a json object with custom fields { "param-name": "param-value"
509+
* (strings, required) The key is the parameter name, the value is parameter
510+
* value ,... }
511+
*
512+
* Result: "transactionid" (string) The transaction id.
513+
*
514+
* @param toAddress
515+
* @param assetName
516+
* @param open
517+
* @param quantity
518+
* @param unit
519+
* the smallest transactable unit is given by units, e.g. 0.01.
520+
* @param amount
521+
* @param customFields
522+
* @return
523+
* @throws MultichainException
524+
*/
525+
public String issueFrom(String fromAddress,
526+
String toAddress,
527+
AssetParams assets,
528+
float quantity,
529+
float unit,
530+
float amount,
531+
List<CustomParamString> customFields) throws MultichainException {
415532
String issueFrom = "";
416533

417-
Object objectIssueFrom = executeIssueFrom(fromAddress, toAddress, assets, quantity, unit);
534+
Object objectIssueFrom = executeIssueFrom(fromAddress, toAddress, assets, quantity, unit, amount, customFields);
418535
if (verifyInstance(objectIssueFrom, String.class)) {
419536
issueFrom = (String) objectIssueFrom;
420537
}
@@ -488,8 +605,10 @@ public String issueMore(String address, String assetName, int quantity) throws M
488605
* @return
489606
* @throws MultichainException
490607
*/
491-
public String issueMoreFrom(String fromAddress, String toAddress, String assetName, int quantity)
492-
throws MultichainException {
608+
public String issueMoreFrom(String fromAddress,
609+
String toAddress,
610+
String assetName,
611+
int quantity) throws MultichainException {
493612
String issueMoreFrom = "";
494613

495614
Object objectIssueMoreFrom = executeIssueMoreFrom(fromAddress, toAddress, assetName, quantity);
@@ -576,8 +695,10 @@ public List<BalanceAsset> listAssets(String asset) throws MultichainException {
576695
* @return
577696
* @throws MultichainException
578697
*/
579-
public String sendAssetFrom(String fromAddress, String toAddress, String assetName, float quantity)
580-
throws MultichainException {
698+
public String sendAssetFrom(String fromAddress,
699+
String toAddress,
700+
String assetName,
701+
float quantity) throws MultichainException {
581702
String sendAssetFrom = "";
582703

583704
Object objectSendAssetFrom = executeSendAssetFrom(fromAddress, toAddress, assetName, quantity);

0 commit comments

Comments
 (0)