Skip to content

Commit

Permalink
storage: client query for EVM NFTs
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Sep 27, 2023
1 parent d95cd32 commit 3f13626
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ func (c *StorageClient) RuntimeTokenHolders(ctx context.Context, p apiTypes.GetR
func (c *StorageClient) RuntimeEVMNFTs(ctx context.Context, p apiTypes.GetRuntimeEvmNftsAddressParams, address staking.Address) (*EvmNftList, error) {
res, err := c.withTotalCount(
ctx,
"SELECT 1 FROM FALSE", // todo: queries.EvmNfts
queries.EvmNfts,
runtimeFromCtx(ctx),
address,
p.Limit,
Expand Down
26 changes: 26 additions & 0 deletions storage/client/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,32 @@ const (
LIMIT $3::bigint
OFFSET $4::bigint`

EvmNfts = `
SELECT
chain.evm_nfts.token_address,
chain.address_preimages.context_identifier,
chain.address_preimages.context_version,
chain.address_preimages.address_data,
chain.evm_tokens.token_name,
chain.evm_tokens.symbol,
chain.evm_tokens.token_type,
chain.evm_tokens.total_supply,
chain.evm_nfts.nft_id,
chain.evm_nfts.metadata_uri,
chain.evm_nfts.metadata_accessed,
chain.evm_nfts.name,
chain.evm_nfts.description,
chain.evm_nfts.image
FROM chain.evm_nfts
LEFT JOIN chain.address_preimages ON
chain.address_preimages.address = chain.evm_nfts.token_address
LEFT JOIN chain.evm_tokens USING (runtime, token_address)
WHERE
runtime = $1::runtime AND
token_address = $2::oasis_addr
LIMIT $3::bigint
OFFSET $4::bigint`

AccountRuntimeSdkBalances = `
SELECT
balance AS balance,
Expand Down

0 comments on commit 3f13626

Please sign in to comment.