Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ability to search tokens with a text filter #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 92 additions & 3 deletions packages/metadata/src/metadata.gen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
// sequence-metadata v0.4.0 eaaa99d70565871556a53333df1c49d28c8be767
// sequence-metadata v0.4.0 376fc6f21f770a4d0457a039d13b6aca6d174e3f
// --
// This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
// Do not edit by hand. Update your webrpc schema and re-generate.
Expand All @@ -11,18 +11,32 @@ export const WebRPCVersion = "v1"
export const WebRPCSchemaVersion = "v0.4.0"

// Schema hash generated from your RIDL schema
export const WebRPCSchemaHash = "eaaa99d70565871556a53333df1c49d28c8be767"
export const WebRPCSchemaHash = "376fc6f21f770a4d0457a039d13b6aca6d174e3f"


//
// Types
//
export enum ContractType {
ERC20 = 'ERC20',
ContractURI = 'ContractURI',
OpenSea = 'OpenSea',
ERC1155 = 'ERC1155',
ERC721 = 'ERC721',
UNKNOWN = 'UNKNOWN'
}

export enum SwapType {
UNKNOWN = 'UNKNOWN',
BUY = 'BUY',
SELL = 'SELL'
}

export enum SortOrder {
DESC = 'DESC',
ASC = 'ASC'
}

export interface Version {
webrpcVersion: string
schemaVersion: string
Expand All @@ -43,6 +57,13 @@ export interface RuntimeStatus {
export interface RuntimeChecks {
}

export interface ContractIndex {
chainId: string
address: string
type: ContractType
metadata: {[key: string]: any}
}

export interface ContractInfo {
chainId: number
address: string
Expand All @@ -63,6 +84,14 @@ export interface ContractInfoExtensions {
blacklist: boolean
}

export interface TokenIndex {
chainId: string
contractAddress: string
tokenId: string
metadata: {[key: string]: any}

}

export interface TokenMetadata {
tokenId: string
contractAddress: string
Expand All @@ -86,12 +115,24 @@ export interface GetNiftyswapUnitPricesRequest {
amounts: Array<string>
}

export interface Page {
pageSize?: number
page?: number
}

export interface SortBy {
column: string
order: SortOrder
}

export interface Metadata {
ping(headers?: object): Promise<PingReturn>
version(headers?: object): Promise<VersionReturn>
runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>
getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>
getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>
searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>
searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>
getContractInfo(args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn>
getContractInfoBatch(args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn>
searchContractInfo(args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn>
Expand Down Expand Up @@ -135,6 +176,28 @@ export interface GetTokenMetadataBatchArgs {
export interface GetTokenMetadataBatchReturn {
contractTokenMetadata: {[key: string]: Array<TokenMetadata>}
}
export interface SearchTokenMetadataArgs {
chainID: string
contractAddress: string
filter: string
page?: Page
}

export interface SearchTokenMetadataReturn {
page: Page
tokenMetadata: Array<TokenMetadata>
}
export interface SearchTokenIDsArgs {
chainID: string
contractAddress: string
filter: string
page?: Page
}

export interface SearchTokenIDsReturn {
page: Page
tokenIds: Array<string>
}
export interface GetContractInfoArgs {
chainID: string
contractAddress: string
Expand Down Expand Up @@ -266,6 +329,32 @@ export class Metadata implements Metadata {
})
}

searchTokenMetadata = (args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn> => {
return this.fetch(
this.url('SearchTokenMetadata'),
createHTTPRequest(args, headers)).then((res) => {
return buildResponse(res).then(_data => {
return {
page: <Page>(_data.page),
tokenMetadata: <Array<TokenMetadata>>(_data.tokenMetadata)
}
})
})
}

searchTokenIDs = (args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn> => {
return this.fetch(
this.url('SearchTokenIDs'),
createHTTPRequest(args, headers)).then((res) => {
return buildResponse(res).then(_data => {
return {
page: <Page>(_data.page),
tokenIds: <Array<string>>(_data.tokenIds)
}
})
})
}

getContractInfo = (args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn> => {
return this.fetch(
this.url('GetContractInfo'),
Expand Down Expand Up @@ -370,4 +459,4 @@ const buildResponse = (res: Response): Promise<any> => {
})
}

export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>