Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0xsequence/indexer

Package Overview
Dependencies
Maintainers
6
Versions
451
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xsequence/indexer - npm Package Compare versions

Comparing version 0.0.0-20241114193556 to 0.0.0-20241216114019

dist/declarations/src/indexergw.gen.d.ts

1032

dist/0xsequence-indexer.cjs.dev.js

@@ -6,9 +6,14 @@ 'use strict';

function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return n;
}, _extends.apply(null, arguments);
return target;
};
return _extends.apply(this, arguments);
}

@@ -24,9 +29,9 @@

// WebRPC description and code-gen version
const WebRPCVersion = 'v1';
const WebRPCVersion$1 = 'v1';
// Schema version of your RIDL schema
const WebRPCSchemaVersion = 'v0.4.0';
const WebRPCSchemaVersion$1 = 'v0.4.0';
// Schema hash generated from your RIDL schema
const WebRPCSchemaHash = 'cae735346d8e5c3dce48dce9f85116989b6beffd';
const WebRPCSchemaHash$1 = 'cae735346d8e5c3dce48dce9f85116989b6beffd';

@@ -37,3 +42,3 @@ //

let ContractType = /*#__PURE__*/function (ContractType) {
let ContractType$1 = /*#__PURE__*/function (ContractType) {
ContractType["UNKNOWN"] = "UNKNOWN";

@@ -51,3 +56,3 @@ ContractType["NATIVE"] = "NATIVE";

}({});
let EventLogType = /*#__PURE__*/function (EventLogType) {
let EventLogType$1 = /*#__PURE__*/function (EventLogType) {
EventLogType["UNKNOWN"] = "UNKNOWN";

@@ -58,3 +63,3 @@ EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";

}({});
let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
let EventLogDataType$1 = /*#__PURE__*/function (EventLogDataType) {
EventLogDataType["EVENT"] = "EVENT";

@@ -66,3 +71,3 @@ EventLogDataType["TOKEN_TRANSFER"] = "TOKEN_TRANSFER";

}({});
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
let OrderStatus$1 = /*#__PURE__*/function (OrderStatus) {
OrderStatus["OPEN"] = "OPEN";

@@ -73,3 +78,3 @@ OrderStatus["CLOSED"] = "CLOSED";

}({});
let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
let TxnTransferType$1 = /*#__PURE__*/function (TxnTransferType) {
TxnTransferType["UNKNOWN"] = "UNKNOWN";

@@ -80,3 +85,3 @@ TxnTransferType["SEND"] = "SEND";

}({});
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
let TransactionStatus$1 = /*#__PURE__*/function (TransactionStatus) {
TransactionStatus["FAILED"] = "FAILED";

@@ -86,3 +91,3 @@ TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";

}({});
let TransactionType = /*#__PURE__*/function (TransactionType) {
let TransactionType$1 = /*#__PURE__*/function (TransactionType) {
TransactionType["LegacyTxnType"] = "LegacyTxnType";

@@ -93,3 +98,3 @@ TransactionType["AccessListTxnType"] = "AccessListTxnType";

}({});
let SortOrder = /*#__PURE__*/function (SortOrder) {
let SortOrder$1 = /*#__PURE__*/function (SortOrder) {
SortOrder["DESC"] = "DESC";

@@ -99,3 +104,3 @@ SortOrder["ASC"] = "ASC";

}({});
let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
let ContractVerificationStatus$1 = /*#__PURE__*/function (ContractVerificationStatus) {
ContractVerificationStatus["VERIFIED"] = "VERIFIED";

@@ -115,4 +120,4 @@ ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";

this.ping = (headers, signal) => {
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('Ping'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -123,3 +128,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -130,4 +135,4 @@ });

this.version = (headers, signal) => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('Version'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -138,3 +143,3 @@ version: _data.version

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -145,4 +150,4 @@ });

this.runtimeStatus = (headers, signal) => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -153,3 +158,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -160,4 +165,4 @@ });

this.getChainID = (headers, signal) => {
return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetChainID'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -168,3 +173,3 @@ chainID: _data.chainID

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -175,4 +180,4 @@ });

this.getEtherBalance = (args, headers, signal) => {
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -183,3 +188,3 @@ balance: _data.balance

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -190,4 +195,4 @@ });

this.getNativeTokenBalance = (args, headers, signal) => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -198,3 +203,3 @@ balance: _data.balance

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -205,4 +210,4 @@ });

this.getTokenBalancesSummary = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -214,3 +219,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -221,4 +226,4 @@ });

this.getTokenBalancesDetails = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -230,3 +235,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -237,4 +242,4 @@ });

this.getTokenBalancesByContract = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -246,3 +251,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -253,4 +258,4 @@ });

this.getTokenBalances = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -262,3 +267,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -269,4 +274,4 @@ });

this.getTokenSupplies = (args, headers, signal) => {
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -279,3 +284,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -286,4 +291,4 @@ });

this.getTokenSuppliesMap = (args, headers, signal) => {
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -294,3 +299,3 @@ supplies: _data.supplies

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -301,4 +306,4 @@ });

this.getBalanceUpdates = (args, headers, signal) => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -310,3 +315,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -317,4 +322,4 @@ });

this.getTransactionHistory = (args, headers, signal) => {
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -326,3 +331,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -333,8 +338,8 @@ });

this.syncBalance = (args, headers, signal) => {
return this.fetch(this.url('SyncBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('SyncBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {};
});
}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -345,4 +350,4 @@ });

this.fetchTransactionReceipt = (args, headers, signal) => {
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -353,3 +358,3 @@ receipt: _data.receipt

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -360,4 +365,4 @@ });

this.getOrderbookOrders = (args, headers, signal) => {
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -369,3 +374,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -376,4 +381,4 @@ });

this.getTopOrders = (args, headers, signal) => {
return this.fetch(this.url('GetTopOrders'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTopOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -384,3 +389,3 @@ orders: _data.orders

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -391,4 +396,4 @@ });

this.fetchTransactionReceiptWithFilter = (args, headers, signal) => {
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -399,3 +404,3 @@ receipt: _data.receipt

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -406,4 +411,4 @@ });

this.getAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -414,3 +419,3 @@ listeners: _data.listeners

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -421,4 +426,4 @@ });

this.getWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -429,3 +434,3 @@ listener: _data.listener

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -436,4 +441,4 @@ });

this.addWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -445,3 +450,3 @@ status: _data.status,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -452,4 +457,4 @@ });

this.updateWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -460,3 +465,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -467,4 +472,4 @@ });

this.removeWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -475,3 +480,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -482,4 +487,4 @@ });

this.toggleWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -490,3 +495,3 @@ webhookListener: _data.webhookListener

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -497,4 +502,4 @@ });

this.pauseAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -505,3 +510,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -512,4 +517,4 @@ });

this.resumeAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -520,3 +525,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -527,3 +532,3 @@ });

