Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe775cf

Browse files
author
Nathan Guggenberger
committed
Add support for ERC-721 (NFT) Tokens
1 parent2969dc1 commitbe775cf

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

‎src/main/java/io/api/etherscan/core/IAccountApi.java‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public interface IAccountApi {
9393
List<TxInternal>txsInternalByHash(Stringtxhash)throwsApiException;
9494

9595
/**
96-
* All token txs for given address
96+
* AllERC-20token txs for given address
9797
*
9898
* @param address get txs for
9999
* @param startBlock tx from this blockNumber
@@ -110,6 +110,24 @@ public interface IAccountApi {
110110
@NotNull
111111
List<TxToken>txsToken(Stringaddress)throwsApiException;
112112

113+
/**
114+
* All ERC-721 (NFT) token txs for given address
115+
*
116+
* @param address get txs for
117+
* @param startBlock tx from this blockNumber
118+
* @param endBlock tx to this blockNumber
119+
* @return txs for address
120+
* @throws ApiException parent exception class
121+
*/
122+
@NotNull
123+
List<TxToken>txsNftToken(Stringaddress,longstartBlock,longendBlock)throwsApiException;
124+
125+
@NotNull
126+
List<TxToken>txsNftToken(Stringaddress,longstartBlock)throwsApiException;
127+
128+
@NotNull
129+
List<TxToken>txsNftToken(Stringaddress)throwsApiException;
130+
113131
/**
114132
* All blocks mined by address
115133
*

‎src/main/java/io/api/etherscan/core/impl/AccountApiProvider.java‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class AccountApiProvider extends BasicProvider implements IAccountApi {
3434
privatestaticfinalStringACT_TX_ACTION =ACT_PREFIX +"txlist";
3535
privatestaticfinalStringACT_TX_INTERNAL_ACTION =ACT_PREFIX +"txlistinternal";
3636
privatestaticfinalStringACT_TX_TOKEN_ACTION =ACT_PREFIX +"tokentx";
37+
privatestaticfinalStringACT_TX_NFT_TOKEN_ACTION =ACT_PREFIX +"tokennfttx";
3738
privatestaticfinalStringACT_MINED_ACTION =ACT_PREFIX +"getminedblocks";
3839

3940
privatestaticfinalStringBLOCK_TYPE_PARAM ="&blocktype=blocks";
@@ -229,6 +230,29 @@ public List<TxToken> txsToken(final String address, final long startBlock, final
229230
returngetRequestUsingOffset(urlParams,TxTokenResponseTO.class);
230231
}
231232

233+
234+
@Override
235+
public@NotNullList<TxToken>txsNftToken(Stringaddress)throwsApiException {
236+
returntxsNftToken(address,MIN_START_BLOCK);
237+
}
238+
239+
@Override
240+
public@NotNullList<TxToken>txsNftToken(Stringaddress,longstartBlock)throwsApiException {
241+
returntxsNftToken(address,startBlock,MAX_END_BLOCK);
242+
}
243+
244+
@Override
245+
public@NotNullList<TxToken>txsNftToken(Stringaddress,longstartBlock,longendBlock)throwsApiException {
246+
BasicUtils.validateAddress(address);
247+
finalBlockParamblocks =BasicUtils.compensateBlocks(startBlock,endBlock);
248+
249+
finalStringoffsetParam =PAGE_PARAM +"%s" +OFFSET_PARAM +OFFSET_MAX;
250+
finalStringblockParam =START_BLOCK_PARAM +blocks.start() +END_BLOCK_PARAM +blocks.end();
251+
finalStringurlParams =ACT_TX_NFT_TOKEN_ACTION +offsetParam +ADDRESS_PARAM +address +blockParam +SORT_ASC_PARAM;
252+
253+
returngetRequestUsingOffset(urlParams,TxTokenResponseTO.class);
254+
}
255+
232256
@NotNull
233257
@Override
234258
publicList<Block>minedBlocks(finalStringaddress)throwsApiException {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp