Skip to content

Commit 9396f93

Browse files
Unlimited assets regenerated code. (#302)
1 parent eda58b1 commit 9396f93

25 files changed

+1300
-32
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
unit:
2-
mvn test -Dcucumber.filter.tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.indexer.rekey or @unit.transactions or @unit.transactions.keyreg or @unit.responses or @unit.applications or @unit.dryrun or @unit.tealsign or @unit.responses.messagepack or @unit.responses.231 or @unit.responses.messagepack.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.transactions.payment"
2+
mvn test -Dcucumber.filter.tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.indexer.rekey or @unit.transactions or @unit.transactions.keyreg or @unit.responses or @unit.applications or @unit.dryrun or @unit.tealsign or @unit.responses.messagepack or @unit.responses.231 or @unit.responses.messagepack.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.transactions.payment or @unit.responses.unlimited_assets or @unit.algod.ledger_refactoring or @unit.indexer.ledger_refactoring"
33

44
integration:
55
mvn test -Dcucumber.filter.tags="@algod or @assets or @auction or @kmd or @send or @send.keyregtxn or @indexer or @rekey or @applications.verified or @applications or @compile or @dryrun or @indexer.applications or @indexer.231 or @abi or @c2c"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.algorand.algosdk.v2.client.algod;
2+
3+
import com.algorand.algosdk.crypto.Address;
4+
import com.algorand.algosdk.v2.client.common.Client;
5+
import com.algorand.algosdk.v2.client.common.HttpMethod;
6+
import com.algorand.algosdk.v2.client.common.Query;
7+
import com.algorand.algosdk.v2.client.common.QueryData;
8+
import com.algorand.algosdk.v2.client.common.Response;
9+
import com.algorand.algosdk.v2.client.model.AccountApplicationResponse;
10+
11+
12+
/**
13+
* Given a specific account public key and application ID, this call returns the
14+
* account's application local state and global state (AppLocalState and AppParams,
15+
* if either exists). Global state will only be returned if the provided address is
16+
* the application's creator.
17+
* /v2/accounts/{address}/applications/{application-id}
18+
*/
19+
public class AccountApplicationInformation extends Query {
20+
21+
private Address address;
22+
private Long applicationId;
23+
24+
/**
25+
* @param address An account public key
26+
* @param applicationId An application identifier
27+
*/
28+
public AccountApplicationInformation(Client client, Address address, Long applicationId) {
29+
super(client, new HttpMethod("get"));
30+
this.address = address;
31+
this.applicationId = applicationId;
32+
}
33+
34+
/**
35+
* Execute the query.
36+
* @return the query response object.
37+
* @throws Exception
38+
*/
39+
@Override
40+
public Response<AccountApplicationResponse> execute() throws Exception {
41+
Response<AccountApplicationResponse> resp = baseExecute();
42+
resp.setValueType(AccountApplicationResponse.class);
43+
return resp;
44+
}
45+
46+
/**
47+
* Execute the query with custom headers, there must be an equal number of keys and values
48+
* or else an error will be generated.
49+
* @param headers an array of header keys
50+
* @param values an array of header values
51+
* @return the query response object.
52+
* @throws Exception
53+
*/
54+
@Override
55+
public Response<AccountApplicationResponse> execute(String[] headers, String[] values) throws Exception {
56+
Response<AccountApplicationResponse> resp = baseExecute(headers, values);
57+
resp.setValueType(AccountApplicationResponse.class);
58+
return resp;
59+
}
60+
61+
protected QueryData getRequestString() {
62+
if (this.address == null) {
63+
throw new RuntimeException("address is not set. It is a required parameter.");
64+
}
65+
if (this.applicationId == null) {
66+
throw new RuntimeException("application-id is not set. It is a required parameter.");
67+
}
68+
addPathSegment(String.valueOf("v2"));
69+
addPathSegment(String.valueOf("accounts"));
70+
addPathSegment(String.valueOf(address));
71+
addPathSegment(String.valueOf("applications"));
72+
addPathSegment(String.valueOf(applicationId));
73+
74+
return qd;
75+
}
76+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package com.algorand.algosdk.v2.client.algod;
2+
3+
import com.algorand.algosdk.crypto.Address;
4+
import com.algorand.algosdk.v2.client.common.Client;
5+
import com.algorand.algosdk.v2.client.common.HttpMethod;
6+
import com.algorand.algosdk.v2.client.common.Query;
7+
import com.algorand.algosdk.v2.client.common.QueryData;
8+
import com.algorand.algosdk.v2.client.common.Response;
9+
import com.algorand.algosdk.v2.client.model.AccountAssetResponse;
10+
11+
12+
/**
13+
* Given a specific account public key and asset ID, this call returns the
14+
* account's asset holding and asset parameters (if either exist). Asset parameters
15+
* will only be returned if the provided address is the asset's creator.
16+
* /v2/accounts/{address}/assets/{asset-id}
17+
*/
18+
public class AccountAssetInformation extends Query {
19+
20+
private Address address;
21+
private Long assetId;
22+
23+
/**
24+
* @param address An account public key
25+
* @param assetId An asset identifier
26+
*/
27+
public AccountAssetInformation(Client client, Address address, Long assetId) {
28+
super(client, new HttpMethod("get"));
29+
this.address = address;
30+
this.assetId = assetId;
31+
}
32+
33+
/**
34+
* Execute the query.
35+
* @return the query response object.
36+
* @throws Exception
37+
*/
38+
@Override
39+
public Response<AccountAssetResponse> execute() throws Exception {
40+
Response<AccountAssetResponse> resp = baseExecute();
41+
resp.setValueType(AccountAssetResponse.class);
42+
return resp;
43+
}
44+
45+
/**
46+
* Execute the query with custom headers, there must be an equal number of keys and values
47+
* or else an error will be generated.
48+
* @param headers an array of header keys
49+
* @param values an array of header values
50+
* @return the query response object.
51+
* @throws Exception
52+
*/
53+
@Override
54+
public Response<AccountAssetResponse> execute(String[] headers, String[] values) throws Exception {
55+
Response<AccountAssetResponse> resp = baseExecute(headers, values);
56+
resp.setValueType(AccountAssetResponse.class);
57+
return resp;
58+
}
59+
60+
protected QueryData getRequestString() {
61+
if (this.address == null) {
62+
throw new RuntimeException("address is not set. It is a required parameter.");
63+
}
64+
if (this.assetId == null) {
65+
throw new RuntimeException("asset-id is not set. It is a required parameter.");
66+
}
67+
addPathSegment(String.valueOf("v2"));
68+
addPathSegment(String.valueOf("accounts"));
69+
addPathSegment(String.valueOf(address));
70+
addPathSegment(String.valueOf("assets"));
71+
addPathSegment(String.valueOf(assetId));
72+
73+
return qd;
74+
}
75+
}

src/main/java/com/algorand/algosdk/v2/client/algod/AccountInformation.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.algorand.algosdk.v2.client.common.QueryData;
88
import com.algorand.algosdk.v2.client.common.Response;
99
import com.algorand.algosdk.v2.client.model.Account;
10+
import com.algorand.algosdk.v2.client.model.Enums;
1011

1112

1213
/**
@@ -26,6 +27,15 @@ public AccountInformation(Client client, Address address) {
2627
this.address = address;
2728
}
2829

30+
/**
31+
* When set to `all` will exclude asset holdings, application local state, created
32+
* asset parameters, any created application parameters. Defaults to `none`.
33+
*/
34+
public AccountInformation exclude(Enums.Exclude exclude) {
35+
addQuery("exclude", String.valueOf(exclude));
36+
return this;
37+
}
38+
2939
/**
3040
* Execute the query.
3141
* @return the query response object.

src/main/java/com/algorand/algosdk/v2/client/common/AlgodClient.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.algorand.algosdk.v2.client.algod.SwaggerJSON;
77
import com.algorand.algosdk.v2.client.algod.GetVersion;
88
import com.algorand.algosdk.v2.client.algod.AccountInformation;
9+
import com.algorand.algosdk.v2.client.algod.AccountAssetInformation;
10+
import com.algorand.algosdk.v2.client.algod.AccountApplicationInformation;
911
import com.algorand.algosdk.v2.client.algod.GetPendingTransactionsByAddress;
1012
import com.algorand.algosdk.v2.client.algod.GetBlock;
1113
import com.algorand.algosdk.v2.client.algod.GetProof;
@@ -95,6 +97,29 @@ public AccountInformation AccountInformation(Address address) {
9597
return new AccountInformation((Client) this, address);
9698
}
9799

100+
/**
101+
* Given a specific account public key and asset ID, this call returns the
102+
* account's asset holding and asset parameters (if either exist). Asset parameters
103+
* will only be returned if the provided address is the asset's creator.
104+
* /v2/accounts/{address}/assets/{asset-id}
105+
*/
106+
public AccountAssetInformation AccountAssetInformation(Address address,
107+
Long assetId) {
108+
return new AccountAssetInformation((Client) this, address, assetId);
109+
}
110+
111+
/**
112+
* Given a specific account public key and application ID, this call returns the
113+
* account's application local state and global state (AppLocalState and AppParams,
114+
* if either exists). Global state will only be returned if the provided address is
115+
* the application's creator.
116+
* /v2/accounts/{address}/applications/{application-id}
117+
*/
118+
public AccountApplicationInformation AccountApplicationInformation(Address address,
119+
Long applicationId) {
120+
return new AccountApplicationInformation((Client) this, address, applicationId);
121+
}
122+
98123
/**
99124
* Get the list of pending transactions by address, sorted by priority, in
100125
* decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending

src/main/java/com/algorand/algosdk/v2/client/common/IndexerClient.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import com.algorand.algosdk.v2.client.indexer.MakeHealthCheck;
44
import com.algorand.algosdk.v2.client.indexer.SearchForAccounts;
55
import com.algorand.algosdk.v2.client.indexer.LookupAccountByID;
6+
import com.algorand.algosdk.v2.client.indexer.LookupAccountAssets;
7+
import com.algorand.algosdk.v2.client.indexer.LookupAccountCreatedAssets;
8+
import com.algorand.algosdk.v2.client.indexer.LookupAccountAppLocalStates;
9+
import com.algorand.algosdk.v2.client.indexer.LookupAccountCreatedApplications;
610
import com.algorand.algosdk.v2.client.indexer.LookupAccountTransactions;
711
import com.algorand.algosdk.v2.client.indexer.SearchForApplications;
812
import com.algorand.algosdk.v2.client.indexer.LookupApplicationByID;
@@ -72,6 +76,39 @@ public LookupAccountByID lookupAccountByID(Address accountId) {
7276
return new LookupAccountByID((Client) this, accountId);
7377
}
7478

79+
/**
80+
* Lookup an account's asset holdings, optionally for a specific ID.
81+
* /v2/accounts/{account-id}/assets
82+
*/
83+
public LookupAccountAssets lookupAccountAssets(Address accountId) {
84+
return new LookupAccountAssets((Client) this, accountId);
85+
}
86+
87+
/**
88+
* Lookup an account's created asset parameters, optionally for a specific ID.
89+
* /v2/accounts/{account-id}/created-assets
90+
*/
91+
public LookupAccountCreatedAssets lookupAccountCreatedAssets(Address accountId) {
92+
return new LookupAccountCreatedAssets((Client) this, accountId);
93+
}
94+
95+
/**
96+
* Lookup an account's asset holdings, optionally for a specific ID.
97+
* /v2/accounts/{account-id}/apps-local-state
98+
*/
99+
public LookupAccountAppLocalStates lookupAccountAppLocalStates(Address accountId) {
100+
return new LookupAccountAppLocalStates((Client) this, accountId);
101+
}
102+
103+
/**
104+
* Lookup an account's created application parameters, optionally for a specific
105+
* ID.
106+
* /v2/accounts/{account-id}/created-applications
107+
*/
108+
public LookupAccountCreatedApplications lookupAccountCreatedApplications(Address accountId) {
109+
return new LookupAccountCreatedApplications((Client) this, accountId);
110+
}
111+
75112
/**
76113
* Lookup account transactions.
77114
* /v2/accounts/{account-id}/transactions
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package com.algorand.algosdk.v2.client.indexer;
2+
3+
import com.algorand.algosdk.crypto.Address;
4+
import com.algorand.algosdk.v2.client.common.Client;
5+
import com.algorand.algosdk.v2.client.common.HttpMethod;
6+
import com.algorand.algosdk.v2.client.common.Query;
7+
import com.algorand.algosdk.v2.client.common.QueryData;
8+
import com.algorand.algosdk.v2.client.common.Response;
9+
import com.algorand.algosdk.v2.client.model.ApplicationLocalStatesResponse;
10+
11+
12+
/**
13+
* Lookup an account's asset holdings, optionally for a specific ID.
14+
* /v2/accounts/{account-id}/apps-local-state
15+
*/
16+
public class LookupAccountAppLocalStates extends Query {
17+
18+
private Address accountId;
19+
20+
/**
21+
* @param accountId account string
22+
*/
23+
public LookupAccountAppLocalStates(Client client, Address accountId) {
24+
super(client, new HttpMethod("get"));
25+
this.accountId = accountId;
26+
}
27+
28+
/**
29+
* Application ID
30+
*/
31+
public LookupAccountAppLocalStates applicationId(Long applicationId) {
32+
addQuery("application-id", String.valueOf(applicationId));
33+
return this;
34+
}
35+
36+
/**
37+
* Include all items including closed accounts, deleted applications, destroyed
38+
* assets, opted-out asset holdings, and closed-out application localstates.
39+
*/
40+
public LookupAccountAppLocalStates includeAll(Boolean includeAll) {
41+
addQuery("include-all", String.valueOf(includeAll));
42+
return this;
43+
}
44+
45+
/**
46+
* Maximum number of results to return. There could be additional pages even if the
47+
* limit is not reached.
48+
*/
49+
public LookupAccountAppLocalStates limit(Long limit) {
50+
addQuery("limit", String.valueOf(limit));
51+
return this;
52+
}
53+
54+
/**
55+
* The next page of results. Use the next token provided by the previous results.
56+
*/
57+
public LookupAccountAppLocalStates next(String next) {
58+
addQuery("next", String.valueOf(next));
59+
return this;
60+
}
61+
62+
/**
63+
* Execute the query.
64+
* @return the query response object.
65+
* @throws Exception
66+
*/
67+
@Override
68+
public Response<ApplicationLocalStatesResponse> execute() throws Exception {
69+
Response<ApplicationLocalStatesResponse> resp = baseExecute();
70+
resp.setValueType(ApplicationLocalStatesResponse.class);
71+
return resp;
72+
}
73+
74+
/**
75+
* Execute the query with custom headers, there must be an equal number of keys and values
76+
* or else an error will be generated.
77+
* @param headers an array of header keys
78+
* @param values an array of header values
79+
* @return the query response object.
80+
* @throws Exception
81+
*/
82+
@Override
83+
public Response<ApplicationLocalStatesResponse> execute(String[] headers, String[] values) throws Exception {
84+
Response<ApplicationLocalStatesResponse> resp = baseExecute(headers, values);
85+
resp.setValueType(ApplicationLocalStatesResponse.class);
86+
return resp;
87+
}
88+
89+
protected QueryData getRequestString() {
90+
if (this.accountId == null) {
91+
throw new RuntimeException("account-id is not set. It is a required parameter.");
92+
}
93+
addPathSegment(String.valueOf("v2"));
94+
addPathSegment(String.valueOf("accounts"));
95+
addPathSegment(String.valueOf(accountId));
96+
addPathSegment(String.valueOf("apps-local-state"));
97+
98+
return qd;
99+
}
100+
}

0 commit comments

Comments
 (0)