this.subscribeReceipts = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -536,3 +541,3 @@ }, error => {

this.subscribeEvents = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -545,3 +550,3 @@ }, error => {

this.subscribeBalanceUpdates = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -569,3 +574,3 @@ }, error => {

try {
await buildResponse(res);
await buildResponse$1(res);
} catch (error) {

@@ -578,3 +583,3 @@ // @ts-ignore

if (!res.body) {
onError(WebrpcBadResponseError.new({
onError(WebrpcBadResponseError$1.new({
status: res.status,

@@ -619,3 +624,3 @@ cause: 'Invalid response, missing body'

if (error instanceof DOMException && error.name === 'AbortError') {
onError(WebrpcRequestFailedError.new({
onError(WebrpcRequestFailedError$1.new({
message: 'AbortError',

@@ -627,3 +632,3 @@ cause: `AbortError: ${message}`

} else {
onError(WebrpcStreamLostError.new({
onError(WebrpcStreamLostError$1.new({
cause: `reader.read(): ${message}`

@@ -645,3 +650,3 @@ }), retryFetch);

const code = typeof error.code === 'number' ? error.code : 0;
onError((webrpcErrorByCode[code] || WebrpcError).new(error), retryFetch);
onError((webrpcErrorByCode$1[code] || WebrpcError$1).new(error), retryFetch);
return;

@@ -653,3 +658,3 @@ }

}
onError(WebrpcBadResponseError.new({
onError(WebrpcBadResponseError$1.new({
status: res.status,

@@ -670,3 +675,3 @@ // @ts-ignore

};
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
const createHTTPRequest$1 = (body = {}, headers = {}, signal = null) => {
return {

@@ -681,2 +686,530 @@ method: 'POST',

};
const buildResponse$1 = res => {
return res.text().then(text => {
let data;
try {
data = JSON.parse(text);
} catch (error) {
let message = '';
if (error instanceof Error) {
message = error.message;
}
throw WebrpcBadResponseError$1.new({
status: res.status,
cause: `JSON.parse(): ${message}: response text: ${text}`
});
}
if (!res.ok) {
const code = typeof data.code === 'number' ? data.code : 0;
throw (webrpcErrorByCode$1[code] || WebrpcError$1).new(data);
}
return data;
});
};
//
// Errors
//
class WebrpcError$1 extends Error {
constructor(name, code, message, status, cause) {
super(message);
this.name = void 0;
this.code = void 0;
this.message = void 0;
this.status = void 0;
this.cause = void 0;
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
this.msg = void 0;
this.name = name || 'WebrpcError';
this.code = typeof code === 'number' ? code : 0;
this.message = message || `endpoint error ${this.code}`;
this.msg = this.message;
this.status = typeof status === 'number' ? status : 0;
this.cause = cause;
Object.setPrototypeOf(this, WebrpcError$1.prototype);
}
static new(payload) {
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
}
}
// Webrpc errors
class WebrpcEndpointError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcEndpoint', code = 0, message = 'endpoint error', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcEndpointError$1.prototype);
}
}
class WebrpcRequestFailedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcRequestFailed', code = -1, message = 'request failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcRequestFailedError$1.prototype);
}
}
class WebrpcBadRouteError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadRoute', code = -2, message = 'bad route', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadRouteError$1.prototype);
}
}
class WebrpcBadMethodError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadMethod', code = -3, message = 'bad method', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadMethodError$1.prototype);
}
}
class WebrpcBadRequestError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadRequest', code = -4, message = 'bad request', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadRequestError$1.prototype);
}
}
class WebrpcBadResponseError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadResponse', code = -5, message = 'bad response', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadResponseError$1.prototype);
}
}
class WebrpcServerPanicError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcServerPanic', code = -6, message = 'server panic', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcServerPanicError$1.prototype);
}
}
class WebrpcInternalErrorError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcInternalError', code = -7, message = 'internal error', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcInternalErrorError$1.prototype);
}
}
class WebrpcClientDisconnectedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcClientDisconnected', code = -8, message = 'client disconnected', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcClientDisconnectedError$1.prototype);
}
}
class WebrpcStreamLostError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcStreamLost', code = -9, message = 'stream lost', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcStreamLostError$1.prototype);
}
}
class WebrpcStreamFinishedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcStreamFinished', code = -10, message = 'stream finished', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcStreamFinishedError$1.prototype);
}
}
// Schema errors
class UnauthorizedError$1 extends WebrpcError$1 {
constructor(name = 'Unauthorized', code = 1000, message = 'Unauthorized access', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnauthorizedError$1.prototype);
}
}
class PermissionDeniedError$1 extends WebrpcError$1 {
constructor(name = 'PermissionDenied', code = 1001, message = 'Permission denied', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, PermissionDeniedError$1.prototype);
}
}
class SessionExpiredError$1 extends WebrpcError$1 {
constructor(name = 'SessionExpired', code = 1002, message = 'Session expired', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, SessionExpiredError$1.prototype);
}
}
class MethodNotFoundError$1 extends WebrpcError$1 {
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MethodNotFoundError$1.prototype);
}
}
class RequestConflictError$1 extends WebrpcError$1 {
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RequestConflictError$1.prototype);
}
}
class AbortedError$1 extends WebrpcError$1 {
constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AbortedError$1.prototype);
}
}
class TimeoutError$1 extends WebrpcError$1 {
constructor(name = 'Timeout', code = 2000, message = 'Request timed out', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, TimeoutError$1.prototype);
}
}
class InvalidArgumentError$1 extends WebrpcError$1 {
constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidArgumentError$1.prototype);
}
}
class UnavailableError$1 extends WebrpcError$1 {
constructor(name = 'Unavailable', code = 2002, message = 'Unavailable resource', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnavailableError$1.prototype);
}
}
class QueryFailedError$1 extends WebrpcError$1 {
constructor(name = 'QueryFailed', code = 2003, message = 'Query failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, QueryFailedError$1.prototype);
}
}
class ResourceExhaustedError$1 extends WebrpcError$1 {
constructor(name = 'ResourceExhausted', code = 2004, message = 'Resource exhausted', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ResourceExhaustedError$1.prototype);
}
}
class NotFoundError$1 extends WebrpcError$1 {
constructor(name = 'NotFound', code = 3000, message = 'Resource not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, NotFoundError$1.prototype);
}
}
class ProjectNotFoundError$1 extends WebrpcError$1 {
constructor(name = 'ProjectNotFound', code = 3002, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError$1.prototype);
}
}
class MetadataCallFailedError$1 extends WebrpcError$1 {
constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MetadataCallFailedError$1.prototype);
}
}
let errors$1 = /*#__PURE__*/function (errors) {
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
errors["WebrpcBadRoute"] = "WebrpcBadRoute";
errors["WebrpcBadMethod"] = "WebrpcBadMethod";
errors["WebrpcBadRequest"] = "WebrpcBadRequest";
errors["WebrpcBadResponse"] = "WebrpcBadResponse";
errors["WebrpcServerPanic"] = "WebrpcServerPanic";
errors["WebrpcInternalError"] = "WebrpcInternalError";
errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
errors["WebrpcStreamLost"] = "WebrpcStreamLost";
errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
errors["Unauthorized"] = "Unauthorized";
errors["PermissionDenied"] = "PermissionDenied";
errors["SessionExpired"] = "SessionExpired";
errors["MethodNotFound"] = "MethodNotFound";
errors["RequestConflict"] = "RequestConflict";
errors["Aborted"] = "Aborted";
errors["Timeout"] = "Timeout";
errors["InvalidArgument"] = "InvalidArgument";
errors["Unavailable"] = "Unavailable";
errors["QueryFailed"] = "QueryFailed";
errors["ResourceExhausted"] = "ResourceExhausted";
errors["NotFound"] = "NotFound";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["MetadataCallFailed"] = "MetadataCallFailed";
return errors;
}({});
const webrpcErrorByCode$1 = {
[0]: WebrpcEndpointError$1,
[-1]: WebrpcRequestFailedError$1,
[-2]: WebrpcBadRouteError$1,
[-3]: WebrpcBadMethodError$1,
[-4]: WebrpcBadRequestError$1,
[-5]: WebrpcBadResponseError$1,
[-6]: WebrpcServerPanicError$1,
[-7]: WebrpcInternalErrorError$1,
[-8]: WebrpcClientDisconnectedError$1,
[-9]: WebrpcStreamLostError$1,
[-10]: WebrpcStreamFinishedError$1,
[1000]: UnauthorizedError$1,
[1001]: PermissionDeniedError$1,
[1002]: SessionExpiredError$1,
[1003]: MethodNotFoundError$1,
[1004]: RequestConflictError$1,
[1005]: AbortedError$1,
[2000]: TimeoutError$1,
[2001]: InvalidArgumentError$1,
[2002]: UnavailableError$1,
[2003]: QueryFailedError$1,
[2004]: ResourceExhaustedError$1,
[3000]: NotFoundError$1,
[3002]: ProjectNotFoundError$1,
[3003]: MetadataCallFailedError$1
};
/* eslint-disable */
// sequence-indexer v0.4.0 71cd081c5ca2372bf92a897ae1aa4ebf93ffd0fc
// --
// Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT.
//
// webrpc-gen -schema=indexer.ridl -service=IndexerGateway -target=typescript -client -out=./clients/indexergw/indexer.gen.ts
const WebrpcHeader = 'Webrpc';
const WebrpcHeaderValue = 'webrpc@v0.21.1;gen-typescript@v0.15.1;sequence-indexer@v0.4.0';
// WebRPC description and code-gen version
const WebRPCVersion = 'v1';
// Schema version of your RIDL schema
const WebRPCSchemaVersion = 'v0.4.0';
// Schema hash generated from your RIDL schema
const WebRPCSchemaHash = '71cd081c5ca2372bf92a897ae1aa4ebf93ffd0fc';
function VersionFromHeader(headers) {
const headerValue = headers.get(WebrpcHeader);
if (!headerValue) {
return {
webrpcGenVersion: '',
codeGenName: '',
codeGenVersion: '',
schemaName: '',
schemaVersion: ''
};
}
return parseWebrpcGenVersions(headerValue);
}
function parseWebrpcGenVersions(header) {
const versions = header.split(';');
if (versions.length < 3) {
return {
webrpcGenVersion: '',
codeGenName: '',
codeGenVersion: '',
schemaName: '',
schemaVersion: ''
};
}
const [_, webrpcGenVersion] = versions[0].split('@');
const [codeGenName, codeGenVersion] = versions[1].split('@');
const [schemaName, schemaVersion] = versions[2].split('@');
return {
webrpcGenVersion,
codeGenName,
codeGenVersion,
schemaName,
schemaVersion
};
}
//
// Types
//
let ContractType = /*#__PURE__*/function (ContractType) {
ContractType["UNKNOWN"] = "UNKNOWN";
ContractType["NATIVE"] = "NATIVE";
ContractType["ERC20"] = "ERC20";
ContractType["ERC721"] = "ERC721";
ContractType["ERC1155"] = "ERC1155";
ContractType["SEQUENCE_WALLET"] = "SEQUENCE_WALLET";
ContractType["ERC20_BRIDGE"] = "ERC20_BRIDGE";
ContractType["ERC721_BRIDGE"] = "ERC721_BRIDGE";
ContractType["ERC1155_BRIDGE"] = "ERC1155_BRIDGE";
ContractType["SEQ_MARKETPLACE"] = "SEQ_MARKETPLACE";
return ContractType;
}({});
let EventLogType = /*#__PURE__*/function (EventLogType) {
EventLogType["UNKNOWN"] = "UNKNOWN";
EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
return EventLogType;
}({});
let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
EventLogDataType["EVENT"] = "EVENT";
EventLogDataType["TOKEN_TRANSFER"] = "TOKEN_TRANSFER";
EventLogDataType["NATIVE_TOKEN_TRANSFER"] = "NATIVE_TOKEN_TRANSFER";
EventLogDataType["SEQUENCE_TXN"] = "SEQUENCE_TXN";
return EventLogDataType;
}({});
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
OrderStatus["OPEN"] = "OPEN";
OrderStatus["CLOSED"] = "CLOSED";
OrderStatus["CANCELLED"] = "CANCELLED";
return OrderStatus;
}({});
let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
TxnTransferType["UNKNOWN"] = "UNKNOWN";
TxnTransferType["SEND"] = "SEND";
TxnTransferType["RECEIVE"] = "RECEIVE";
return TxnTransferType;
}({});
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
TransactionStatus["FAILED"] = "FAILED";
TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";
return TransactionStatus;
}({});
let TransactionType = /*#__PURE__*/function (TransactionType) {
TransactionType["LegacyTxnType"] = "LegacyTxnType";
TransactionType["AccessListTxnType"] = "AccessListTxnType";
TransactionType["DynamicFeeTxnType"] = "DynamicFeeTxnType";
return TransactionType;
}({});
let SortOrder = /*#__PURE__*/function (SortOrder) {
SortOrder["DESC"] = "DESC";
SortOrder["ASC"] = "ASC";
return SortOrder;
}({});
let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
ContractVerificationStatus["VERIFIED"] = "VERIFIED";
ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
ContractVerificationStatus["ALL"] = "ALL";
return ContractVerificationStatus;
}({});
//
// Client
//
class IndexerGateway {
constructor(hostname, fetch) {
this.hostname = void 0;
this.fetch = void 0;
this.path = '/rpc/IndexerGateway/';
this.getNativeTokenBalance = (args, headers, signal) => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalances = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesSummary = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesDetails = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesByContract = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getBalanceUpdates = (args, headers, signal) => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.ping = (headers, signal) => {
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
status: _data.status
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.version = (headers, signal) => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
version: _data.version
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.runtimeStatus = (headers, signal) => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
status: _data.status
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.hostname = hostname.replace(/\/*$/, '');
this.fetch = (input, init) => fetch(input, init);
}
url(name) {
return this.hostname + this.path + name;
}
}
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
const reqHeaders = _extends({}, headers, {
'Content-Type': 'application/json'
});
reqHeaders[WebrpcHeader] = WebrpcHeaderValue;
return {
method: 'POST',
headers: reqHeaders,
body: JSON.stringify(body || {}),
signal
};
};
const buildResponse = res => {

@@ -839,4 +1372,82 @@ return res.text().then(text => {

}
class GeoblockedError extends WebrpcError {
constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, GeoblockedError.prototype);
}
}
class RateLimitedError extends WebrpcError {
constructor(name = 'RateLimited', code = 1007, message = 'Rate-limited. Please slow down.', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RateLimitedError.prototype);
}
}
class ProjectNotFoundError extends WebrpcError {
constructor(name = 'ProjectNotFound', code = 1100, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
}
}
class AccessKeyNotFoundError extends WebrpcError {
constructor(name = 'AccessKeyNotFound', code = 1101, message = 'Access key not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype);
}
}
class AccessKeyMismatchError extends WebrpcError {
constructor(name = 'AccessKeyMismatch', code = 1102, message = 'Access key mismatch', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype);
}
}
class InvalidOriginError extends WebrpcError {
constructor(name = 'InvalidOrigin', code = 1103, message = 'Invalid origin for Access Key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidOriginError.prototype);
}
}
class InvalidServiceError extends WebrpcError {
constructor(name = 'InvalidService', code = 1104, message = 'Service not enabled for Access key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidServiceError.prototype);
}
}
class UnauthorizedUserError extends WebrpcError {
constructor(name = 'UnauthorizedUser', code = 1105, message = 'Unauthorized user', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnauthorizedUserError.prototype);
}
}
class QuotaExceededError extends WebrpcError {
constructor(name = 'QuotaExceeded', code = 1200, message = 'Quota exceeded', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, QuotaExceededError.prototype);
}
}
class RateLimitError extends WebrpcError {
constructor(name = 'RateLimit', code = 1201, message = 'Rate limit exceeded', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RateLimitError.prototype);
}
}
class NoDefaultKeyError extends WebrpcError {
constructor(name = 'NoDefaultKey', code = 1300, message = 'No default access key found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, NoDefaultKeyError.prototype);
}
}
class MaxAccessKeysError extends WebrpcError {
constructor(name = 'MaxAccessKeys', code = 1301, message = 'Access keys limit reached', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MaxAccessKeysError.prototype);
}
}
class AtLeastOneKeyError extends WebrpcError {
constructor(name = 'AtLeastOneKey', code = 1302, message = 'You need at least one Access Key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype);
}
}
class TimeoutError extends WebrpcError {
constructor(name = 'Timeout', code = 2000, message = 'Request timed out', status = 0, cause) {
constructor(name = 'Timeout', code = 1900, message = 'Request timed out', status = 0, cause) {
super(name, code, message, status, cause);

@@ -876,8 +1487,2 @@ Object.setPrototypeOf(this, TimeoutError.prototype);

}
class ProjectNotFoundError extends WebrpcError {
constructor(name = 'ProjectNotFound', code = 3002, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
}
}
class MetadataCallFailedError extends WebrpcError {

@@ -907,2 +1512,15 @@ constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {

errors["Aborted"] = "Aborted";
errors["Geoblocked"] = "Geoblocked";
errors["RateLimited"] = "RateLimited";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["AccessKeyNotFound"] = "AccessKeyNotFound";
errors["AccessKeyMismatch"] = "AccessKeyMismatch";
errors["InvalidOrigin"] = "InvalidOrigin";
errors["InvalidService"] = "InvalidService";
errors["UnauthorizedUser"] = "UnauthorizedUser";
errors["QuotaExceeded"] = "QuotaExceeded";
errors["RateLimit"] = "RateLimit";
errors["NoDefaultKey"] = "NoDefaultKey";
errors["MaxAccessKeys"] = "MaxAccessKeys";
errors["AtLeastOneKey"] = "AtLeastOneKey";
errors["Timeout"] = "Timeout";

@@ -914,3 +1532,2 @@ errors["InvalidArgument"] = "InvalidArgument";

errors["NotFound"] = "NotFound";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["MetadataCallFailed"] = "MetadataCallFailed";

@@ -937,3 +1554,16 @@ return errors;

[1005]: AbortedError,
[2000]: TimeoutError,
[1006]: GeoblockedError,
[1007]: RateLimitedError,
[1100]: ProjectNotFoundError,
[1101]: AccessKeyNotFoundError,
[1102]: AccessKeyMismatchError,
[1103]: InvalidOriginError,
[1104]: InvalidServiceError,
[1105]: UnauthorizedUserError,
[1200]: QuotaExceededError,
[1201]: RateLimitError,
[1300]: NoDefaultKeyError,
[1301]: MaxAccessKeysError,
[1302]: AtLeastOneKeyError,
[1900]: TimeoutError,
[2001]: InvalidArgumentError,

@@ -944,7 +1574,64 @@ [2002]: UnavailableError,

[3000]: NotFoundError,
[3002]: ProjectNotFoundError,
[3003]: MetadataCallFailedError
};
const fetch = globalThis.fetch;
var indexergw_gen = /*#__PURE__*/Object.freeze({
__proto__: null,
WebrpcHeader: WebrpcHeader,
WebrpcHeaderValue: WebrpcHeaderValue,
WebRPCVersion: WebRPCVersion,
WebRPCSchemaVersion: WebRPCSchemaVersion,
WebRPCSchemaHash: WebRPCSchemaHash,
VersionFromHeader: VersionFromHeader,
ContractType: ContractType,
EventLogType: EventLogType,
EventLogDataType: EventLogDataType,
OrderStatus: OrderStatus,
TxnTransferType: TxnTransferType,
TransactionStatus: TransactionStatus,
TransactionType: TransactionType,
SortOrder: SortOrder,
ContractVerificationStatus: ContractVerificationStatus,
IndexerGateway: IndexerGateway,
WebrpcError: WebrpcError,
WebrpcEndpointError: WebrpcEndpointError,
WebrpcRequestFailedError: WebrpcRequestFailedError,
WebrpcBadRouteError: WebrpcBadRouteError,
WebrpcBadMethodError: WebrpcBadMethodError,
WebrpcBadRequestError: WebrpcBadRequestError,
WebrpcBadResponseError: WebrpcBadResponseError,
WebrpcServerPanicError: WebrpcServerPanicError,
WebrpcInternalErrorError: WebrpcInternalErrorError,
WebrpcClientDisconnectedError: WebrpcClientDisconnectedError,
WebrpcStreamLostError: WebrpcStreamLostError,
WebrpcStreamFinishedError: WebrpcStreamFinishedError,
UnauthorizedError: UnauthorizedError,
PermissionDeniedError: PermissionDeniedError,
SessionExpiredError: SessionExpiredError,
MethodNotFoundError: MethodNotFoundError,
RequestConflictError: RequestConflictError,
AbortedError: AbortedError,
GeoblockedError: GeoblockedError,
RateLimitedError: RateLimitedError,
ProjectNotFoundError: ProjectNotFoundError,
AccessKeyNotFoundError: AccessKeyNotFoundError,
AccessKeyMismatchError: AccessKeyMismatchError,
InvalidOriginError: InvalidOriginError,
InvalidServiceError: InvalidServiceError,
UnauthorizedUserError: UnauthorizedUserError,
QuotaExceededError: QuotaExceededError,
RateLimitError: RateLimitError,
NoDefaultKeyError: NoDefaultKeyError,
MaxAccessKeysError: MaxAccessKeysError,
AtLeastOneKeyError: AtLeastOneKeyError,
TimeoutError: TimeoutError,
InvalidArgumentError: InvalidArgumentError,
UnavailableError: UnavailableError,
QueryFailedError: QueryFailedError,
ResourceExhaustedError: ResourceExhaustedError,
NotFoundError: NotFoundError,
MetadataCallFailedError: MetadataCallFailedError,
errors: errors
});
class SequenceIndexer extends Indexer {

@@ -975,43 +1662,70 @@ constructor(hostname, projectAccessKey, jwtAuth) {

}
class SequenceIndexerGateway extends IndexerGateway {
constructor(hostname, projectAccessKey, jwtAuth) {
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
this.projectAccessKey = projectAccessKey;
this.jwtAuth = jwtAuth;
this._fetch = (input, init) => {
// automatically include jwt and access key auth header to requests
// if its been set on the api client
const headers = {};
const jwtAuth = this.jwtAuth;
const projectAccessKey = this.projectAccessKey;
if (jwtAuth && jwtAuth.length > 0) {
headers['Authorization'] = `BEARER ${jwtAuth}`;
}
if (projectAccessKey && projectAccessKey.length > 0) {
headers['X-Access-Key'] = projectAccessKey;
}
exports.AbortedError = AbortedError;
exports.ContractType = ContractType;
exports.ContractVerificationStatus = ContractVerificationStatus;
exports.EventLogDataType = EventLogDataType;
exports.EventLogType = EventLogType;
// before the request is made
init.headers = _extends({}, init.headers, headers);
return fetch(input, init);
};
this.fetch = this._fetch;
}
}
exports.AbortedError = AbortedError$1;
exports.ContractType = ContractType$1;
exports.ContractVerificationStatus = ContractVerificationStatus$1;
exports.EventLogDataType = EventLogDataType$1;
exports.EventLogType = EventLogType$1;
exports.Indexer = Indexer;
exports.InvalidArgumentError = InvalidArgumentError;
exports.MetadataCallFailedError = MetadataCallFailedError;
exports.MethodNotFoundError = MethodNotFoundError;
exports.NotFoundError = NotFoundError;
exports.OrderStatus = OrderStatus;
exports.PermissionDeniedError = PermissionDeniedError;
exports.ProjectNotFoundError = ProjectNotFoundError;
exports.QueryFailedError = QueryFailedError;
exports.RequestConflictError = RequestConflictError;
exports.ResourceExhaustedError = ResourceExhaustedError;
exports.IndexerGateway = indexergw_gen;
exports.InvalidArgumentError = InvalidArgumentError$1;
exports.MetadataCallFailedError = MetadataCallFailedError$1;
exports.MethodNotFoundError = MethodNotFoundError$1;
exports.NotFoundError = NotFoundError$1;
exports.OrderStatus = OrderStatus$1;
exports.PermissionDeniedError = PermissionDeniedError$1;
exports.ProjectNotFoundError = ProjectNotFoundError$1;
exports.QueryFailedError = QueryFailedError$1;
exports.RequestConflictError = RequestConflictError$1;
exports.ResourceExhaustedError = ResourceExhaustedError$1;
exports.SequenceIndexer = SequenceIndexer;
exports.SessionExpiredError = SessionExpiredError;
exports.SortOrder = SortOrder;
exports.TimeoutError = TimeoutError;
exports.TransactionStatus = TransactionStatus;
exports.TransactionType = TransactionType;
exports.TxnTransferType = TxnTransferType;
exports.UnauthorizedError = UnauthorizedError;
exports.UnavailableError = UnavailableError;
exports.WebRPCSchemaHash = WebRPCSchemaHash;
exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
exports.WebRPCVersion = WebRPCVersion;
exports.WebrpcBadMethodError = WebrpcBadMethodError;
exports.WebrpcBadRequestError = WebrpcBadRequestError;
exports.WebrpcBadResponseError = WebrpcBadResponseError;
exports.WebrpcBadRouteError = WebrpcBadRouteError;
exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError;
exports.WebrpcEndpointError = WebrpcEndpointError;
exports.WebrpcError = WebrpcError;
exports.WebrpcInternalErrorError = WebrpcInternalErrorError;
exports.WebrpcRequestFailedError = WebrpcRequestFailedError;
exports.WebrpcServerPanicError = WebrpcServerPanicError;
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError;
exports.WebrpcStreamLostError = WebrpcStreamLostError;
exports.errors = errors;
exports.SequenceIndexerGateway = SequenceIndexerGateway;
exports.SessionExpiredError = SessionExpiredError$1;
exports.SortOrder = SortOrder$1;
exports.TimeoutError = TimeoutError$1;
exports.TransactionStatus = TransactionStatus$1;
exports.TransactionType = TransactionType$1;
exports.TxnTransferType = TxnTransferType$1;
exports.UnauthorizedError = UnauthorizedError$1;
exports.UnavailableError = UnavailableError$1;
exports.WebRPCSchemaHash = WebRPCSchemaHash$1;
exports.WebRPCSchemaVersion = WebRPCSchemaVersion$1;
exports.WebRPCVersion = WebRPCVersion$1;
exports.WebrpcBadMethodError = WebrpcBadMethodError$1;
exports.WebrpcBadRequestError = WebrpcBadRequestError$1;
exports.WebrpcBadResponseError = WebrpcBadResponseError$1;
exports.WebrpcBadRouteError = WebrpcBadRouteError$1;
exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError$1;
exports.WebrpcEndpointError = WebrpcEndpointError$1;
exports.WebrpcError = WebrpcError$1;
exports.WebrpcInternalErrorError = WebrpcInternalErrorError$1;
exports.WebrpcRequestFailedError = WebrpcRequestFailedError$1;
exports.WebrpcServerPanicError = WebrpcServerPanicError$1;
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError$1;
exports.WebrpcStreamLostError = WebrpcStreamLostError$1;
exports.errors = errors$1;

@@ -6,9 +6,14 @@ 'use strict';

function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return n;
}, _extends.apply(null, arguments);
return target;
};
return _extends.apply(this, arguments);
}

@@ -24,9 +29,9 @@

// WebRPC description and code-gen version
const WebRPCVersion = 'v1';
const WebRPCVersion$1 = 'v1';
// Schema version of your RIDL schema
const WebRPCSchemaVersion = 'v0.4.0';
const WebRPCSchemaVersion$1 = 'v0.4.0';
// Schema hash generated from your RIDL schema
const WebRPCSchemaHash = 'cae735346d8e5c3dce48dce9f85116989b6beffd';
const WebRPCSchemaHash$1 = 'cae735346d8e5c3dce48dce9f85116989b6beffd';

@@ -37,3 +42,3 @@ //

let ContractType = /*#__PURE__*/function (ContractType) {
let ContractType$1 = /*#__PURE__*/function (ContractType) {
ContractType["UNKNOWN"] = "UNKNOWN";

@@ -51,3 +56,3 @@ ContractType["NATIVE"] = "NATIVE";

}({});
let EventLogType = /*#__PURE__*/function (EventLogType) {
let EventLogType$1 = /*#__PURE__*/function (EventLogType) {
EventLogType["UNKNOWN"] = "UNKNOWN";

@@ -58,3 +63,3 @@ EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";

}({});
let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
let EventLogDataType$1 = /*#__PURE__*/function (EventLogDataType) {
EventLogDataType["EVENT"] = "EVENT";

@@ -66,3 +71,3 @@ EventLogDataType["TOKEN_TRANSFER"] = "TOKEN_TRANSFER";

}({});
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
let OrderStatus$1 = /*#__PURE__*/function (OrderStatus) {
OrderStatus["OPEN"] = "OPEN";

@@ -73,3 +78,3 @@ OrderStatus["CLOSED"] = "CLOSED";

}({});
let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
let TxnTransferType$1 = /*#__PURE__*/function (TxnTransferType) {
TxnTransferType["UNKNOWN"] = "UNKNOWN";

@@ -80,3 +85,3 @@ TxnTransferType["SEND"] = "SEND";

}({});
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
let TransactionStatus$1 = /*#__PURE__*/function (TransactionStatus) {
TransactionStatus["FAILED"] = "FAILED";

@@ -86,3 +91,3 @@ TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";

}({});
let TransactionType = /*#__PURE__*/function (TransactionType) {
let TransactionType$1 = /*#__PURE__*/function (TransactionType) {
TransactionType["LegacyTxnType"] = "LegacyTxnType";

@@ -93,3 +98,3 @@ TransactionType["AccessListTxnType"] = "AccessListTxnType";

}({});
let SortOrder = /*#__PURE__*/function (SortOrder) {
let SortOrder$1 = /*#__PURE__*/function (SortOrder) {
SortOrder["DESC"] = "DESC";

@@ -99,3 +104,3 @@ SortOrder["ASC"] = "ASC";

}({});
let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
let ContractVerificationStatus$1 = /*#__PURE__*/function (ContractVerificationStatus) {
ContractVerificationStatus["VERIFIED"] = "VERIFIED";

@@ -115,4 +120,4 @@ ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";

this.ping = (headers, signal) => {
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('Ping'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -123,3 +128,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -130,4 +135,4 @@ });

this.version = (headers, signal) => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('Version'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -138,3 +143,3 @@ version: _data.version

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -145,4 +150,4 @@ });

this.runtimeStatus = (headers, signal) => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -153,3 +158,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -160,4 +165,4 @@ });

this.getChainID = (headers, signal) => {
return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetChainID'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -168,3 +173,3 @@ chainID: _data.chainID

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -175,4 +180,4 @@ });

this.getEtherBalance = (args, headers, signal) => {
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -183,3 +188,3 @@ balance: _data.balance

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -190,4 +195,4 @@ });

this.getNativeTokenBalance = (args, headers, signal) => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -198,3 +203,3 @@ balance: _data.balance

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -205,4 +210,4 @@ });

this.getTokenBalancesSummary = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -214,3 +219,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -221,4 +226,4 @@ });

this.getTokenBalancesDetails = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -230,3 +235,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -237,4 +242,4 @@ });

this.getTokenBalancesByContract = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -246,3 +251,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -253,4 +258,4 @@ });

this.getTokenBalances = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -262,3 +267,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -269,4 +274,4 @@ });

this.getTokenSupplies = (args, headers, signal) => {
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -279,3 +284,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -286,4 +291,4 @@ });

this.getTokenSuppliesMap = (args, headers, signal) => {
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -294,3 +299,3 @@ supplies: _data.supplies

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -301,4 +306,4 @@ });

this.getBalanceUpdates = (args, headers, signal) => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -310,3 +315,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -317,4 +322,4 @@ });

this.getTransactionHistory = (args, headers, signal) => {
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -326,3 +331,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -333,8 +338,8 @@ });

this.syncBalance = (args, headers, signal) => {
return this.fetch(this.url('SyncBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('SyncBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {};
});
}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -345,4 +350,4 @@ });

this.fetchTransactionReceipt = (args, headers, signal) => {
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -353,3 +358,3 @@ receipt: _data.receipt

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -360,4 +365,4 @@ });

this.getOrderbookOrders = (args, headers, signal) => {
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -369,3 +374,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -376,4 +381,4 @@ });

