@0xsequence/indexer
Advanced tools
Comparing version
{ | ||
"name": "@0xsequence/indexer", | ||
"version": "0.0.0-20250825155416", | ||
"version": "0.0.0-20250911124907", | ||
"description": "indexer sub-package for Sequence", | ||
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/indexer", | ||
"source": "src/index.ts", | ||
"main": "dist/0xsequence-indexer.cjs.js", | ||
"module": "dist/0xsequence-indexer.esm.js", | ||
"author": "Horizon Blockchain Games", | ||
"author": "Sequence Platforms Inc.", | ||
"license": "Apache-2.0", | ||
"dependencies": {}, | ||
"peerDependencies": {}, | ||
"devDependencies": {}, | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./src/index.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22.15.29", | ||
"typescript": "^5.8.3", | ||
"@repo/typescript-config": "^0.0.0" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"dev": "tsc --watch", | ||
"test": "echo", | ||
@@ -20,0 +26,0 @@ "typecheck": "tsc --noEmit" |
@@ -1,4 +0,3 @@ | ||
@0xsequence/indexer | ||
=================== | ||
# @0xsequence/indexer | ||
See [0xsequence project page](https://github.com/0xsequence/sequence.js). |
@@ -11,3 +11,3 @@ export * from './indexer.gen' | ||
public projectAccessKey?: string, | ||
public jwtAuth?: string | ||
public jwtAuth?: string, | ||
) { | ||
@@ -45,3 +45,3 @@ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch) | ||
public projectAccessKey?: string, | ||
public jwtAuth?: string | ||
public jwtAuth?: string, | ||
) { | ||
@@ -48,0 +48,0 @@ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch) |
/* eslint-disable */ | ||
// sequence-indexer v0.4.0 f9220b18008af826218980db21a68ec39989fb80 | ||
// sequence-indexer v0.4.0 546b527de7002f409ffa602ad35b5a3abe979088 | ||
// -- | ||
@@ -19,3 +19,3 @@ // Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT. | ||
// Schema hash generated from your RIDL schema | ||
export const WebRPCSchemaHash = 'f9220b18008af826218980db21a68ec39989fb80' | ||
export const WebRPCSchemaHash = '546b527de7002f409ffa602ad35b5a3abe979088' | ||
@@ -38,3 +38,3 @@ type WebrpcGenVersions = { | ||
schemaName: '', | ||
schemaVersion: '' | ||
schemaVersion: '', | ||
} | ||
@@ -54,16 +54,16 @@ } | ||
schemaName: '', | ||
schemaVersion: '' | ||
schemaVersion: '', | ||
} | ||
} | ||
const [_, webrpcGenVersion] = versions[0].split('@') | ||
const [codeGenName, codeGenVersion] = versions[1].split('@') | ||
const [schemaName, schemaVersion] = versions[2].split('@') | ||
const [_, webrpcGenVersion] = versions[0]!.split('@') | ||
const [codeGenName, codeGenVersion] = versions[1]!.split('@') | ||
const [schemaName, schemaVersion] = versions[2]!.split('@') | ||
return { | ||
webrpcGenVersion, | ||
codeGenName, | ||
codeGenVersion, | ||
schemaName, | ||
schemaVersion | ||
webrpcGenVersion: webrpcGenVersion!, | ||
codeGenName: codeGenName!, | ||
codeGenVersion: codeGenVersion!, | ||
schemaName: schemaName!, | ||
schemaVersion: schemaVersion!, | ||
} | ||
@@ -79,3 +79,3 @@ } | ||
REFRESHING = 'REFRESHING', | ||
AVAILABLE = 'AVAILABLE' | ||
AVAILABLE = 'AVAILABLE', | ||
} | ||
@@ -162,3 +162,3 @@ | ||
ERC1155_BRIDGE = 'ERC1155_BRIDGE', | ||
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE' | ||
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE', | ||
} | ||
@@ -169,3 +169,3 @@ | ||
BLOCK_ADDED = 'BLOCK_ADDED', | ||
BLOCK_REMOVED = 'BLOCK_REMOVED' | ||
BLOCK_REMOVED = 'BLOCK_REMOVED', | ||
} | ||
@@ -177,3 +177,3 @@ | ||
NATIVE_TOKEN_TRANSFER = 'NATIVE_TOKEN_TRANSFER', | ||
SEQUENCE_TXN = 'SEQUENCE_TXN' | ||
SEQUENCE_TXN = 'SEQUENCE_TXN', | ||
} | ||
@@ -184,3 +184,3 @@ | ||
CLOSED = 'CLOSED', | ||
CANCELLED = 'CANCELLED' | ||
CANCELLED = 'CANCELLED', | ||
} | ||
@@ -191,3 +191,3 @@ | ||
SEND = 'SEND', | ||
RECEIVE = 'RECEIVE' | ||
RECEIVE = 'RECEIVE', | ||
} | ||
@@ -197,3 +197,3 @@ | ||
FAILED = 'FAILED', | ||
SUCCESSFUL = 'SUCCESSFUL' | ||
SUCCESSFUL = 'SUCCESSFUL', | ||
} | ||
@@ -204,3 +204,3 @@ | ||
AccessListTxnType = 'AccessListTxnType', | ||
DynamicFeeTxnType = 'DynamicFeeTxnType' | ||
DynamicFeeTxnType = 'DynamicFeeTxnType', | ||
} | ||
@@ -210,3 +210,3 @@ | ||
DESC = 'DESC', | ||
ASC = 'ASC' | ||
ASC = 'ASC', | ||
} | ||
@@ -217,11 +217,5 @@ | ||
UNVERIFIED = 'UNVERIFIED', | ||
ALL = 'ALL' | ||
ALL = 'ALL', | ||
} | ||
export enum NetworkType { | ||
MAINNETS = 'MAINNETS', | ||
TESTNETS = 'TESTNETS', | ||
ALL = 'ALL' | ||
} | ||
export interface Version { | ||
@@ -329,3 +323,3 @@ webrpcVersion: string | ||
balance: string | ||
errorReason?: string | ||
error: string | ||
} | ||
@@ -577,3 +571,3 @@ | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
result: EtherBalance | ||
@@ -584,3 +578,3 @@ } | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
result: NativeTokenBalance | ||
@@ -591,3 +585,3 @@ } | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
results: Array<NativeTokenBalance> | ||
@@ -598,11 +592,6 @@ } | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
results: Array<TokenBalance> | ||
} | ||
export interface ChainInfo { | ||
chainId: number | ||
chainName: string | ||
} | ||
export interface Indexer { | ||
@@ -617,3 +606,3 @@ ping(headers?: object, signal?: AbortSignal): Promise<PingReturn> | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetNativeTokenBalanceReturn> | ||
@@ -623,3 +612,3 @@ getTokenBalancesSummary( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesSummaryReturn> | ||
@@ -629,3 +618,3 @@ getTokenBalancesDetails( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesDetailsReturn> | ||
@@ -635,14 +624,22 @@ getTokenBalancesByContract( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesByContractReturn> | ||
getTokenBalances(args: GetTokenBalancesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesReturn> | ||
getTokenSupplies(args: GetTokenSuppliesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenSuppliesReturn> | ||
getTokenSuppliesMap(args: GetTokenSuppliesMapArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenSuppliesMapReturn> | ||
getTokenSuppliesMap( | ||
args: GetTokenSuppliesMapArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetTokenSuppliesMapReturn> | ||
getTokenIDs(args: GetTokenIDsArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenIDsReturn> | ||
getTokenIDRanges(args: GetTokenIDRangesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenIDRangesReturn> | ||
getBalanceUpdates(args: GetBalanceUpdatesArgs, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesReturn> | ||
getBalanceUpdates( | ||
args: GetBalanceUpdatesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetBalanceUpdatesReturn> | ||
getTransactionHistory( | ||
args: GetTransactionHistoryArgs, | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTransactionHistoryReturn> | ||
@@ -652,3 +649,3 @@ fetchTransactionReceipt( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<FetchTransactionReceiptReturn> | ||
@@ -658,3 +655,3 @@ fetchTransactionReceiptWithFilter( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<FetchTransactionReceiptWithFilterReturn> | ||
@@ -665,3 +662,3 @@ subscribeReceipts(args: SubscribeReceiptsArgs, options: WebrpcStreamOptions<SubscribeReceiptsReturn>): Promise<void> | ||
args: SubscribeBalanceUpdatesArgs, | ||
options: WebrpcStreamOptions<SubscribeBalanceUpdatesReturn> | ||
options: WebrpcStreamOptions<SubscribeBalanceUpdatesReturn>, | ||
): Promise<void> | ||
@@ -672,10 +669,18 @@ syncBalance(args: SyncBalanceArgs, headers?: object, signal?: AbortSignal): Promise<SyncBalanceReturn> | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetAllWebhookListenersReturn> | ||
getWebhookListener(args: GetWebhookListenerArgs, headers?: object, signal?: AbortSignal): Promise<GetWebhookListenerReturn> | ||
addWebhookListener(args: AddWebhookListenerArgs, headers?: object, signal?: AbortSignal): Promise<AddWebhookListenerReturn> | ||
getWebhookListener( | ||
args: GetWebhookListenerArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetWebhookListenerReturn> | ||
addWebhookListener( | ||
args: AddWebhookListenerArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<AddWebhookListenerReturn> | ||
updateWebhookListener( | ||
args: UpdateWebhookListenerArgs, | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<UpdateWebhookListenerReturn> | ||
@@ -685,3 +690,3 @@ removeWebhookListener( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<RemoveWebhookListenerReturn> | ||
@@ -691,3 +696,3 @@ removeAllWebhookListeners( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<RemoveAllWebhookListenersReturn> | ||
@@ -697,3 +702,3 @@ toggleWebhookListener( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<ToggleWebhookListenerReturn> | ||
@@ -703,3 +708,3 @@ pauseAllWebhookListeners( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<PauseAllWebhookListenersReturn> | ||
@@ -709,5 +714,9 @@ resumeAllWebhookListeners( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<ResumeAllWebhookListenersReturn> | ||
getOrderbookOrders(args: GetOrderbookOrdersArgs, headers?: object, signal?: AbortSignal): Promise<GetOrderbookOrdersReturn> | ||
getOrderbookOrders( | ||
args: GetOrderbookOrdersArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetOrderbookOrdersReturn> | ||
getTopOrders(args: GetTopOrdersArgs, headers?: object, signal?: AbortSignal): Promise<GetTopOrdersReturn> | ||
@@ -1022,12 +1031,12 @@ } | ||
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1038,12 +1047,12 @@ } | ||
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
version: <Version>_data.version | ||
version: <Version>_data.version, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1054,12 +1063,12 @@ } | ||
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <RuntimeStatus>_data.status | ||
status: <RuntimeStatus>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1070,27 +1079,31 @@ } | ||
return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
chainID: <number>_data.chainID | ||
chainID: <number>_data.chainID, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getEtherBalance = (args: GetEtherBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetEtherBalanceReturn> => { | ||
getEtherBalance = ( | ||
args: GetEtherBalanceArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetEtherBalanceReturn> => { | ||
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
balance: <EtherBalance>_data.balance | ||
balance: <EtherBalance>_data.balance, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1102,15 +1115,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetNativeTokenBalanceReturn> => { | ||
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
balance: <NativeTokenBalance>_data.balance | ||
balance: <NativeTokenBalance>_data.balance, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1122,17 +1135,17 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesSummaryReturn> => { | ||
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
nativeBalances: <Array<NativeTokenBalance>>_data.nativeBalances, | ||
balances: <Array<TokenBalance>>_data.balances | ||
balances: <Array<TokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1144,17 +1157,17 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesDetailsReturn> => { | ||
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
nativeBalances: <Array<NativeTokenBalance>>_data.nativeBalances, | ||
balances: <Array<TokenBalance>>_data.balances | ||
balances: <Array<TokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1166,49 +1179,57 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesByContractReturn> => { | ||
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
balances: <Array<TokenBalance>>_data.balances | ||
balances: <Array<TokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getTokenBalances = (args: GetTokenBalancesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesReturn> => { | ||
getTokenBalances = ( | ||
args: GetTokenBalancesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesReturn> => { | ||
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
balances: <Array<TokenBalance>>_data.balances | ||
balances: <Array<TokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getTokenSupplies = (args: GetTokenSuppliesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenSuppliesReturn> => { | ||
getTokenSupplies = ( | ||
args: GetTokenSuppliesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetTokenSuppliesReturn> => { | ||
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
contractType: <ContractType>_data.contractType, | ||
tokenIDs: <Array<TokenSupply>>_data.tokenIDs | ||
tokenIDs: <Array<TokenSupply>>_data.tokenIDs, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1220,15 +1241,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenSuppliesMapReturn> => { | ||
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
supplies: <{ [key: string]: Array<TokenSupply> }>_data.supplies | ||
supplies: <{ [key: string]: Array<TokenSupply> }>_data.supplies, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1239,47 +1260,55 @@ } | ||
return this.fetch(this.url('GetTokenIDs'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
contractType: <ContractType>_data.contractType, | ||
tokenIDs: <Array<string>>_data.tokenIDs | ||
tokenIDs: <Array<string>>_data.tokenIDs, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getTokenIDRanges = (args: GetTokenIDRangesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenIDRangesReturn> => { | ||
getTokenIDRanges = ( | ||
args: GetTokenIDRangesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetTokenIDRangesReturn> => { | ||
return this.fetch(this.url('GetTokenIDRanges'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
contractType: <ContractType>_data.contractType, | ||
tokenIDRanges: <Array<TokenIDRange>>_data.tokenIDRanges, | ||
moreRanges: <boolean>_data.moreRanges | ||
moreRanges: <boolean>_data.moreRanges, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getBalanceUpdates = (args: GetBalanceUpdatesArgs, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesReturn> => { | ||
getBalanceUpdates = ( | ||
args: GetBalanceUpdatesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetBalanceUpdatesReturn> => { | ||
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
balances: <Array<TokenBalance>>_data.balances | ||
balances: <Array<TokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1291,16 +1320,16 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTransactionHistoryReturn> => { | ||
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
transactions: <Array<Transaction>>_data.transactions | ||
transactions: <Array<Transaction>>_data.transactions, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1312,15 +1341,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<FetchTransactionReceiptReturn> => { | ||
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
receipt: <TransactionReceipt>_data.receipt | ||
receipt: <TransactionReceipt>_data.receipt, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1332,27 +1361,30 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<FetchTransactionReceiptWithFilterReturn> => { | ||
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
receipt: <TransactionReceipt>_data.receipt | ||
receipt: <TransactionReceipt>_data.receipt, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
subscribeReceipts = (args: SubscribeReceiptsArgs, options: WebrpcStreamOptions<SubscribeReceiptsReturn>): Promise<void> => { | ||
subscribeReceipts = ( | ||
args: SubscribeReceiptsArgs, | ||
options: WebrpcStreamOptions<SubscribeReceiptsReturn>, | ||
): Promise<void> => { | ||
const _fetch = () => | ||
this.fetch(this.url('SubscribeReceipts'), createHTTPRequest(args, options.headers, options.signal)).then( | ||
async res => { | ||
async (res) => { | ||
await sseResponse(res, options, _fetch) | ||
}, | ||
error => { | ||
(error) => { | ||
options.onError(error, _fetch) | ||
} | ||
}, | ||
) | ||
@@ -1364,8 +1396,8 @@ return _fetch() | ||
this.fetch(this.url('SubscribeEvents'), createHTTPRequest(args, options.headers, options.signal)).then( | ||
async res => { | ||
async (res) => { | ||
await sseResponse(res, options, _fetch) | ||
}, | ||
error => { | ||
(error) => { | ||
options.onError(error, _fetch) | ||
} | ||
}, | ||
) | ||
@@ -1376,12 +1408,12 @@ return _fetch() | ||
args: SubscribeBalanceUpdatesArgs, | ||
options: WebrpcStreamOptions<SubscribeBalanceUpdatesReturn> | ||
options: WebrpcStreamOptions<SubscribeBalanceUpdatesReturn>, | ||
): Promise<void> => { | ||
const _fetch = () => | ||
this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest(args, options.headers, options.signal)).then( | ||
async res => { | ||
async (res) => { | ||
await sseResponse(res, options, _fetch) | ||
}, | ||
error => { | ||
(error) => { | ||
options.onError(error, _fetch) | ||
} | ||
}, | ||
) | ||
@@ -1392,10 +1424,10 @@ return _fetch() | ||
return this.fetch(this.url('SyncBalance'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return {} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1407,15 +1439,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetAllWebhookListenersReturn> => { | ||
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
listeners: <Array<WebhookListener>>_data.listeners | ||
listeners: <Array<WebhookListener>>_data.listeners, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1427,15 +1459,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetWebhookListenerReturn> => { | ||
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
listener: <WebhookListener>_data.listener | ||
listener: <WebhookListener>_data.listener, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1447,16 +1479,16 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<AddWebhookListenerReturn> => { | ||
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status, | ||
listener: <WebhookListener>_data.listener | ||
listener: <WebhookListener>_data.listener, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1468,15 +1500,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<UpdateWebhookListenerReturn> => { | ||
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1488,15 +1520,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<RemoveWebhookListenerReturn> => { | ||
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1508,15 +1540,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<RemoveAllWebhookListenersReturn> => { | ||
return this.fetch(this.url('RemoveAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1528,15 +1560,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<ToggleWebhookListenerReturn> => { | ||
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
webhookListener: <WebhookListener>_data.webhookListener | ||
webhookListener: <WebhookListener>_data.webhookListener, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1548,15 +1580,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<PauseAllWebhookListenersReturn> => { | ||
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1568,15 +1600,15 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<ResumeAllWebhookListenersReturn> => { | ||
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1588,16 +1620,16 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetOrderbookOrdersReturn> => { | ||
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
orders: <Array<OrderbookOrder>>_data.orders | ||
orders: <Array<OrderbookOrder>>_data.orders, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1608,12 +1640,12 @@ } | ||
return this.fetch(this.url('GetTopOrders'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
orders: <Array<OrderbookOrder>>_data.orders | ||
orders: <Array<OrderbookOrder>>_data.orders, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -1640,5 +1672,5 @@ } | ||
status: res.status, | ||
cause: 'Invalid response, missing body' | ||
cause: 'Invalid response, missing body', | ||
}), | ||
retryFetch | ||
retryFetch, | ||
) | ||
@@ -1682,7 +1714,7 @@ return | ||
message: 'AbortError', | ||
cause: `AbortError: ${message}` | ||
cause: `AbortError: ${message}`, | ||
}), | ||
() => { | ||
throw new Error('Abort signal cannot be used to reconnect') | ||
} | ||
}, | ||
) | ||
@@ -1692,5 +1724,5 @@ } else { | ||
WebrpcStreamLostError.new({ | ||
cause: `reader.read(): ${message}` | ||
cause: `reader.read(): ${message}`, | ||
}), | ||
retryFetch | ||
retryFetch, | ||
) | ||
@@ -1703,3 +1735,3 @@ } | ||
for (let i = 0; i < lines.length - 1; i++) { | ||
if (lines[i].length == 0) { | ||
if (lines[i]!.length == 0) { | ||
continue | ||
@@ -1709,3 +1741,3 @@ } | ||
try { | ||
data = JSON.parse(lines[i]) | ||
data = JSON.parse(lines[i]!) | ||
if (data.hasOwnProperty('webrpcError')) { | ||
@@ -1725,5 +1757,5 @@ const error = data.webrpcError | ||
// @ts-ignore | ||
cause: `JSON.parse(): ${error.message}` | ||
cause: `JSON.parse(): ${error.message}`, | ||
}), | ||
retryFetch | ||
retryFetch, | ||
) | ||
@@ -1735,3 +1767,3 @@ } | ||
if (!done) { | ||
buffer = lines[lines.length - 1] | ||
buffer = lines[lines.length - 1]! | ||
continue | ||
@@ -1753,3 +1785,3 @@ } | ||
body: JSON.stringify(body || {}), | ||
signal | ||
signal, | ||
} | ||
@@ -1759,3 +1791,3 @@ } | ||
const buildResponse = (res: Response): Promise<any> => { | ||
return res.text().then(text => { | ||
return res.text().then((text) => { | ||
let data | ||
@@ -1771,3 +1803,3 @@ try { | ||
status: res.status, | ||
cause: `JSON.parse(): ${message}: response text: ${text}` | ||
cause: `JSON.parse(): ${message}: response text: ${text}`, | ||
}) | ||
@@ -1821,3 +1853,3 @@ } | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1835,3 +1867,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1849,3 +1881,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1863,3 +1895,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1877,3 +1909,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1891,3 +1923,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1905,3 +1937,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1919,3 +1951,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1933,3 +1965,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1947,3 +1979,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1961,3 +1993,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1977,3 +2009,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1991,3 +2023,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2005,3 +2037,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2019,3 +2051,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2033,3 +2065,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2047,3 +2079,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2061,3 +2093,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2075,3 +2107,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2089,3 +2121,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2103,3 +2135,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2117,3 +2149,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2131,3 +2163,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2145,3 +2177,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2159,3 +2191,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2173,3 +2205,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2187,3 +2219,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2201,3 +2233,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2215,3 +2247,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2229,3 +2261,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2243,3 +2275,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2257,3 +2289,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2271,3 +2303,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2285,3 +2317,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2299,3 +2331,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2313,3 +2345,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2327,3 +2359,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -2372,3 +2404,3 @@ super(name, code, message, status, cause) | ||
NotFound = 'NotFound', | ||
MetadataCallFailed = 'MetadataCallFailed' | ||
MetadataCallFailed = 'MetadataCallFailed', | ||
} | ||
@@ -2413,3 +2445,3 @@ | ||
[3000]: NotFoundError, | ||
[3003]: MetadataCallFailedError | ||
[3003]: MetadataCallFailedError, | ||
} | ||
@@ -2416,0 +2448,0 @@ |
/* eslint-disable */ | ||
// sequence-indexer v0.4.0 399517e791d272fddd35b036260f7bbbe6cea0e5 | ||
// sequence-indexer v0.4.0 5be4a3e78d9c7e0cc378c675ec01c518e83772e3 | ||
// -- | ||
@@ -19,3 +19,3 @@ // Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT. | ||
// Schema hash generated from your RIDL schema | ||
export const WebRPCSchemaHash = '399517e791d272fddd35b036260f7bbbe6cea0e5' | ||
export const WebRPCSchemaHash = '5be4a3e78d9c7e0cc378c675ec01c518e83772e3' | ||
@@ -38,3 +38,3 @@ type WebrpcGenVersions = { | ||
schemaName: '', | ||
schemaVersion: '' | ||
schemaVersion: '', | ||
} | ||
@@ -54,16 +54,16 @@ } | ||
schemaName: '', | ||
schemaVersion: '' | ||
schemaVersion: '', | ||
} | ||
} | ||
const [_, webrpcGenVersion] = versions[0].split('@') | ||
const [codeGenName, codeGenVersion] = versions[1].split('@') | ||
const [schemaName, schemaVersion] = versions[2].split('@') | ||
const [_, webrpcGenVersion] = versions[0]!.split('@') | ||
const [codeGenName, codeGenVersion] = versions[1]!.split('@') | ||
const [schemaName, schemaVersion] = versions[2]!.split('@') | ||
return { | ||
webrpcGenVersion, | ||
codeGenName, | ||
codeGenVersion, | ||
schemaName, | ||
schemaVersion | ||
webrpcGenVersion: webrpcGenVersion!, | ||
codeGenName: codeGenName!, | ||
codeGenVersion: codeGenVersion!, | ||
schemaName: schemaName!, | ||
schemaVersion: schemaVersion!, | ||
} | ||
@@ -79,3 +79,3 @@ } | ||
REFRESHING = 'REFRESHING', | ||
AVAILABLE = 'AVAILABLE' | ||
AVAILABLE = 'AVAILABLE', | ||
} | ||
@@ -162,3 +162,3 @@ | ||
ERC1155_BRIDGE = 'ERC1155_BRIDGE', | ||
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE' | ||
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE', | ||
} | ||
@@ -169,3 +169,3 @@ | ||
BLOCK_ADDED = 'BLOCK_ADDED', | ||
BLOCK_REMOVED = 'BLOCK_REMOVED' | ||
BLOCK_REMOVED = 'BLOCK_REMOVED', | ||
} | ||
@@ -177,3 +177,3 @@ | ||
NATIVE_TOKEN_TRANSFER = 'NATIVE_TOKEN_TRANSFER', | ||
SEQUENCE_TXN = 'SEQUENCE_TXN' | ||
SEQUENCE_TXN = 'SEQUENCE_TXN', | ||
} | ||
@@ -184,3 +184,3 @@ | ||
CLOSED = 'CLOSED', | ||
CANCELLED = 'CANCELLED' | ||
CANCELLED = 'CANCELLED', | ||
} | ||
@@ -191,3 +191,3 @@ | ||
SEND = 'SEND', | ||
RECEIVE = 'RECEIVE' | ||
RECEIVE = 'RECEIVE', | ||
} | ||
@@ -197,3 +197,3 @@ | ||
FAILED = 'FAILED', | ||
SUCCESSFUL = 'SUCCESSFUL' | ||
SUCCESSFUL = 'SUCCESSFUL', | ||
} | ||
@@ -204,3 +204,3 @@ | ||
AccessListTxnType = 'AccessListTxnType', | ||
DynamicFeeTxnType = 'DynamicFeeTxnType' | ||
DynamicFeeTxnType = 'DynamicFeeTxnType', | ||
} | ||
@@ -210,3 +210,3 @@ | ||
DESC = 'DESC', | ||
ASC = 'ASC' | ||
ASC = 'ASC', | ||
} | ||
@@ -217,11 +217,5 @@ | ||
UNVERIFIED = 'UNVERIFIED', | ||
ALL = 'ALL' | ||
ALL = 'ALL', | ||
} | ||
export enum NetworkType { | ||
MAINNETS = 'MAINNETS', | ||
TESTNETS = 'TESTNETS', | ||
ALL = 'ALL' | ||
} | ||
export interface Version { | ||
@@ -329,3 +323,3 @@ webrpcVersion: string | ||
balance: string | ||
errorReason?: string | ||
error: string | ||
} | ||
@@ -577,3 +571,3 @@ | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
result: EtherBalance | ||
@@ -584,3 +578,3 @@ } | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
result: NativeTokenBalance | ||
@@ -591,3 +585,3 @@ } | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
results: Array<NativeTokenBalance> | ||
@@ -598,11 +592,6 @@ } | ||
chainId: number | ||
errorReason?: string | ||
error: string | ||
results: Array<TokenBalance> | ||
} | ||
export interface ChainInfo { | ||
chainId: number | ||
chainName: string | ||
} | ||
export interface IndexerGateway { | ||
@@ -612,3 +601,3 @@ getNativeTokenBalance( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetNativeTokenBalanceReturn> | ||
@@ -619,3 +608,3 @@ getTokenBalances(args: GetTokenBalancesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesReturn> | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesSummaryReturn> | ||
@@ -625,3 +614,3 @@ getTokenBalancesDetails( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesDetailsReturn> | ||
@@ -631,6 +620,9 @@ getTokenBalancesByContract( | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesByContractReturn> | ||
getBalanceUpdates(args: GetBalanceUpdatesArgs, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesReturn> | ||
getChains(args: GetChainsArgs, headers?: object, signal?: AbortSignal): Promise<GetChainsReturn> | ||
getBalanceUpdates( | ||
args: GetBalanceUpdatesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetBalanceUpdatesReturn> | ||
ping(headers?: object, signal?: AbortSignal): Promise<PingReturn> | ||
@@ -644,3 +636,3 @@ version(headers?: object, signal?: AbortSignal): Promise<VersionReturn> | ||
networks?: Array<string> | ||
networkType?: NetworkType | ||
testnets?: boolean | ||
accountAddress?: string | ||
@@ -655,3 +647,3 @@ } | ||
networks?: Array<string> | ||
networkType?: NetworkType | ||
testnets?: boolean | ||
accountAddress?: string | ||
@@ -673,3 +665,3 @@ contractAddress?: string | ||
networks?: Array<string> | ||
networkType?: NetworkType | ||
testnets?: boolean | ||
filter: TokenBalancesFilter | ||
@@ -688,3 +680,3 @@ omitMetadata?: boolean | ||
networks?: Array<string> | ||
networkType?: NetworkType | ||
testnets?: boolean | ||
filter: TokenBalancesFilter | ||
@@ -703,3 +695,3 @@ omitMetadata?: boolean | ||
networks?: Array<string> | ||
networkType?: NetworkType | ||
testnets?: boolean | ||
filter: TokenBalancesByContractFilter | ||
@@ -717,3 +709,3 @@ omitMetadata?: boolean | ||
networks?: Array<string> | ||
networkType?: NetworkType | ||
testnets?: boolean | ||
contractAddress: string | ||
@@ -729,9 +721,2 @@ lastBlockNumber: number | ||
} | ||
export interface GetChainsArgs { | ||
networkType?: NetworkType | ||
} | ||
export interface GetChainsReturn { | ||
chains: Array<ChainInfo> | ||
} | ||
export interface PingArgs {} | ||
@@ -773,31 +758,35 @@ | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetNativeTokenBalanceReturn> => { | ||
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
balances: <Array<GatewayNativeTokenBalance>>_data.balances | ||
balances: <Array<GatewayNativeTokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getTokenBalances = (args: GetTokenBalancesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesReturn> => { | ||
getTokenBalances = ( | ||
args: GetTokenBalancesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesReturn> => { | ||
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
balances: <Array<GatewayTokenBalance>>_data.balances | ||
balances: <Array<GatewayTokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -809,17 +798,17 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesSummaryReturn> => { | ||
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
nativeBalances: <Array<GatewayNativeTokenBalances>>_data.nativeBalances, | ||
balances: <Array<GatewayTokenBalance>>_data.balances | ||
balances: <Array<GatewayTokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -831,17 +820,17 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesDetailsReturn> => { | ||
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
nativeBalances: <Array<GatewayNativeTokenBalances>>_data.nativeBalances, | ||
balances: <Array<GatewayTokenBalance>>_data.balances | ||
balances: <Array<GatewayTokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -853,47 +842,36 @@ } | ||
headers?: object, | ||
signal?: AbortSignal | ||
signal?: AbortSignal, | ||
): Promise<GetTokenBalancesByContractReturn> => { | ||
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
balances: <Array<GatewayTokenBalance>>_data.balances | ||
balances: <Array<GatewayTokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
} | ||
getBalanceUpdates = (args: GetBalanceUpdatesArgs, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesReturn> => { | ||
getBalanceUpdates = ( | ||
args: GetBalanceUpdatesArgs, | ||
headers?: object, | ||
signal?: AbortSignal, | ||
): Promise<GetBalanceUpdatesReturn> => { | ||
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
page: <Page>_data.page, | ||
balances: <Array<GatewayTokenBalance>>_data.balances | ||
balances: <Array<GatewayTokenBalance>>_data.balances, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
) | ||
} | ||
getChains = (args: GetChainsArgs, headers?: object, signal?: AbortSignal): Promise<GetChainsReturn> => { | ||
return this.fetch(this.url('GetChains'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
chains: <Array<ChainInfo>>_data.chains | ||
} | ||
}) | ||
}, | ||
error => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
) | ||
@@ -904,12 +882,12 @@ } | ||
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <boolean>_data.status | ||
status: <boolean>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -920,12 +898,12 @@ } | ||
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
version: <Version>_data.version | ||
version: <Version>_data.version, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -936,12 +914,12 @@ } | ||
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
(res) => { | ||
return buildResponse(res).then((_data) => { | ||
return { | ||
status: <GatewayRuntimeStatus>_data.status | ||
status: <GatewayRuntimeStatus>_data.status, | ||
} | ||
}) | ||
}, | ||
error => { | ||
(error) => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
}, | ||
) | ||
@@ -959,3 +937,3 @@ } | ||
body: JSON.stringify(body || {}), | ||
signal | ||
signal, | ||
} | ||
@@ -965,3 +943,3 @@ } | ||
const buildResponse = (res: Response): Promise<any> => { | ||
return res.text().then(text => { | ||
return res.text().then((text) => { | ||
let data | ||
@@ -977,3 +955,3 @@ try { | ||
status: res.status, | ||
cause: `JSON.parse(): ${message}: response text: ${text}` | ||
cause: `JSON.parse(): ${message}: response text: ${text}`, | ||
}) | ||
@@ -1027,3 +1005,3 @@ } | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1041,3 +1019,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1055,3 +1033,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1069,3 +1047,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1083,3 +1061,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1097,3 +1075,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1111,3 +1089,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1125,3 +1103,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1139,3 +1117,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1153,3 +1131,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1167,3 +1145,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1183,3 +1161,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1197,3 +1175,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1211,3 +1189,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1225,3 +1203,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1239,3 +1217,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1253,3 +1231,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1267,3 +1245,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1281,3 +1259,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1295,3 +1273,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1309,3 +1287,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1323,3 +1301,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1337,3 +1315,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1351,3 +1329,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1365,3 +1343,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1379,3 +1357,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1393,3 +1371,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1407,3 +1385,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1421,3 +1399,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1435,3 +1413,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1449,3 +1427,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1463,3 +1441,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1477,3 +1455,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1491,3 +1469,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1505,3 +1483,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1519,3 +1497,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1533,3 +1511,3 @@ super(name, code, message, status, cause) | ||
status: number = 0, | ||
cause?: string | ||
cause?: string, | ||
) { | ||
@@ -1578,3 +1556,3 @@ super(name, code, message, status, cause) | ||
NotFound = 'NotFound', | ||
MetadataCallFailed = 'MetadataCallFailed' | ||
MetadataCallFailed = 'MetadataCallFailed', | ||
} | ||
@@ -1619,5 +1597,5 @@ | ||
[3000]: NotFoundError, | ||
[3003]: MetadataCallFailedError | ||
[3003]: MetadataCallFailedError, | ||
} | ||
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response> |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
18
28.57%1
-50%329829
-14.32%3
Infinity%7117
-34.51%4
-20%2
100%