this.getTopOrders = (args, headers, signal) => {
return this.fetch(this.url('GetTopOrders'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTopOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -384,3 +389,3 @@ orders: _data.orders

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -391,4 +396,4 @@ });

this.fetchTransactionReceiptWithFilter = (args, headers, signal) => {
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -399,3 +404,3 @@ receipt: _data.receipt

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -406,4 +411,4 @@ });

this.getAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -414,3 +419,3 @@ listeners: _data.listeners

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -421,4 +426,4 @@ });

this.getWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -429,3 +434,3 @@ listener: _data.listener

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -436,4 +441,4 @@ });

this.addWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -445,3 +450,3 @@ status: _data.status,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -452,4 +457,4 @@ });

this.updateWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -460,3 +465,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -467,4 +472,4 @@ });

this.removeWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -475,3 +480,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -482,4 +487,4 @@ });

this.toggleWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -490,3 +495,3 @@ webhookListener: _data.webhookListener

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -497,4 +502,4 @@ });

this.pauseAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -505,3 +510,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -512,4 +517,4 @@ });

this.resumeAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -520,3 +525,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -527,3 +532,3 @@ });

this.subscribeReceipts = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -536,3 +541,3 @@ }, error => {

this.subscribeEvents = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -545,3 +550,3 @@ }, error => {

this.subscribeBalanceUpdates = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -569,3 +574,3 @@ }, error => {

try {
await buildResponse(res);
await buildResponse$1(res);
} catch (error) {

@@ -578,3 +583,3 @@ // @ts-ignore

if (!res.body) {
onError(WebrpcBadResponseError.new({
onError(WebrpcBadResponseError$1.new({
status: res.status,

@@ -619,3 +624,3 @@ cause: 'Invalid response, missing body'

if (error instanceof DOMException && error.name === 'AbortError') {
onError(WebrpcRequestFailedError.new({
onError(WebrpcRequestFailedError$1.new({
message: 'AbortError',

@@ -627,3 +632,3 @@ cause: `AbortError: ${message}`

} else {
onError(WebrpcStreamLostError.new({
onError(WebrpcStreamLostError$1.new({
cause: `reader.read(): ${message}`

@@ -645,3 +650,3 @@ }), retryFetch);

const code = typeof error.code === 'number' ? error.code : 0;
onError((webrpcErrorByCode[code] || WebrpcError).new(error), retryFetch);
onError((webrpcErrorByCode$1[code] || WebrpcError$1).new(error), retryFetch);
return;

@@ -653,3 +658,3 @@ }

}
onError(WebrpcBadResponseError.new({
onError(WebrpcBadResponseError$1.new({
status: res.status,

@@ -670,3 +675,3 @@ // @ts-ignore

};
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
const createHTTPRequest$1 = (body = {}, headers = {}, signal = null) => {
return {

@@ -681,2 +686,530 @@ method: 'POST',

};
const buildResponse$1 = res => {
return res.text().then(text => {
let data;
try {
data = JSON.parse(text);
} catch (error) {
let message = '';
if (error instanceof Error) {
message = error.message;
}
throw WebrpcBadResponseError$1.new({
status: res.status,
cause: `JSON.parse(): ${message}: response text: ${text}`
});
}
if (!res.ok) {
const code = typeof data.code === 'number' ? data.code : 0;
throw (webrpcErrorByCode$1[code] || WebrpcError$1).new(data);
}
return data;
});
};
//
// Errors
//
class WebrpcError$1 extends Error {
constructor(name, code, message, status, cause) {
super(message);
this.name = void 0;
this.code = void 0;
this.message = void 0;
this.status = void 0;
this.cause = void 0;
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
this.msg = void 0;
this.name = name || 'WebrpcError';
this.code = typeof code === 'number' ? code : 0;
this.message = message || `endpoint error ${this.code}`;
this.msg = this.message;
this.status = typeof status === 'number' ? status : 0;
this.cause = cause;
Object.setPrototypeOf(this, WebrpcError$1.prototype);
}
static new(payload) {
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
}
}
// Webrpc errors
class WebrpcEndpointError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcEndpoint', code = 0, message = 'endpoint error', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcEndpointError$1.prototype);
}
}
class WebrpcRequestFailedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcRequestFailed', code = -1, message = 'request failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcRequestFailedError$1.prototype);
}
}
class WebrpcBadRouteError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadRoute', code = -2, message = 'bad route', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadRouteError$1.prototype);
}
}
class WebrpcBadMethodError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadMethod', code = -3, message = 'bad method', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadMethodError$1.prototype);
}
}
class WebrpcBadRequestError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadRequest', code = -4, message = 'bad request', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadRequestError$1.prototype);
}
}
class WebrpcBadResponseError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadResponse', code = -5, message = 'bad response', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadResponseError$1.prototype);
}
}
class WebrpcServerPanicError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcServerPanic', code = -6, message = 'server panic', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcServerPanicError$1.prototype);
}
}
class WebrpcInternalErrorError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcInternalError', code = -7, message = 'internal error', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcInternalErrorError$1.prototype);
}
}
class WebrpcClientDisconnectedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcClientDisconnected', code = -8, message = 'client disconnected', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcClientDisconnectedError$1.prototype);
}
}
class WebrpcStreamLostError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcStreamLost', code = -9, message = 'stream lost', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcStreamLostError$1.prototype);
}
}
class WebrpcStreamFinishedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcStreamFinished', code = -10, message = 'stream finished', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcStreamFinishedError$1.prototype);
}
}
// Schema errors
class UnauthorizedError$1 extends WebrpcError$1 {
constructor(name = 'Unauthorized', code = 1000, message = 'Unauthorized access', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnauthorizedError$1.prototype);
}
}
class PermissionDeniedError$1 extends WebrpcError$1 {
constructor(name = 'PermissionDenied', code = 1001, message = 'Permission denied', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, PermissionDeniedError$1.prototype);
}
}
class SessionExpiredError$1 extends WebrpcError$1 {
constructor(name = 'SessionExpired', code = 1002, message = 'Session expired', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, SessionExpiredError$1.prototype);
}
}
class MethodNotFoundError$1 extends WebrpcError$1 {
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MethodNotFoundError$1.prototype);
}
}
class RequestConflictError$1 extends WebrpcError$1 {
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RequestConflictError$1.prototype);
}
}
class AbortedError$1 extends WebrpcError$1 {
constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AbortedError$1.prototype);
}
}
class TimeoutError$1 extends WebrpcError$1 {
constructor(name = 'Timeout', code = 2000, message = 'Request timed out', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, TimeoutError$1.prototype);
}
}
class InvalidArgumentError$1 extends WebrpcError$1 {
constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidArgumentError$1.prototype);
}
}
class UnavailableError$1 extends WebrpcError$1 {
constructor(name = 'Unavailable', code = 2002, message = 'Unavailable resource', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnavailableError$1.prototype);
}
}
class QueryFailedError$1 extends WebrpcError$1 {
constructor(name = 'QueryFailed', code = 2003, message = 'Query failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, QueryFailedError$1.prototype);
}
}
class ResourceExhaustedError$1 extends WebrpcError$1 {
constructor(name = 'ResourceExhausted', code = 2004, message = 'Resource exhausted', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ResourceExhaustedError$1.prototype);
}
}
class NotFoundError$1 extends WebrpcError$1 {
constructor(name = 'NotFound', code = 3000, message = 'Resource not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, NotFoundError$1.prototype);
}
}
class ProjectNotFoundError$1 extends WebrpcError$1 {
constructor(name = 'ProjectNotFound', code = 3002, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError$1.prototype);
}
}
class MetadataCallFailedError$1 extends WebrpcError$1 {
constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MetadataCallFailedError$1.prototype);
}
}
let errors$1 = /*#__PURE__*/function (errors) {
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
errors["WebrpcBadRoute"] = "WebrpcBadRoute";
errors["WebrpcBadMethod"] = "WebrpcBadMethod";
errors["WebrpcBadRequest"] = "WebrpcBadRequest";
errors["WebrpcBadResponse"] = "WebrpcBadResponse";
errors["WebrpcServerPanic"] = "WebrpcServerPanic";
errors["WebrpcInternalError"] = "WebrpcInternalError";
errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
errors["WebrpcStreamLost"] = "WebrpcStreamLost";
errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
errors["Unauthorized"] = "Unauthorized";
errors["PermissionDenied"] = "PermissionDenied";
errors["SessionExpired"] = "SessionExpired";
errors["MethodNotFound"] = "MethodNotFound";
errors["RequestConflict"] = "RequestConflict";
errors["Aborted"] = "Aborted";
errors["Timeout"] = "Timeout";
errors["InvalidArgument"] = "InvalidArgument";
errors["Unavailable"] = "Unavailable";
errors["QueryFailed"] = "QueryFailed";
errors["ResourceExhausted"] = "ResourceExhausted";
errors["NotFound"] = "NotFound";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["MetadataCallFailed"] = "MetadataCallFailed";
return errors;
}({});
const webrpcErrorByCode$1 = {
[0]: WebrpcEndpointError$1,
[-1]: WebrpcRequestFailedError$1,
[-2]: WebrpcBadRouteError$1,
[-3]: WebrpcBadMethodError$1,
[-4]: WebrpcBadRequestError$1,
[-5]: WebrpcBadResponseError$1,
[-6]: WebrpcServerPanicError$1,
[-7]: WebrpcInternalErrorError$1,
[-8]: WebrpcClientDisconnectedError$1,
[-9]: WebrpcStreamLostError$1,
[-10]: WebrpcStreamFinishedError$1,
[1000]: UnauthorizedError$1,
[1001]: PermissionDeniedError$1,
[1002]: SessionExpiredError$1,
[1003]: MethodNotFoundError$1,
[1004]: RequestConflictError$1,
[1005]: AbortedError$1,
[2000]: TimeoutError$1,
[2001]: InvalidArgumentError$1,
[2002]: UnavailableError$1,
[2003]: QueryFailedError$1,
[2004]: ResourceExhaustedError$1,
[3000]: NotFoundError$1,
[3002]: ProjectNotFoundError$1,
[3003]: MetadataCallFailedError$1
};
/* eslint-disable */
// sequence-indexer v0.4.0 71cd081c5ca2372bf92a897ae1aa4ebf93ffd0fc
// --
// Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT.
//
// webrpc-gen -schema=indexer.ridl -service=IndexerGateway -target=typescript -client -out=./clients/indexergw/indexer.gen.ts
const WebrpcHeader = 'Webrpc';
const WebrpcHeaderValue = 'webrpc@v0.21.1;gen-typescript@v0.15.1;sequence-indexer@v0.4.0';
// WebRPC description and code-gen version
const WebRPCVersion = 'v1';
// Schema version of your RIDL schema
const WebRPCSchemaVersion = 'v0.4.0';
// Schema hash generated from your RIDL schema
const WebRPCSchemaHash = '71cd081c5ca2372bf92a897ae1aa4ebf93ffd0fc';
function VersionFromHeader(headers) {
const headerValue = headers.get(WebrpcHeader);
if (!headerValue) {
return {
webrpcGenVersion: '',
codeGenName: '',
codeGenVersion: '',
schemaName: '',
schemaVersion: ''
};
}
return parseWebrpcGenVersions(headerValue);
}
function parseWebrpcGenVersions(header) {
const versions = header.split(';');
if (versions.length < 3) {
return {
webrpcGenVersion: '',
codeGenName: '',
codeGenVersion: '',
schemaName: '',
schemaVersion: ''
};
}
const [_, webrpcGenVersion] = versions[0].split('@');
const [codeGenName, codeGenVersion] = versions[1].split('@');
const [schemaName, schemaVersion] = versions[2].split('@');
return {
webrpcGenVersion,
codeGenName,
codeGenVersion,
schemaName,
schemaVersion
};
}
//
// Types
//
let ContractType = /*#__PURE__*/function (ContractType) {
ContractType["UNKNOWN"] = "UNKNOWN";
ContractType["NATIVE"] = "NATIVE";
ContractType["ERC20"] = "ERC20";
ContractType["ERC721"] = "ERC721";
ContractType["ERC1155"] = "ERC1155";
ContractType["SEQUENCE_WALLET"] = "SEQUENCE_WALLET";
ContractType["ERC20_BRIDGE"] = "ERC20_BRIDGE";
ContractType["ERC721_BRIDGE"] = "ERC721_BRIDGE";
ContractType["ERC1155_BRIDGE"] = "ERC1155_BRIDGE";
ContractType["SEQ_MARKETPLACE"] = "SEQ_MARKETPLACE";
return ContractType;
}({});
let EventLogType = /*#__PURE__*/function (EventLogType) {
EventLogType["UNKNOWN"] = "UNKNOWN";
EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
return EventLogType;
}({});
let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
EventLogDataType["EVENT"] = "EVENT";
EventLogDataType["TOKEN_TRANSFER"] = "TOKEN_TRANSFER";
EventLogDataType["NATIVE_TOKEN_TRANSFER"] = "NATIVE_TOKEN_TRANSFER";
EventLogDataType["SEQUENCE_TXN"] = "SEQUENCE_TXN";
return EventLogDataType;
}({});
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
OrderStatus["OPEN"] = "OPEN";
OrderStatus["CLOSED"] = "CLOSED";
OrderStatus["CANCELLED"] = "CANCELLED";
return OrderStatus;
}({});
let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
TxnTransferType["UNKNOWN"] = "UNKNOWN";
TxnTransferType["SEND"] = "SEND";
TxnTransferType["RECEIVE"] = "RECEIVE";
return TxnTransferType;
}({});
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
TransactionStatus["FAILED"] = "FAILED";
TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";
return TransactionStatus;
}({});
let TransactionType = /*#__PURE__*/function (TransactionType) {
TransactionType["LegacyTxnType"] = "LegacyTxnType";
TransactionType["AccessListTxnType"] = "AccessListTxnType";
TransactionType["DynamicFeeTxnType"] = "DynamicFeeTxnType";
return TransactionType;
}({});
let SortOrder = /*#__PURE__*/function (SortOrder) {
SortOrder["DESC"] = "DESC";
SortOrder["ASC"] = "ASC";
return SortOrder;
}({});
let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
ContractVerificationStatus["VERIFIED"] = "VERIFIED";
ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
ContractVerificationStatus["ALL"] = "ALL";
return ContractVerificationStatus;
}({});
//
// Client
//
class IndexerGateway {
constructor(hostname, fetch) {
this.hostname = void 0;
this.fetch = void 0;
this.path = '/rpc/IndexerGateway/';
this.getNativeTokenBalance = (args, headers, signal) => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalances = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesSummary = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesDetails = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesByContract = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getBalanceUpdates = (args, headers, signal) => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.ping = (headers, signal) => {
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
status: _data.status
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.version = (headers, signal) => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
version: _data.version
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.runtimeStatus = (headers, signal) => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
status: _data.status
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.hostname = hostname.replace(/\/*$/, '');
this.fetch = (input, init) => fetch(input, init);
}
url(name) {
return this.hostname + this.path + name;
}
}
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
const reqHeaders = _extends({}, headers, {
'Content-Type': 'application/json'
});
reqHeaders[WebrpcHeader] = WebrpcHeaderValue;
return {
method: 'POST',
headers: reqHeaders,
body: JSON.stringify(body || {}),
signal
};
};
const buildResponse = res => {

@@ -839,4 +1372,82 @@ return res.text().then(text => {

}
class GeoblockedError extends WebrpcError {
constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, GeoblockedError.prototype);
}
}
class RateLimitedError extends WebrpcError {
constructor(name = 'RateLimited', code = 1007, message = 'Rate-limited. Please slow down.', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RateLimitedError.prototype);
}
}
class ProjectNotFoundError extends WebrpcError {
constructor(name = 'ProjectNotFound', code = 1100, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
}
}
class AccessKeyNotFoundError extends WebrpcError {
constructor(name = 'AccessKeyNotFound', code = 1101, message = 'Access key not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype);
}
}
class AccessKeyMismatchError extends WebrpcError {
constructor(name = 'AccessKeyMismatch', code = 1102, message = 'Access key mismatch', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype);
}
}
class InvalidOriginError extends WebrpcError {
constructor(name = 'InvalidOrigin', code = 1103, message = 'Invalid origin for Access Key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidOriginError.prototype);
}
}
class InvalidServiceError extends WebrpcError {
constructor(name = 'InvalidService', code = 1104, message = 'Service not enabled for Access key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidServiceError.prototype);
}
}
class UnauthorizedUserError extends WebrpcError {
constructor(name = 'UnauthorizedUser', code = 1105, message = 'Unauthorized user', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnauthorizedUserError.prototype);
}
}
class QuotaExceededError extends WebrpcError {
constructor(name = 'QuotaExceeded', code = 1200, message = 'Quota exceeded', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, QuotaExceededError.prototype);
}
}
class RateLimitError extends WebrpcError {
constructor(name = 'RateLimit', code = 1201, message = 'Rate limit exceeded', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RateLimitError.prototype);
}
}
class NoDefaultKeyError extends WebrpcError {
constructor(name = 'NoDefaultKey', code = 1300, message = 'No default access key found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, NoDefaultKeyError.prototype);
}
}
class MaxAccessKeysError extends WebrpcError {
constructor(name = 'MaxAccessKeys', code = 1301, message = 'Access keys limit reached', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MaxAccessKeysError.prototype);
}
}
class AtLeastOneKeyError extends WebrpcError {
constructor(name = 'AtLeastOneKey', code = 1302, message = 'You need at least one Access Key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype);
}
}
class TimeoutError extends WebrpcError {
constructor(name = 'Timeout', code = 2000, message = 'Request timed out', status = 0, cause) {
constructor(name = 'Timeout', code = 1900, message = 'Request timed out', status = 0, cause) {
super(name, code, message, status, cause);

@@ -876,8 +1487,2 @@ Object.setPrototypeOf(this, TimeoutError.prototype);

}
class ProjectNotFoundError extends WebrpcError {
constructor(name = 'ProjectNotFound', code = 3002, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
}
}
class MetadataCallFailedError extends WebrpcError {

@@ -907,2 +1512,15 @@ constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {

errors["Aborted"] = "Aborted";
errors["Geoblocked"] = "Geoblocked";
errors["RateLimited"] = "RateLimited";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["AccessKeyNotFound"] = "AccessKeyNotFound";
errors["AccessKeyMismatch"] = "AccessKeyMismatch";
errors["InvalidOrigin"] = "InvalidOrigin";
errors["InvalidService"] = "InvalidService";
errors["UnauthorizedUser"] = "UnauthorizedUser";
errors["QuotaExceeded"] = "QuotaExceeded";
errors["RateLimit"] = "RateLimit";
errors["NoDefaultKey"] = "NoDefaultKey";
errors["MaxAccessKeys"] = "MaxAccessKeys";
errors["AtLeastOneKey"] = "AtLeastOneKey";
errors["Timeout"] = "Timeout";

@@ -914,3 +1532,2 @@ errors["InvalidArgument"] = "InvalidArgument";

errors["NotFound"] = "NotFound";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["MetadataCallFailed"] = "MetadataCallFailed";

@@ -937,3 +1554,16 @@ return errors;

[1005]: AbortedError,
[2000]: TimeoutError,
[1006]: GeoblockedError,
[1007]: RateLimitedError,
[1100]: ProjectNotFoundError,
[1101]: AccessKeyNotFoundError,
[1102]: AccessKeyMismatchError,
[1103]: InvalidOriginError,
[1104]: InvalidServiceError,
[1105]: UnauthorizedUserError,
[1200]: QuotaExceededError,
[1201]: RateLimitError,
[1300]: NoDefaultKeyError,
[1301]: MaxAccessKeysError,
[1302]: AtLeastOneKeyError,
[1900]: TimeoutError,
[2001]: InvalidArgumentError,

@@ -944,7 +1574,64 @@ [2002]: UnavailableError,

[3000]: NotFoundError,
[3002]: ProjectNotFoundError,
[3003]: MetadataCallFailedError
};
const fetch = globalThis.fetch;
var indexergw_gen = /*#__PURE__*/Object.freeze({
__proto__: null,
WebrpcHeader: WebrpcHeader,
WebrpcHeaderValue: WebrpcHeaderValue,
WebRPCVersion: WebRPCVersion,
WebRPCSchemaVersion: WebRPCSchemaVersion,
WebRPCSchemaHash: WebRPCSchemaHash,
VersionFromHeader: VersionFromHeader,
ContractType: ContractType,
EventLogType: EventLogType,
EventLogDataType: EventLogDataType,
OrderStatus: OrderStatus,
TxnTransferType: TxnTransferType,
TransactionStatus: TransactionStatus,
TransactionType: TransactionType,
SortOrder: SortOrder,
ContractVerificationStatus: ContractVerificationStatus,
IndexerGateway: IndexerGateway,
WebrpcError: WebrpcError,
WebrpcEndpointError: WebrpcEndpointError,
WebrpcRequestFailedError: WebrpcRequestFailedError,
WebrpcBadRouteError: WebrpcBadRouteError,
WebrpcBadMethodError: WebrpcBadMethodError,
WebrpcBadRequestError: WebrpcBadRequestError,
WebrpcBadResponseError: WebrpcBadResponseError,
WebrpcServerPanicError: WebrpcServerPanicError,
WebrpcInternalErrorError: WebrpcInternalErrorError,
WebrpcClientDisconnectedError: WebrpcClientDisconnectedError,
WebrpcStreamLostError: WebrpcStreamLostError,
WebrpcStreamFinishedError: WebrpcStreamFinishedError,
UnauthorizedError: UnauthorizedError,
PermissionDeniedError: PermissionDeniedError,
SessionExpiredError: SessionExpiredError,
MethodNotFoundError: MethodNotFoundError,
RequestConflictError: RequestConflictError,
AbortedError: AbortedError,
GeoblockedError: GeoblockedError,
RateLimitedError: RateLimitedError,
ProjectNotFoundError: ProjectNotFoundError,
AccessKeyNotFoundError: AccessKeyNotFoundError,
AccessKeyMismatchError: AccessKeyMismatchError,
InvalidOriginError: InvalidOriginError,
InvalidServiceError: InvalidServiceError,
UnauthorizedUserError: UnauthorizedUserError,
QuotaExceededError: QuotaExceededError,
RateLimitError: RateLimitError,
NoDefaultKeyError: NoDefaultKeyError,
MaxAccessKeysError: MaxAccessKeysError,
AtLeastOneKeyError: AtLeastOneKeyError,
TimeoutError: TimeoutError,
InvalidArgumentError: InvalidArgumentError,
UnavailableError: UnavailableError,
QueryFailedError: QueryFailedError,
ResourceExhaustedError: ResourceExhaustedError,
NotFoundError: NotFoundError,
MetadataCallFailedError: MetadataCallFailedError,
errors: errors
});
class SequenceIndexer extends Indexer {

@@ -975,43 +1662,70 @@ constructor(hostname, projectAccessKey, jwtAuth) {

}
class SequenceIndexerGateway extends IndexerGateway {
constructor(hostname, projectAccessKey, jwtAuth) {
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
this.projectAccessKey = projectAccessKey;
this.jwtAuth = jwtAuth;
this._fetch = (input, init) => {
// automatically include jwt and access key auth header to requests
// if its been set on the api client
const headers = {};
const jwtAuth = this.jwtAuth;
const projectAccessKey = this.projectAccessKey;
if (jwtAuth && jwtAuth.length > 0) {
headers['Authorization'] = `BEARER ${jwtAuth}`;
}
if (projectAccessKey && projectAccessKey.length > 0) {
headers['X-Access-Key'] = projectAccessKey;
}
exports.AbortedError = AbortedError;
exports.ContractType = ContractType;
exports.ContractVerificationStatus = ContractVerificationStatus;
exports.EventLogDataType = EventLogDataType;
exports.EventLogType = EventLogType;
// before the request is made
init.headers = _extends({}, init.headers, headers);
return fetch(input, init);
};
this.fetch = this._fetch;
}
}
exports.AbortedError = AbortedError$1;
exports.ContractType = ContractType$1;
exports.ContractVerificationStatus = ContractVerificationStatus$1;
exports.EventLogDataType = EventLogDataType$1;
exports.EventLogType = EventLogType$1;
exports.Indexer = Indexer;
exports.InvalidArgumentError = InvalidArgumentError;
exports.MetadataCallFailedError = MetadataCallFailedError;
exports.MethodNotFoundError = MethodNotFoundError;
exports.NotFoundError = NotFoundError;
exports.OrderStatus = OrderStatus;
exports.PermissionDeniedError = PermissionDeniedError;
exports.ProjectNotFoundError = ProjectNotFoundError;
exports.QueryFailedError = QueryFailedError;
exports.RequestConflictError = RequestConflictError;
exports.ResourceExhaustedError = ResourceExhaustedError;
exports.IndexerGateway = indexergw_gen;
exports.InvalidArgumentError = InvalidArgumentError$1;
exports.MetadataCallFailedError = MetadataCallFailedError$1;
exports.MethodNotFoundError = MethodNotFoundError$1;
exports.NotFoundError = NotFoundError$1;
exports.OrderStatus = OrderStatus$1;
exports.PermissionDeniedError = PermissionDeniedError$1;
exports.ProjectNotFoundError = ProjectNotFoundError$1;
exports.QueryFailedError = QueryFailedError$1;
exports.RequestConflictError = RequestConflictError$1;
exports.ResourceExhaustedError = ResourceExhaustedError$1;
exports.SequenceIndexer = SequenceIndexer;
exports.SessionExpiredError = SessionExpiredError;
exports.SortOrder = SortOrder;
exports.TimeoutError = TimeoutError;
exports.TransactionStatus = TransactionStatus;
exports.TransactionType = TransactionType;
exports.TxnTransferType = TxnTransferType;
exports.UnauthorizedError = UnauthorizedError;
exports.UnavailableError = UnavailableError;
exports.WebRPCSchemaHash = WebRPCSchemaHash;
exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
exports.WebRPCVersion = WebRPCVersion;
exports.WebrpcBadMethodError = WebrpcBadMethodError;
exports.WebrpcBadRequestError = WebrpcBadRequestError;
exports.WebrpcBadResponseError = WebrpcBadResponseError;
exports.WebrpcBadRouteError = WebrpcBadRouteError;
exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError;
exports.WebrpcEndpointError = WebrpcEndpointError;
exports.WebrpcError = WebrpcError;
exports.WebrpcInternalErrorError = WebrpcInternalErrorError;
exports.WebrpcRequestFailedError = WebrpcRequestFailedError;
exports.WebrpcServerPanicError = WebrpcServerPanicError;
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError;
exports.WebrpcStreamLostError = WebrpcStreamLostError;
exports.errors = errors;
exports.SequenceIndexerGateway = SequenceIndexerGateway;
exports.SessionExpiredError = SessionExpiredError$1;
exports.SortOrder = SortOrder$1;
exports.TimeoutError = TimeoutError$1;
exports.TransactionStatus = TransactionStatus$1;
exports.TransactionType = TransactionType$1;
exports.TxnTransferType = TxnTransferType$1;
exports.UnauthorizedError = UnauthorizedError$1;
exports.UnavailableError = UnavailableError$1;
exports.WebRPCSchemaHash = WebRPCSchemaHash$1;
exports.WebRPCSchemaVersion = WebRPCSchemaVersion$1;
exports.WebRPCVersion = WebRPCVersion$1;
exports.WebrpcBadMethodError = WebrpcBadMethodError$1;
exports.WebrpcBadRequestError = WebrpcBadRequestError$1;
exports.WebrpcBadResponseError = WebrpcBadResponseError$1;
exports.WebrpcBadRouteError = WebrpcBadRouteError$1;
exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError$1;
exports.WebrpcEndpointError = WebrpcEndpointError$1;
exports.WebrpcError = WebrpcError$1;
exports.WebrpcInternalErrorError = WebrpcInternalErrorError$1;
exports.WebrpcRequestFailedError = WebrpcRequestFailedError$1;
exports.WebrpcServerPanicError = WebrpcServerPanicError$1;
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError$1;
exports.WebrpcStreamLostError = WebrpcStreamLostError$1;
exports.errors = errors$1;
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return n;
}, _extends.apply(null, arguments);
return target;
};
return _extends.apply(this, arguments);
}

@@ -19,9 +24,9 @@

// WebRPC description and code-gen version
const WebRPCVersion = 'v1';
const WebRPCVersion$1 = 'v1';
// Schema version of your RIDL schema
const WebRPCSchemaVersion = 'v0.4.0';
const WebRPCSchemaVersion$1 = 'v0.4.0';
// Schema hash generated from your RIDL schema
const WebRPCSchemaHash = 'cae735346d8e5c3dce48dce9f85116989b6beffd';
const WebRPCSchemaHash$1 = 'cae735346d8e5c3dce48dce9f85116989b6beffd';

@@ -32,3 +37,3 @@ //

let ContractType = /*#__PURE__*/function (ContractType) {
let ContractType$1 = /*#__PURE__*/function (ContractType) {
ContractType["UNKNOWN"] = "UNKNOWN";

@@ -46,3 +51,3 @@ ContractType["NATIVE"] = "NATIVE";

}({});
let EventLogType = /*#__PURE__*/function (EventLogType) {
let EventLogType$1 = /*#__PURE__*/function (EventLogType) {
EventLogType["UNKNOWN"] = "UNKNOWN";

@@ -53,3 +58,3 @@ EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";

}({});
let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
let EventLogDataType$1 = /*#__PURE__*/function (EventLogDataType) {
EventLogDataType["EVENT"] = "EVENT";

@@ -61,3 +66,3 @@ EventLogDataType["TOKEN_TRANSFER"] = "TOKEN_TRANSFER";

}({});
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
let OrderStatus$1 = /*#__PURE__*/function (OrderStatus) {
OrderStatus["OPEN"] = "OPEN";

@@ -68,3 +73,3 @@ OrderStatus["CLOSED"] = "CLOSED";

}({});
let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
let TxnTransferType$1 = /*#__PURE__*/function (TxnTransferType) {
TxnTransferType["UNKNOWN"] = "UNKNOWN";

@@ -75,3 +80,3 @@ TxnTransferType["SEND"] = "SEND";

}({});
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
let TransactionStatus$1 = /*#__PURE__*/function (TransactionStatus) {
TransactionStatus["FAILED"] = "FAILED";

@@ -81,3 +86,3 @@ TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";

}({});
let TransactionType = /*#__PURE__*/function (TransactionType) {
let TransactionType$1 = /*#__PURE__*/function (TransactionType) {
TransactionType["LegacyTxnType"] = "LegacyTxnType";

@@ -88,3 +93,3 @@ TransactionType["AccessListTxnType"] = "AccessListTxnType";

}({});
let SortOrder = /*#__PURE__*/function (SortOrder) {
let SortOrder$1 = /*#__PURE__*/function (SortOrder) {
SortOrder["DESC"] = "DESC";

@@ -94,3 +99,3 @@ SortOrder["ASC"] = "ASC";

}({});
let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
let ContractVerificationStatus$1 = /*#__PURE__*/function (ContractVerificationStatus) {
ContractVerificationStatus["VERIFIED"] = "VERIFIED";

@@ -110,4 +115,4 @@ ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";

this.ping = (headers, signal) => {
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('Ping'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -118,3 +123,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -125,4 +130,4 @@ });

this.version = (headers, signal) => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('Version'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -133,3 +138,3 @@ version: _data.version

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -140,4 +145,4 @@ });

this.runtimeStatus = (headers, signal) => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -148,3 +153,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -155,4 +160,4 @@ });

this.getChainID = (headers, signal) => {
return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetChainID'), createHTTPRequest$1({}, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -163,3 +168,3 @@ chainID: _data.chainID

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -170,4 +175,4 @@ });

this.getEtherBalance = (args, headers, signal) => {
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetEtherBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -178,3 +183,3 @@ balance: _data.balance

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -185,4 +190,4 @@ });

this.getNativeTokenBalance = (args, headers, signal) => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -193,3 +198,3 @@ balance: _data.balance

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -200,4 +205,4 @@ });

this.getTokenBalancesSummary = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -209,3 +214,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -216,4 +221,4 @@ });

this.getTokenBalancesDetails = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -225,3 +230,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -232,4 +237,4 @@ });

this.getTokenBalancesByContract = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -241,3 +246,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -248,4 +253,4 @@ });

this.getTokenBalances = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -257,3 +262,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -264,4 +269,4 @@ });

this.getTokenSupplies = (args, headers, signal) => {
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -274,3 +279,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -281,4 +286,4 @@ });

this.getTokenSuppliesMap = (args, headers, signal) => {
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -289,3 +294,3 @@ supplies: _data.supplies

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -296,4 +301,4 @@ });

this.getBalanceUpdates = (args, headers, signal) => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -305,3 +310,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -312,4 +317,4 @@ });

this.getTransactionHistory = (args, headers, signal) => {
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -321,3 +326,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -328,8 +333,8 @@ });

this.syncBalance = (args, headers, signal) => {
return this.fetch(this.url('SyncBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('SyncBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {};
});
}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -340,4 +345,4 @@ });

this.fetchTransactionReceipt = (args, headers, signal) => {
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -348,3 +353,3 @@ receipt: _data.receipt

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -355,4 +360,4 @@ });

this.getOrderbookOrders = (args, headers, signal) => {
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -364,3 +369,3 @@ page: _data.page,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -371,4 +376,4 @@ });

this.getTopOrders = (args, headers, signal) => {
return this.fetch(this.url('GetTopOrders'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetTopOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -379,3 +384,3 @@ orders: _data.orders

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -386,4 +391,4 @@ });

this.fetchTransactionReceiptWithFilter = (args, headers, signal) => {
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -394,3 +399,3 @@ receipt: _data.receipt

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -401,4 +406,4 @@ });

this.getAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -409,3 +414,3 @@ listeners: _data.listeners

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -416,4 +421,4 @@ });

this.getWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('GetWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -424,3 +429,3 @@ listener: _data.listener

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -431,4 +436,4 @@ });

this.addWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('AddWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -440,3 +445,3 @@ status: _data.status,

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -447,4 +452,4 @@ });

this.updateWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -455,3 +460,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -462,4 +467,4 @@ });

this.removeWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -470,3 +475,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -477,4 +482,4 @@ });

this.toggleWebhookListener = (args, headers, signal) => {
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -485,3 +490,3 @@ webhookListener: _data.webhookListener

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -492,4 +497,4 @@ });

this.pauseAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -500,3 +505,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -507,4 +512,4 @@ });

this.resumeAllWebhookListeners = (args, headers, signal) => {
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
return buildResponse$1(res).then(_data => {
return {

@@ -515,3 +520,3 @@ status: _data.status

}, error => {
throw WebrpcRequestFailedError.new({
throw WebrpcRequestFailedError$1.new({
cause: `fetch(): ${error.message || ''}`

@@ -522,3 +527,3 @@ });

this.subscribeReceipts = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -531,3 +536,3 @@ }, error => {

this.subscribeEvents = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -540,3 +545,3 @@ }, error => {

this.subscribeBalanceUpdates = (args, options) => {
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest(args, options.headers, options.signal)).then(async function (res) {
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
await sseResponse(res, options, _fetch);

@@ -564,3 +569,3 @@ }, error => {

try {
await buildResponse(res);
await buildResponse$1(res);
} catch (error) {

@@ -573,3 +578,3 @@ // @ts-ignore

if (!res.body) {
onError(WebrpcBadResponseError.new({
onError(WebrpcBadResponseError$1.new({
status: res.status,

@@ -614,3 +619,3 @@ cause: 'Invalid response, missing body'

if (error instanceof DOMException && error.name === 'AbortError') {
onError(WebrpcRequestFailedError.new({
onError(WebrpcRequestFailedError$1.new({
message: 'AbortError',

@@ -622,3 +627,3 @@ cause: `AbortError: ${message}`

} else {
onError(WebrpcStreamLostError.new({
onError(WebrpcStreamLostError$1.new({
cause: `reader.read(): ${message}`

@@ -640,3 +645,3 @@ }), retryFetch);

const code = typeof error.code === 'number' ? error.code : 0;
onError((webrpcErrorByCode[code] || WebrpcError).new(error), retryFetch);
onError((webrpcErrorByCode$1[code] || WebrpcError$1).new(error), retryFetch);
return;

@@ -648,3 +653,3 @@ }

}
onError(WebrpcBadResponseError.new({
onError(WebrpcBadResponseError$1.new({
status: res.status,

@@ -665,3 +670,3 @@ // @ts-ignore

};
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
const createHTTPRequest$1 = (body = {}, headers = {}, signal = null) => {
return {

@@ -676,2 +681,530 @@ method: 'POST',

};
const buildResponse$1 = res => {
return res.text().then(text => {
let data;
try {
data = JSON.parse(text);
} catch (error) {
let message = '';
if (error instanceof Error) {
message = error.message;
}
throw WebrpcBadResponseError$1.new({
status: res.status,
cause: `JSON.parse(): ${message}: response text: ${text}`
});
}
if (!res.ok) {
const code = typeof data.code === 'number' ? data.code : 0;
throw (webrpcErrorByCode$1[code] || WebrpcError$1).new(data);
}
return data;
});
};
//
// Errors
//
class WebrpcError$1 extends Error {
constructor(name, code, message, status, cause) {
super(message);
this.name = void 0;
this.code = void 0;
this.message = void 0;
this.status = void 0;
this.cause = void 0;
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
this.msg = void 0;
this.name = name || 'WebrpcError';
this.code = typeof code === 'number' ? code : 0;
this.message = message || `endpoint error ${this.code}`;
this.msg = this.message;
this.status = typeof status === 'number' ? status : 0;
this.cause = cause;
Object.setPrototypeOf(this, WebrpcError$1.prototype);
}
static new(payload) {
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
}
}
// Webrpc errors
class WebrpcEndpointError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcEndpoint', code = 0, message = 'endpoint error', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcEndpointError$1.prototype);
}
}
class WebrpcRequestFailedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcRequestFailed', code = -1, message = 'request failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcRequestFailedError$1.prototype);
}
}
class WebrpcBadRouteError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadRoute', code = -2, message = 'bad route', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadRouteError$1.prototype);
}
}
class WebrpcBadMethodError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadMethod', code = -3, message = 'bad method', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadMethodError$1.prototype);
}
}
class WebrpcBadRequestError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadRequest', code = -4, message = 'bad request', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadRequestError$1.prototype);
}
}
class WebrpcBadResponseError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcBadResponse', code = -5, message = 'bad response', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcBadResponseError$1.prototype);
}
}
class WebrpcServerPanicError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcServerPanic', code = -6, message = 'server panic', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcServerPanicError$1.prototype);
}
}
class WebrpcInternalErrorError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcInternalError', code = -7, message = 'internal error', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcInternalErrorError$1.prototype);
}
}
class WebrpcClientDisconnectedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcClientDisconnected', code = -8, message = 'client disconnected', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcClientDisconnectedError$1.prototype);
}
}
class WebrpcStreamLostError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcStreamLost', code = -9, message = 'stream lost', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcStreamLostError$1.prototype);
}
}
class WebrpcStreamFinishedError$1 extends WebrpcError$1 {
constructor(name = 'WebrpcStreamFinished', code = -10, message = 'stream finished', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, WebrpcStreamFinishedError$1.prototype);
}
}
// Schema errors
class UnauthorizedError$1 extends WebrpcError$1 {
constructor(name = 'Unauthorized', code = 1000, message = 'Unauthorized access', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnauthorizedError$1.prototype);
}
}
class PermissionDeniedError$1 extends WebrpcError$1 {
constructor(name = 'PermissionDenied', code = 1001, message = 'Permission denied', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, PermissionDeniedError$1.prototype);
}
}
class SessionExpiredError$1 extends WebrpcError$1 {
constructor(name = 'SessionExpired', code = 1002, message = 'Session expired', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, SessionExpiredError$1.prototype);
}
}
class MethodNotFoundError$1 extends WebrpcError$1 {
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MethodNotFoundError$1.prototype);
}
}
class RequestConflictError$1 extends WebrpcError$1 {
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RequestConflictError$1.prototype);
}
}
class AbortedError$1 extends WebrpcError$1 {
constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AbortedError$1.prototype);
}
}
class TimeoutError$1 extends WebrpcError$1 {
constructor(name = 'Timeout', code = 2000, message = 'Request timed out', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, TimeoutError$1.prototype);
}
}
class InvalidArgumentError$1 extends WebrpcError$1 {
constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidArgumentError$1.prototype);
}
}
class UnavailableError$1 extends WebrpcError$1 {
constructor(name = 'Unavailable', code = 2002, message = 'Unavailable resource', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnavailableError$1.prototype);
}
}
class QueryFailedError$1 extends WebrpcError$1 {
constructor(name = 'QueryFailed', code = 2003, message = 'Query failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, QueryFailedError$1.prototype);
}
}
class ResourceExhaustedError$1 extends WebrpcError$1 {
constructor(name = 'ResourceExhausted', code = 2004, message = 'Resource exhausted', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ResourceExhaustedError$1.prototype);
}
}
class NotFoundError$1 extends WebrpcError$1 {
constructor(name = 'NotFound', code = 3000, message = 'Resource not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, NotFoundError$1.prototype);
}
}
class ProjectNotFoundError$1 extends WebrpcError$1 {
constructor(name = 'ProjectNotFound', code = 3002, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError$1.prototype);
}
}
class MetadataCallFailedError$1 extends WebrpcError$1 {
constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MetadataCallFailedError$1.prototype);
}
}
let errors$1 = /*#__PURE__*/function (errors) {
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
errors["WebrpcBadRoute"] = "WebrpcBadRoute";
errors["WebrpcBadMethod"] = "WebrpcBadMethod";
errors["WebrpcBadRequest"] = "WebrpcBadRequest";
errors["WebrpcBadResponse"] = "WebrpcBadResponse";
errors["WebrpcServerPanic"] = "WebrpcServerPanic";
errors["WebrpcInternalError"] = "WebrpcInternalError";
errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
errors["WebrpcStreamLost"] = "WebrpcStreamLost";
errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
errors["Unauthorized"] = "Unauthorized";
errors["PermissionDenied"] = "PermissionDenied";
errors["SessionExpired"] = "SessionExpired";
errors["MethodNotFound"] = "MethodNotFound";
errors["RequestConflict"] = "RequestConflict";
errors["Aborted"] = "Aborted";
errors["Timeout"] = "Timeout";
errors["InvalidArgument"] = "InvalidArgument";
errors["Unavailable"] = "Unavailable";
errors["QueryFailed"] = "QueryFailed";
errors["ResourceExhausted"] = "ResourceExhausted";
errors["NotFound"] = "NotFound";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["MetadataCallFailed"] = "MetadataCallFailed";
return errors;
}({});
const webrpcErrorByCode$1 = {
[0]: WebrpcEndpointError$1,
[-1]: WebrpcRequestFailedError$1,
[-2]: WebrpcBadRouteError$1,
[-3]: WebrpcBadMethodError$1,
[-4]: WebrpcBadRequestError$1,
[-5]: WebrpcBadResponseError$1,
[-6]: WebrpcServerPanicError$1,
[-7]: WebrpcInternalErrorError$1,
[-8]: WebrpcClientDisconnectedError$1,
[-9]: WebrpcStreamLostError$1,
[-10]: WebrpcStreamFinishedError$1,
[1000]: UnauthorizedError$1,
[1001]: PermissionDeniedError$1,
[1002]: SessionExpiredError$1,
[1003]: MethodNotFoundError$1,
[1004]: RequestConflictError$1,
[1005]: AbortedError$1,
[2000]: TimeoutError$1,
[2001]: InvalidArgumentError$1,
[2002]: UnavailableError$1,
[2003]: QueryFailedError$1,
[2004]: ResourceExhaustedError$1,
[3000]: NotFoundError$1,
[3002]: ProjectNotFoundError$1,
[3003]: MetadataCallFailedError$1
};
/* eslint-disable */
// sequence-indexer v0.4.0 71cd081c5ca2372bf92a897ae1aa4ebf93ffd0fc
// --
// Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT.
//
// webrpc-gen -schema=indexer.ridl -service=IndexerGateway -target=typescript -client -out=./clients/indexergw/indexer.gen.ts
const WebrpcHeader = 'Webrpc';
const WebrpcHeaderValue = 'webrpc@v0.21.1;gen-typescript@v0.15.1;sequence-indexer@v0.4.0';
// WebRPC description and code-gen version
const WebRPCVersion = 'v1';
// Schema version of your RIDL schema
const WebRPCSchemaVersion = 'v0.4.0';
// Schema hash generated from your RIDL schema
const WebRPCSchemaHash = '71cd081c5ca2372bf92a897ae1aa4ebf93ffd0fc';
function VersionFromHeader(headers) {
const headerValue = headers.get(WebrpcHeader);
if (!headerValue) {
return {
webrpcGenVersion: '',
codeGenName: '',
codeGenVersion: '',
schemaName: '',
schemaVersion: ''
};
}
return parseWebrpcGenVersions(headerValue);
}
function parseWebrpcGenVersions(header) {
const versions = header.split(';');
if (versions.length < 3) {
return {
webrpcGenVersion: '',
codeGenName: '',
codeGenVersion: '',
schemaName: '',
schemaVersion: ''
};
}
const [_, webrpcGenVersion] = versions[0].split('@');
const [codeGenName, codeGenVersion] = versions[1].split('@');
const [schemaName, schemaVersion] = versions[2].split('@');
return {
webrpcGenVersion,
codeGenName,
codeGenVersion,
schemaName,
schemaVersion
};
}
//
// Types
//
let ContractType = /*#__PURE__*/function (ContractType) {
ContractType["UNKNOWN"] = "UNKNOWN";
ContractType["NATIVE"] = "NATIVE";
ContractType["ERC20"] = "ERC20";
ContractType["ERC721"] = "ERC721";
ContractType["ERC1155"] = "ERC1155";
ContractType["SEQUENCE_WALLET"] = "SEQUENCE_WALLET";
ContractType["ERC20_BRIDGE"] = "ERC20_BRIDGE";
ContractType["ERC721_BRIDGE"] = "ERC721_BRIDGE";
ContractType["ERC1155_BRIDGE"] = "ERC1155_BRIDGE";
ContractType["SEQ_MARKETPLACE"] = "SEQ_MARKETPLACE";
return ContractType;
}({});
let EventLogType = /*#__PURE__*/function (EventLogType) {
EventLogType["UNKNOWN"] = "UNKNOWN";
EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
return EventLogType;
}({});
let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
EventLogDataType["EVENT"] = "EVENT";
EventLogDataType["TOKEN_TRANSFER"] = "TOKEN_TRANSFER";
EventLogDataType["NATIVE_TOKEN_TRANSFER"] = "NATIVE_TOKEN_TRANSFER";
EventLogDataType["SEQUENCE_TXN"] = "SEQUENCE_TXN";
return EventLogDataType;
}({});
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
OrderStatus["OPEN"] = "OPEN";
OrderStatus["CLOSED"] = "CLOSED";
OrderStatus["CANCELLED"] = "CANCELLED";
return OrderStatus;
}({});
let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
TxnTransferType["UNKNOWN"] = "UNKNOWN";
TxnTransferType["SEND"] = "SEND";
TxnTransferType["RECEIVE"] = "RECEIVE";
return TxnTransferType;
}({});
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
TransactionStatus["FAILED"] = "FAILED";
TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";
return TransactionStatus;
}({});
let TransactionType = /*#__PURE__*/function (TransactionType) {
TransactionType["LegacyTxnType"] = "LegacyTxnType";
TransactionType["AccessListTxnType"] = "AccessListTxnType";
TransactionType["DynamicFeeTxnType"] = "DynamicFeeTxnType";
return TransactionType;
}({});
let SortOrder = /*#__PURE__*/function (SortOrder) {
SortOrder["DESC"] = "DESC";
SortOrder["ASC"] = "ASC";
return SortOrder;
}({});
let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
ContractVerificationStatus["VERIFIED"] = "VERIFIED";
ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
ContractVerificationStatus["ALL"] = "ALL";
return ContractVerificationStatus;
}({});
//
// Client
//
class IndexerGateway {
constructor(hostname, fetch) {
this.hostname = void 0;
this.fetch = void 0;
this.path = '/rpc/IndexerGateway/';
this.getNativeTokenBalance = (args, headers, signal) => {
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalances = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesSummary = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesDetails = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getTokenBalancesByContract = (args, headers, signal) => {
return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.getBalanceUpdates = (args, headers, signal) => {
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
page: _data.page,
balances: _data.balances
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.ping = (headers, signal) => {
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
status: _data.status
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.version = (headers, signal) => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
version: _data.version
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.runtimeStatus = (headers, signal) => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
return buildResponse(res).then(_data => {
return {
status: _data.status
};
});
}, error => {
throw WebrpcRequestFailedError.new({
cause: `fetch(): ${error.message || ''}`
});
});
};
this.hostname = hostname.replace(/\/*$/, '');
this.fetch = (input, init) => fetch(input, init);
}
url(name) {
return this.hostname + this.path + name;
}
}
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
const reqHeaders = _extends({}, headers, {
'Content-Type': 'application/json'
});
reqHeaders[WebrpcHeader] = WebrpcHeaderValue;
return {
method: 'POST',
headers: reqHeaders,
body: JSON.stringify(body || {}),
signal
};
};
const buildResponse = res => {

@@ -834,4 +1367,82 @@ return res.text().then(text => {

}
class GeoblockedError extends WebrpcError {
constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, GeoblockedError.prototype);
}
}
class RateLimitedError extends WebrpcError {
constructor(name = 'RateLimited', code = 1007, message = 'Rate-limited. Please slow down.', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RateLimitedError.prototype);
}
}
class ProjectNotFoundError extends WebrpcError {
constructor(name = 'ProjectNotFound', code = 1100, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
}
}
class AccessKeyNotFoundError extends WebrpcError {
constructor(name = 'AccessKeyNotFound', code = 1101, message = 'Access key not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype);
}
}
class AccessKeyMismatchError extends WebrpcError {
constructor(name = 'AccessKeyMismatch', code = 1102, message = 'Access key mismatch', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype);
}
}
class InvalidOriginError extends WebrpcError {
constructor(name = 'InvalidOrigin', code = 1103, message = 'Invalid origin for Access Key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidOriginError.prototype);
}
}
class InvalidServiceError extends WebrpcError {
constructor(name = 'InvalidService', code = 1104, message = 'Service not enabled for Access key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, InvalidServiceError.prototype);
}
}
class UnauthorizedUserError extends WebrpcError {
constructor(name = 'UnauthorizedUser', code = 1105, message = 'Unauthorized user', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, UnauthorizedUserError.prototype);
}
}
class QuotaExceededError extends WebrpcError {
constructor(name = 'QuotaExceeded', code = 1200, message = 'Quota exceeded', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, QuotaExceededError.prototype);
}
}
class RateLimitError extends WebrpcError {
constructor(name = 'RateLimit', code = 1201, message = 'Rate limit exceeded', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, RateLimitError.prototype);
}
}
class NoDefaultKeyError extends WebrpcError {
constructor(name = 'NoDefaultKey', code = 1300, message = 'No default access key found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, NoDefaultKeyError.prototype);
}
}
class MaxAccessKeysError extends WebrpcError {
constructor(name = 'MaxAccessKeys', code = 1301, message = 'Access keys limit reached', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, MaxAccessKeysError.prototype);
}
}
class AtLeastOneKeyError extends WebrpcError {
constructor(name = 'AtLeastOneKey', code = 1302, message = 'You need at least one Access Key', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype);
}
}
class TimeoutError extends WebrpcError {
constructor(name = 'Timeout', code = 2000, message = 'Request timed out', status = 0, cause) {
constructor(name = 'Timeout', code = 1900, message = 'Request timed out', status = 0, cause) {
super(name, code, message, status, cause);

@@ -871,8 +1482,2 @@ Object.setPrototypeOf(this, TimeoutError.prototype);

}
class ProjectNotFoundError extends WebrpcError {
constructor(name = 'ProjectNotFound', code = 3002, message = 'Project not found', status = 0, cause) {
super(name, code, message, status, cause);
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
}
}
class MetadataCallFailedError extends WebrpcError {

@@ -902,2 +1507,15 @@ constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {

errors["Aborted"] = "Aborted";
errors["Geoblocked"] = "Geoblocked";
errors["RateLimited"] = "RateLimited";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["AccessKeyNotFound"] = "AccessKeyNotFound";
errors["AccessKeyMismatch"] = "AccessKeyMismatch";
errors["InvalidOrigin"] = "InvalidOrigin";
errors["InvalidService"] = "InvalidService";
errors["UnauthorizedUser"] = "UnauthorizedUser";
errors["QuotaExceeded"] = "QuotaExceeded";
errors["RateLimit"] = "RateLimit";
errors["NoDefaultKey"] = "NoDefaultKey";
errors["MaxAccessKeys"] = "MaxAccessKeys";
errors["AtLeastOneKey"] = "AtLeastOneKey";
errors["Timeout"] = "Timeout";

@@ -909,3 +1527,2 @@ errors["InvalidArgument"] = "InvalidArgument";

errors["NotFound"] = "NotFound";
errors["ProjectNotFound"] = "ProjectNotFound";
errors["MetadataCallFailed"] = "MetadataCallFailed";

@@ -932,3 +1549,16 @@ return errors;

[1005]: AbortedError,
[2000]: TimeoutError,
[1006]: GeoblockedError,
[1007]: RateLimitedError,
[1100]: ProjectNotFoundError,
[1101]: AccessKeyNotFoundError,
[1102]: AccessKeyMismatchError,
[1103]: InvalidOriginError,
[1104]: InvalidServiceError,
[1105]: UnauthorizedUserError,
[1200]: QuotaExceededError,
[1201]: RateLimitError,
[1300]: NoDefaultKeyError,
[1301]: MaxAccessKeysError,
[1302]: AtLeastOneKeyError,
[1900]: TimeoutError,
[2001]: InvalidArgumentError,

@@ -939,7 +1569,64 @@ [2002]: UnavailableError,

[3000]: NotFoundError,
[3002]: ProjectNotFoundError,
[3003]: MetadataCallFailedError
};
const fetch = globalThis.fetch;
var indexergw_gen = /*#__PURE__*/Object.freeze({
__proto__: null,
WebrpcHeader: WebrpcHeader,
WebrpcHeaderValue: WebrpcHeaderValue,
WebRPCVersion: WebRPCVersion,
WebRPCSchemaVersion: WebRPCSchemaVersion,
WebRPCSchemaHash: WebRPCSchemaHash,
VersionFromHeader: VersionFromHeader,
ContractType: ContractType,
EventLogType: EventLogType,
EventLogDataType: EventLogDataType,
OrderStatus: OrderStatus,
TxnTransferType: TxnTransferType,
TransactionStatus: TransactionStatus,
TransactionType: TransactionType,
SortOrder: SortOrder,
ContractVerificationStatus: ContractVerificationStatus,
IndexerGateway: IndexerGateway,
WebrpcError: WebrpcError,
WebrpcEndpointError: WebrpcEndpointError,
WebrpcRequestFailedError: WebrpcRequestFailedError,
WebrpcBadRouteError: WebrpcBadRouteError,
WebrpcBadMethodError: WebrpcBadMethodError,
WebrpcBadRequestError: WebrpcBadRequestError,
WebrpcBadResponseError: WebrpcBadResponseError,
WebrpcServerPanicError: WebrpcServerPanicError,
WebrpcInternalErrorError: WebrpcInternalErrorError,
WebrpcClientDisconnectedError: WebrpcClientDisconnectedError,
WebrpcStreamLostError: WebrpcStreamLostError,
WebrpcStreamFinishedError: WebrpcStreamFinishedError,
UnauthorizedError: UnauthorizedError,
PermissionDeniedError: PermissionDeniedError,
SessionExpiredError: SessionExpiredError,
MethodNotFoundError: MethodNotFoundError,
RequestConflictError: RequestConflictError,
AbortedError: AbortedError,
GeoblockedError: GeoblockedError,
RateLimitedError: RateLimitedError,
ProjectNotFoundError: ProjectNotFoundError,
AccessKeyNotFoundError: AccessKeyNotFoundError,
AccessKeyMismatchError: AccessKeyMismatchError,
InvalidOriginError: InvalidOriginError,
InvalidServiceError: InvalidServiceError,
UnauthorizedUserError: UnauthorizedUserError,
QuotaExceededError: QuotaExceededError,
RateLimitError: RateLimitError,
NoDefaultKeyError: NoDefaultKeyError,
MaxAccessKeysError: MaxAccessKeysError,
AtLeastOneKeyError: AtLeastOneKeyError,
TimeoutError: TimeoutError,
InvalidArgumentError: InvalidArgumentError,
UnavailableError: UnavailableError,
QueryFailedError: QueryFailedError,
ResourceExhaustedError: ResourceExhaustedError,
NotFoundError: NotFoundError,
MetadataCallFailedError: MetadataCallFailedError,
errors: errors
});
class SequenceIndexer extends Indexer {

@@ -970,3 +1657,28 @@ constructor(hostname, projectAccessKey, jwtAuth) {

}
class SequenceIndexerGateway extends IndexerGateway {
constructor(hostname, projectAccessKey, jwtAuth) {
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
this.projectAccessKey = projectAccessKey;
this.jwtAuth = jwtAuth;
this._fetch = (input, init) => {
// automatically include jwt and access key auth header to requests
// if its been set on the api client
const headers = {};
const jwtAuth = this.jwtAuth;
const projectAccessKey = this.projectAccessKey;
if (jwtAuth && jwtAuth.length > 0) {
headers['Authorization'] = `BEARER ${jwtAuth}`;
}
if (projectAccessKey && projectAccessKey.length > 0) {
headers['X-Access-Key'] = projectAccessKey;
}
export { AbortedError, ContractType, ContractVerificationStatus, EventLogDataType, EventLogType, Indexer, InvalidArgumentError, MetadataCallFailedError, MethodNotFoundError, NotFoundError, OrderStatus, PermissionDeniedError, ProjectNotFoundError, QueryFailedError, RequestConflictError, ResourceExhaustedError, SequenceIndexer, SessionExpiredError, SortOrder, TimeoutError, TransactionStatus, TransactionType, TxnTransferType, UnauthorizedError, UnavailableError, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion, WebrpcBadMethodError, WebrpcBadRequestError, WebrpcBadResponseError, WebrpcBadRouteError, WebrpcClientDisconnectedError, WebrpcEndpointError, WebrpcError, WebrpcInternalErrorError, WebrpcRequestFailedError, WebrpcServerPanicError, WebrpcStreamFinishedError, WebrpcStreamLostError, errors };
// before the request is made
init.headers = _extends({}, init.headers, headers);
return fetch(input, init);
};
this.fetch = this._fetch;
}
}
export { AbortedError$1 as AbortedError, ContractType$1 as ContractType, ContractVerificationStatus$1 as ContractVerificationStatus, EventLogDataType$1 as EventLogDataType, EventLogType$1 as EventLogType, Indexer, indexergw_gen as IndexerGateway, InvalidArgumentError$1 as InvalidArgumentError, MetadataCallFailedError$1 as MetadataCallFailedError, MethodNotFoundError$1 as MethodNotFoundError, NotFoundError$1 as NotFoundError, OrderStatus$1 as OrderStatus, PermissionDeniedError$1 as PermissionDeniedError, ProjectNotFoundError$1 as ProjectNotFoundError, QueryFailedError$1 as QueryFailedError, RequestConflictError$1 as RequestConflictError, ResourceExhaustedError$1 as ResourceExhaustedError, SequenceIndexer, SequenceIndexerGateway, SessionExpiredError$1 as SessionExpiredError, SortOrder$1 as SortOrder, TimeoutError$1 as TimeoutError, TransactionStatus$1 as TransactionStatus, TransactionType$1 as TransactionType, TxnTransferType$1 as TxnTransferType, UnauthorizedError$1 as UnauthorizedError, UnavailableError$1 as UnavailableError, WebRPCSchemaHash$1 as WebRPCSchemaHash, WebRPCSchemaVersion$1 as WebRPCSchemaVersion, WebRPCVersion$1 as WebRPCVersion, WebrpcBadMethodError$1 as WebrpcBadMethodError, WebrpcBadRequestError$1 as WebrpcBadRequestError, WebrpcBadResponseError$1 as WebrpcBadResponseError, WebrpcBadRouteError$1 as WebrpcBadRouteError, WebrpcClientDisconnectedError$1 as WebrpcClientDisconnectedError, WebrpcEndpointError$1 as WebrpcEndpointError, WebrpcError$1 as WebrpcError, WebrpcInternalErrorError$1 as WebrpcInternalErrorError, WebrpcRequestFailedError$1 as WebrpcRequestFailedError, WebrpcServerPanicError$1 as WebrpcServerPanicError, WebrpcStreamFinishedError$1 as WebrpcStreamFinishedError, WebrpcStreamLostError$1 as WebrpcStreamLostError, errors$1 as errors };
export * from "./indexer.gen.js";
export * as IndexerGateway from "./indexergw.gen.js";
import { Indexer as IndexerRpc } from "./indexer.gen.js";
import { IndexerGateway as IndexerGatewayRpc } from "./indexergw.gen.js";
export declare class SequenceIndexer extends IndexerRpc {

@@ -9,1 +11,7 @@ projectAccessKey?: string | undefined;

}
export declare class SequenceIndexerGateway extends IndexerGatewayRpc {
projectAccessKey?: string | undefined;
jwtAuth?: string | undefined;
constructor(hostname: string, projectAccessKey?: string | undefined, jwtAuth?: string | undefined);
_fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
}

2

package.json
{
"name": "@0xsequence/indexer",
"version": "0.0.0-20241114193556",
"version": "0.0.0-20241216114019",
"description": "indexer sub-package for Sequence",

@@ -5,0 +5,0 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/indexer",

export * from './indexer.gen'
export * as IndexerGateway from './indexergw.gen'
import { Indexer as IndexerRpc } from './indexer.gen'
import { IndexerGateway as IndexerGatewayRpc } from './indexergw.gen'
const fetch = globalThis.fetch
export class SequenceIndexer extends IndexerRpc {

@@ -39,1 +39,34 @@ constructor(

}
export class SequenceIndexerGateway extends IndexerGatewayRpc {
constructor(
hostname: string,
public projectAccessKey?: string,
public jwtAuth?: string
) {
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
this.fetch = this._fetch
}
_fetch = (input: RequestInfo, init?: RequestInit): Promise<Response> => {
// automatically include jwt and access key auth header to requests
// if its been set on the api client
const headers: { [key: string]: any } = {}
const jwtAuth = this.jwtAuth
const projectAccessKey = this.projectAccessKey
if (jwtAuth && jwtAuth.length > 0) {
headers['Authorization'] = `BEARER ${jwtAuth}`
}
if (projectAccessKey && projectAccessKey.length > 0) {
headers['X-Access-Key'] = projectAccessKey
}
// before the request is made
init!.headers = { ...init!.headers, ...headers }
return fetch(input, init)
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc