@0xsequence/api
Advanced tools
Comparing version 2.2.10 to 2.2.11
@@ -16,8 +16,11 @@ 'use strict'; | ||
/* eslint-disable */ | ||
// sequence-api v0.4.0 24814ebb88457c0545aa80e8388cb0f08ec59bec | ||
// sequence-api v0.4.0 c3eb9010746703c095291691cd8f08dc04999062 | ||
// -- | ||
// Code generated by webrpc-gen@v0.20.3 with typescript generator. DO NOT EDIT. | ||
// Code generated by webrpc-gen@v0.22.0 with typescript generator. DO NOT EDIT. | ||
// | ||
// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts | ||
const WebrpcHeader = 'Webrpc'; | ||
const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-api@v0.4.0'; | ||
// WebRPC description and code-gen version | ||
@@ -30,3 +33,38 @@ const WebRPCVersion = 'v1'; | ||
// Schema hash generated from your RIDL schema | ||
const WebRPCSchemaHash = '24814ebb88457c0545aa80e8388cb0f08ec59bec'; | ||
const WebRPCSchemaHash = 'c3eb9010746703c095291691cd8f08dc04999062'; | ||
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 | ||
}; | ||
} | ||
@@ -536,2 +574,15 @@ // | ||
}; | ||
this.sardineGetSupportedTokenForSwap = (args, headers, signal) => { | ||
return this.fetch(this.url('SardineGetSupportedTokenForSwap'), createHTTPRequest(args, headers, signal)).then(res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
token: _data.token | ||
}; | ||
}); | ||
}, error => { | ||
throw WebrpcRequestFailedError.new({ | ||
cause: `fetch(): ${error.message || ''}` | ||
}); | ||
}); | ||
}; | ||
this.sardineGetEnabledTokens = (headers, signal) => { | ||
@@ -975,7 +1026,9 @@ return this.fetch(this.url('SardineGetEnabledTokens'), createHTTPRequest({}, headers, signal)).then(res => { | ||
const createHTTPRequest = (body = {}, headers = {}, signal = null) => { | ||
const reqHeaders = _extends({}, headers, { | ||
'Content-Type': 'application/json' | ||
}); | ||
reqHeaders[WebrpcHeader] = WebrpcHeaderValue; | ||
return { | ||
method: 'POST', | ||
headers: _extends({}, headers, { | ||
'Content-Type': 'application/json' | ||
}), | ||
headers: reqHeaders, | ||
body: JSON.stringify(body || {}), | ||
@@ -1124,2 +1177,14 @@ signal | ||
} | ||
class MethodNotFoundError extends WebrpcError { | ||
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, MethodNotFoundError.prototype); | ||
} | ||
} | ||
class RequestConflictError extends WebrpcError { | ||
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, RequestConflictError.prototype); | ||
} | ||
} | ||
class AbortedError extends WebrpcError { | ||
@@ -1137,2 +1202,80 @@ constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) { | ||
} | ||
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 = 1008, 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 request exceeded', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, QuotaExceededError.prototype); | ||
} | ||
} | ||
class QuotaRateLimitError extends WebrpcError { | ||
constructor(name = 'QuotaRateLimit', code = 1201, message = 'Quota rate limit exceeded', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, QuotaRateLimitError.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 = 1900, message = 'Request timed out', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, TimeoutError.prototype); | ||
} | ||
} | ||
class InvalidArgumentError extends WebrpcError { | ||
@@ -1162,2 +1305,8 @@ constructor(name = 'InvalidArgument', code = 2000, message = 'Invalid argument', status = 0, cause) { | ||
} | ||
class UnsupportedNetworkError extends WebrpcError { | ||
constructor(name = 'UnsupportedNetwork', code = 3008, message = 'Unsupported network', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, UnsupportedNetworkError.prototype); | ||
} | ||
} | ||
let errors = /*#__PURE__*/function (errors) { | ||
@@ -1178,4 +1327,19 @@ errors["WebrpcEndpoint"] = "WebrpcEndpoint"; | ||
errors["SessionExpired"] = "SessionExpired"; | ||
errors["MethodNotFound"] = "MethodNotFound"; | ||
errors["RequestConflict"] = "RequestConflict"; | ||
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["QuotaRateLimit"] = "QuotaRateLimit"; | ||
errors["NoDefaultKey"] = "NoDefaultKey"; | ||
errors["MaxAccessKeys"] = "MaxAccessKeys"; | ||
errors["AtLeastOneKey"] = "AtLeastOneKey"; | ||
errors["Timeout"] = "Timeout"; | ||
errors["InvalidArgument"] = "InvalidArgument"; | ||
@@ -1185,4 +1349,44 @@ errors["Unavailable"] = "Unavailable"; | ||
errors["NotFound"] = "NotFound"; | ||
errors["UnsupportedNetwork"] = "UnsupportedNetwork"; | ||
return errors; | ||
}({}); | ||
let WebrpcErrorCodes = /*#__PURE__*/function (WebrpcErrorCodes) { | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientDisconnected"] = -8] = "WebrpcClientDisconnected"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["RequestConflict"] = 1004] = "RequestConflict"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Aborted"] = 1005] = "Aborted"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Geoblocked"] = 1006] = "Geoblocked"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["RateLimited"] = 1007] = "RateLimited"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 1008] = "ProjectNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyNotFound"] = 1101] = "AccessKeyNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyMismatch"] = 1102] = "AccessKeyMismatch"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidOrigin"] = 1103] = "InvalidOrigin"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidService"] = 1104] = "InvalidService"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["UnauthorizedUser"] = 1105] = "UnauthorizedUser"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QuotaExceeded"] = 1200] = "QuotaExceeded"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QuotaRateLimit"] = 1201] = "QuotaRateLimit"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["NoDefaultKey"] = 1300] = "NoDefaultKey"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["MaxAccessKeys"] = 1301] = "MaxAccessKeys"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AtLeastOneKey"] = 1302] = "AtLeastOneKey"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 1900] = "Timeout"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2000] = "InvalidArgument"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Unavailable"] = 2002] = "Unavailable"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["UnsupportedNetwork"] = 3008] = "UnsupportedNetwork"; | ||
return WebrpcErrorCodes; | ||
}({}); | ||
const webrpcErrorByCode = { | ||
@@ -1203,8 +1407,24 @@ [0]: WebrpcEndpointError, | ||
[1002]: SessionExpiredError, | ||
[1003]: MethodNotFoundError, | ||
[1004]: RequestConflictError, | ||
[1005]: AbortedError, | ||
[1006]: GeoblockedError, | ||
[1007]: RateLimitedError, | ||
[1008]: ProjectNotFoundError, | ||
[1101]: AccessKeyNotFoundError, | ||
[1102]: AccessKeyMismatchError, | ||
[1103]: InvalidOriginError, | ||
[1104]: InvalidServiceError, | ||
[1105]: UnauthorizedUserError, | ||
[1200]: QuotaExceededError, | ||
[1201]: QuotaRateLimitError, | ||
[1300]: NoDefaultKeyError, | ||
[1301]: MaxAccessKeysError, | ||
[1302]: AtLeastOneKeyError, | ||
[1900]: TimeoutError, | ||
[2000]: InvalidArgumentError, | ||
[2002]: UnavailableError, | ||
[2003]: QueryFailedError, | ||
[3000]: NotFoundError | ||
[3000]: NotFoundError, | ||
[3008]: UnsupportedNetworkError | ||
}; | ||
@@ -1240,7 +1460,20 @@ | ||
exports.AbortedError = AbortedError; | ||
exports.AccessKeyMismatchError = AccessKeyMismatchError; | ||
exports.AccessKeyNotFoundError = AccessKeyNotFoundError; | ||
exports.AtLeastOneKeyError = AtLeastOneKeyError; | ||
exports.GeoblockedError = GeoblockedError; | ||
exports.InvalidArgumentError = InvalidArgumentError; | ||
exports.InvalidOriginError = InvalidOriginError; | ||
exports.InvalidServiceError = InvalidServiceError; | ||
exports.MaxAccessKeysError = MaxAccessKeysError; | ||
exports.MethodNotFoundError = MethodNotFoundError; | ||
exports.NoDefaultKeyError = NoDefaultKeyError; | ||
exports.NotFoundError = NotFoundError; | ||
exports.PermissionDeniedError = PermissionDeniedError; | ||
exports.ProjectNotFoundError = ProjectNotFoundError; | ||
exports.QueryFailedError = QueryFailedError; | ||
exports.QuotaExceededError = QuotaExceededError; | ||
exports.QuotaRateLimitError = QuotaRateLimitError; | ||
exports.RateLimitedError = RateLimitedError; | ||
exports.RequestConflictError = RequestConflictError; | ||
exports.SardinePaymentType = SardinePaymentType; | ||
@@ -1251,5 +1484,9 @@ exports.SardineQuoteType = SardineQuoteType; | ||
exports.SortOrder = SortOrder; | ||
exports.TimeoutError = TimeoutError; | ||
exports.TokenType = TokenType; | ||
exports.UnauthorizedError = UnauthorizedError; | ||
exports.UnauthorizedUserError = UnauthorizedUserError; | ||
exports.UnavailableError = UnavailableError; | ||
exports.UnsupportedNetworkError = UnsupportedNetworkError; | ||
exports.VersionFromHeader = VersionFromHeader; | ||
exports.WebRPCSchemaHash = WebRPCSchemaHash; | ||
@@ -1265,2 +1502,5 @@ exports.WebRPCSchemaVersion = WebRPCSchemaVersion; | ||
exports.WebrpcError = WebrpcError; | ||
exports.WebrpcErrorCodes = WebrpcErrorCodes; | ||
exports.WebrpcHeader = WebrpcHeader; | ||
exports.WebrpcHeaderValue = WebrpcHeaderValue; | ||
exports.WebrpcInternalErrorError = WebrpcInternalErrorError; | ||
@@ -1272,1 +1512,2 @@ exports.WebrpcRequestFailedError = WebrpcRequestFailedError; | ||
exports.errors = errors; | ||
exports.webrpcErrorByCode = webrpcErrorByCode; |
@@ -16,8 +16,11 @@ 'use strict'; | ||
/* eslint-disable */ | ||
// sequence-api v0.4.0 24814ebb88457c0545aa80e8388cb0f08ec59bec | ||
// sequence-api v0.4.0 c3eb9010746703c095291691cd8f08dc04999062 | ||
// -- | ||
// Code generated by webrpc-gen@v0.20.3 with typescript generator. DO NOT EDIT. | ||
// Code generated by webrpc-gen@v0.22.0 with typescript generator. DO NOT EDIT. | ||
// | ||
// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts | ||
const WebrpcHeader = 'Webrpc'; | ||
const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-api@v0.4.0'; | ||
// WebRPC description and code-gen version | ||
@@ -30,3 +33,38 @@ const WebRPCVersion = 'v1'; | ||
// Schema hash generated from your RIDL schema | ||
const WebRPCSchemaHash = '24814ebb88457c0545aa80e8388cb0f08ec59bec'; | ||
const WebRPCSchemaHash = 'c3eb9010746703c095291691cd8f08dc04999062'; | ||
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 | ||
}; | ||
} | ||
@@ -536,2 +574,15 @@ // | ||
}; | ||
this.sardineGetSupportedTokenForSwap = (args, headers, signal) => { | ||
return this.fetch(this.url('SardineGetSupportedTokenForSwap'), createHTTPRequest(args, headers, signal)).then(res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
token: _data.token | ||
}; | ||
}); | ||
}, error => { | ||
throw WebrpcRequestFailedError.new({ | ||
cause: `fetch(): ${error.message || ''}` | ||
}); | ||
}); | ||
}; | ||
this.sardineGetEnabledTokens = (headers, signal) => { | ||
@@ -975,7 +1026,9 @@ return this.fetch(this.url('SardineGetEnabledTokens'), createHTTPRequest({}, headers, signal)).then(res => { | ||
const createHTTPRequest = (body = {}, headers = {}, signal = null) => { | ||
const reqHeaders = _extends({}, headers, { | ||
'Content-Type': 'application/json' | ||
}); | ||
reqHeaders[WebrpcHeader] = WebrpcHeaderValue; | ||
return { | ||
method: 'POST', | ||
headers: _extends({}, headers, { | ||
'Content-Type': 'application/json' | ||
}), | ||
headers: reqHeaders, | ||
body: JSON.stringify(body || {}), | ||
@@ -1124,2 +1177,14 @@ signal | ||
} | ||
class MethodNotFoundError extends WebrpcError { | ||
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, MethodNotFoundError.prototype); | ||
} | ||
} | ||
class RequestConflictError extends WebrpcError { | ||
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, RequestConflictError.prototype); | ||
} | ||
} | ||
class AbortedError extends WebrpcError { | ||
@@ -1137,2 +1202,80 @@ constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) { | ||
} | ||
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 = 1008, 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 request exceeded', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, QuotaExceededError.prototype); | ||
} | ||
} | ||
class QuotaRateLimitError extends WebrpcError { | ||
constructor(name = 'QuotaRateLimit', code = 1201, message = 'Quota rate limit exceeded', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, QuotaRateLimitError.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 = 1900, message = 'Request timed out', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, TimeoutError.prototype); | ||
} | ||
} | ||
class InvalidArgumentError extends WebrpcError { | ||
@@ -1162,2 +1305,8 @@ constructor(name = 'InvalidArgument', code = 2000, message = 'Invalid argument', status = 0, cause) { | ||
} | ||
class UnsupportedNetworkError extends WebrpcError { | ||
constructor(name = 'UnsupportedNetwork', code = 3008, message = 'Unsupported network', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, UnsupportedNetworkError.prototype); | ||
} | ||
} | ||
let errors = /*#__PURE__*/function (errors) { | ||
@@ -1178,4 +1327,19 @@ errors["WebrpcEndpoint"] = "WebrpcEndpoint"; | ||
errors["SessionExpired"] = "SessionExpired"; | ||
errors["MethodNotFound"] = "MethodNotFound"; | ||
errors["RequestConflict"] = "RequestConflict"; | ||
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["QuotaRateLimit"] = "QuotaRateLimit"; | ||
errors["NoDefaultKey"] = "NoDefaultKey"; | ||
errors["MaxAccessKeys"] = "MaxAccessKeys"; | ||
errors["AtLeastOneKey"] = "AtLeastOneKey"; | ||
errors["Timeout"] = "Timeout"; | ||
errors["InvalidArgument"] = "InvalidArgument"; | ||
@@ -1185,4 +1349,44 @@ errors["Unavailable"] = "Unavailable"; | ||
errors["NotFound"] = "NotFound"; | ||
errors["UnsupportedNetwork"] = "UnsupportedNetwork"; | ||
return errors; | ||
}({}); | ||
let WebrpcErrorCodes = /*#__PURE__*/function (WebrpcErrorCodes) { | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientDisconnected"] = -8] = "WebrpcClientDisconnected"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["RequestConflict"] = 1004] = "RequestConflict"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Aborted"] = 1005] = "Aborted"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Geoblocked"] = 1006] = "Geoblocked"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["RateLimited"] = 1007] = "RateLimited"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 1008] = "ProjectNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyNotFound"] = 1101] = "AccessKeyNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyMismatch"] = 1102] = "AccessKeyMismatch"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidOrigin"] = 1103] = "InvalidOrigin"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidService"] = 1104] = "InvalidService"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["UnauthorizedUser"] = 1105] = "UnauthorizedUser"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QuotaExceeded"] = 1200] = "QuotaExceeded"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QuotaRateLimit"] = 1201] = "QuotaRateLimit"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["NoDefaultKey"] = 1300] = "NoDefaultKey"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["MaxAccessKeys"] = 1301] = "MaxAccessKeys"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AtLeastOneKey"] = 1302] = "AtLeastOneKey"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 1900] = "Timeout"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2000] = "InvalidArgument"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Unavailable"] = 2002] = "Unavailable"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["UnsupportedNetwork"] = 3008] = "UnsupportedNetwork"; | ||
return WebrpcErrorCodes; | ||
}({}); | ||
const webrpcErrorByCode = { | ||
@@ -1203,8 +1407,24 @@ [0]: WebrpcEndpointError, | ||
[1002]: SessionExpiredError, | ||
[1003]: MethodNotFoundError, | ||
[1004]: RequestConflictError, | ||
[1005]: AbortedError, | ||
[1006]: GeoblockedError, | ||
[1007]: RateLimitedError, | ||
[1008]: ProjectNotFoundError, | ||
[1101]: AccessKeyNotFoundError, | ||
[1102]: AccessKeyMismatchError, | ||
[1103]: InvalidOriginError, | ||
[1104]: InvalidServiceError, | ||
[1105]: UnauthorizedUserError, | ||
[1200]: QuotaExceededError, | ||
[1201]: QuotaRateLimitError, | ||
[1300]: NoDefaultKeyError, | ||
[1301]: MaxAccessKeysError, | ||
[1302]: AtLeastOneKeyError, | ||
[1900]: TimeoutError, | ||
[2000]: InvalidArgumentError, | ||
[2002]: UnavailableError, | ||
[2003]: QueryFailedError, | ||
[3000]: NotFoundError | ||
[3000]: NotFoundError, | ||
[3008]: UnsupportedNetworkError | ||
}; | ||
@@ -1240,7 +1460,20 @@ | ||
exports.AbortedError = AbortedError; | ||
exports.AccessKeyMismatchError = AccessKeyMismatchError; | ||
exports.AccessKeyNotFoundError = AccessKeyNotFoundError; | ||
exports.AtLeastOneKeyError = AtLeastOneKeyError; | ||
exports.GeoblockedError = GeoblockedError; | ||
exports.InvalidArgumentError = InvalidArgumentError; | ||
exports.InvalidOriginError = InvalidOriginError; | ||
exports.InvalidServiceError = InvalidServiceError; | ||
exports.MaxAccessKeysError = MaxAccessKeysError; | ||
exports.MethodNotFoundError = MethodNotFoundError; | ||
exports.NoDefaultKeyError = NoDefaultKeyError; | ||
exports.NotFoundError = NotFoundError; | ||
exports.PermissionDeniedError = PermissionDeniedError; | ||
exports.ProjectNotFoundError = ProjectNotFoundError; | ||
exports.QueryFailedError = QueryFailedError; | ||
exports.QuotaExceededError = QuotaExceededError; | ||
exports.QuotaRateLimitError = QuotaRateLimitError; | ||
exports.RateLimitedError = RateLimitedError; | ||
exports.RequestConflictError = RequestConflictError; | ||
exports.SardinePaymentType = SardinePaymentType; | ||
@@ -1251,5 +1484,9 @@ exports.SardineQuoteType = SardineQuoteType; | ||
exports.SortOrder = SortOrder; | ||
exports.TimeoutError = TimeoutError; | ||
exports.TokenType = TokenType; | ||
exports.UnauthorizedError = UnauthorizedError; | ||
exports.UnauthorizedUserError = UnauthorizedUserError; | ||
exports.UnavailableError = UnavailableError; | ||
exports.UnsupportedNetworkError = UnsupportedNetworkError; | ||
exports.VersionFromHeader = VersionFromHeader; | ||
exports.WebRPCSchemaHash = WebRPCSchemaHash; | ||
@@ -1265,2 +1502,5 @@ exports.WebRPCSchemaVersion = WebRPCSchemaVersion; | ||
exports.WebrpcError = WebrpcError; | ||
exports.WebrpcErrorCodes = WebrpcErrorCodes; | ||
exports.WebrpcHeader = WebrpcHeader; | ||
exports.WebrpcHeaderValue = WebrpcHeaderValue; | ||
exports.WebrpcInternalErrorError = WebrpcInternalErrorError; | ||
@@ -1272,1 +1512,2 @@ exports.WebrpcRequestFailedError = WebrpcRequestFailedError; | ||
exports.errors = errors; | ||
exports.webrpcErrorByCode = webrpcErrorByCode; |
@@ -12,8 +12,11 @@ function _extends() { | ||
/* eslint-disable */ | ||
// sequence-api v0.4.0 24814ebb88457c0545aa80e8388cb0f08ec59bec | ||
// sequence-api v0.4.0 c3eb9010746703c095291691cd8f08dc04999062 | ||
// -- | ||
// Code generated by webrpc-gen@v0.20.3 with typescript generator. DO NOT EDIT. | ||
// Code generated by webrpc-gen@v0.22.0 with typescript generator. DO NOT EDIT. | ||
// | ||
// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts | ||
const WebrpcHeader = 'Webrpc'; | ||
const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-api@v0.4.0'; | ||
// WebRPC description and code-gen version | ||
@@ -26,3 +29,38 @@ const WebRPCVersion = 'v1'; | ||
// Schema hash generated from your RIDL schema | ||
const WebRPCSchemaHash = '24814ebb88457c0545aa80e8388cb0f08ec59bec'; | ||
const WebRPCSchemaHash = 'c3eb9010746703c095291691cd8f08dc04999062'; | ||
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 | ||
}; | ||
} | ||
@@ -532,2 +570,15 @@ // | ||
}; | ||
this.sardineGetSupportedTokenForSwap = (args, headers, signal) => { | ||
return this.fetch(this.url('SardineGetSupportedTokenForSwap'), createHTTPRequest(args, headers, signal)).then(res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
token: _data.token | ||
}; | ||
}); | ||
}, error => { | ||
throw WebrpcRequestFailedError.new({ | ||
cause: `fetch(): ${error.message || ''}` | ||
}); | ||
}); | ||
}; | ||
this.sardineGetEnabledTokens = (headers, signal) => { | ||
@@ -971,7 +1022,9 @@ return this.fetch(this.url('SardineGetEnabledTokens'), createHTTPRequest({}, headers, signal)).then(res => { | ||
const createHTTPRequest = (body = {}, headers = {}, signal = null) => { | ||
const reqHeaders = _extends({}, headers, { | ||
'Content-Type': 'application/json' | ||
}); | ||
reqHeaders[WebrpcHeader] = WebrpcHeaderValue; | ||
return { | ||
method: 'POST', | ||
headers: _extends({}, headers, { | ||
'Content-Type': 'application/json' | ||
}), | ||
headers: reqHeaders, | ||
body: JSON.stringify(body || {}), | ||
@@ -1120,2 +1173,14 @@ signal | ||
} | ||
class MethodNotFoundError extends WebrpcError { | ||
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, MethodNotFoundError.prototype); | ||
} | ||
} | ||
class RequestConflictError extends WebrpcError { | ||
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, RequestConflictError.prototype); | ||
} | ||
} | ||
class AbortedError extends WebrpcError { | ||
@@ -1133,2 +1198,80 @@ constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) { | ||
} | ||
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 = 1008, 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 request exceeded', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, QuotaExceededError.prototype); | ||
} | ||
} | ||
class QuotaRateLimitError extends WebrpcError { | ||
constructor(name = 'QuotaRateLimit', code = 1201, message = 'Quota rate limit exceeded', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, QuotaRateLimitError.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 = 1900, message = 'Request timed out', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, TimeoutError.prototype); | ||
} | ||
} | ||
class InvalidArgumentError extends WebrpcError { | ||
@@ -1158,2 +1301,8 @@ constructor(name = 'InvalidArgument', code = 2000, message = 'Invalid argument', status = 0, cause) { | ||
} | ||
class UnsupportedNetworkError extends WebrpcError { | ||
constructor(name = 'UnsupportedNetwork', code = 3008, message = 'Unsupported network', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, UnsupportedNetworkError.prototype); | ||
} | ||
} | ||
let errors = /*#__PURE__*/function (errors) { | ||
@@ -1174,4 +1323,19 @@ errors["WebrpcEndpoint"] = "WebrpcEndpoint"; | ||
errors["SessionExpired"] = "SessionExpired"; | ||
errors["MethodNotFound"] = "MethodNotFound"; | ||
errors["RequestConflict"] = "RequestConflict"; | ||
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["QuotaRateLimit"] = "QuotaRateLimit"; | ||
errors["NoDefaultKey"] = "NoDefaultKey"; | ||
errors["MaxAccessKeys"] = "MaxAccessKeys"; | ||
errors["AtLeastOneKey"] = "AtLeastOneKey"; | ||
errors["Timeout"] = "Timeout"; | ||
errors["InvalidArgument"] = "InvalidArgument"; | ||
@@ -1181,4 +1345,44 @@ errors["Unavailable"] = "Unavailable"; | ||
errors["NotFound"] = "NotFound"; | ||
errors["UnsupportedNetwork"] = "UnsupportedNetwork"; | ||
return errors; | ||
}({}); | ||
let WebrpcErrorCodes = /*#__PURE__*/function (WebrpcErrorCodes) { | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientDisconnected"] = -8] = "WebrpcClientDisconnected"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["RequestConflict"] = 1004] = "RequestConflict"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Aborted"] = 1005] = "Aborted"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Geoblocked"] = 1006] = "Geoblocked"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["RateLimited"] = 1007] = "RateLimited"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 1008] = "ProjectNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyNotFound"] = 1101] = "AccessKeyNotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyMismatch"] = 1102] = "AccessKeyMismatch"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidOrigin"] = 1103] = "InvalidOrigin"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidService"] = 1104] = "InvalidService"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["UnauthorizedUser"] = 1105] = "UnauthorizedUser"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QuotaExceeded"] = 1200] = "QuotaExceeded"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QuotaRateLimit"] = 1201] = "QuotaRateLimit"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["NoDefaultKey"] = 1300] = "NoDefaultKey"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["MaxAccessKeys"] = 1301] = "MaxAccessKeys"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["AtLeastOneKey"] = 1302] = "AtLeastOneKey"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 1900] = "Timeout"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2000] = "InvalidArgument"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["Unavailable"] = 2002] = "Unavailable"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound"; | ||
WebrpcErrorCodes[WebrpcErrorCodes["UnsupportedNetwork"] = 3008] = "UnsupportedNetwork"; | ||
return WebrpcErrorCodes; | ||
}({}); | ||
const webrpcErrorByCode = { | ||
@@ -1199,8 +1403,24 @@ [0]: WebrpcEndpointError, | ||
[1002]: SessionExpiredError, | ||
[1003]: MethodNotFoundError, | ||
[1004]: RequestConflictError, | ||
[1005]: AbortedError, | ||
[1006]: GeoblockedError, | ||
[1007]: RateLimitedError, | ||
[1008]: ProjectNotFoundError, | ||
[1101]: AccessKeyNotFoundError, | ||
[1102]: AccessKeyMismatchError, | ||
[1103]: InvalidOriginError, | ||
[1104]: InvalidServiceError, | ||
[1105]: UnauthorizedUserError, | ||
[1200]: QuotaExceededError, | ||
[1201]: QuotaRateLimitError, | ||
[1300]: NoDefaultKeyError, | ||
[1301]: MaxAccessKeysError, | ||
[1302]: AtLeastOneKeyError, | ||
[1900]: TimeoutError, | ||
[2000]: InvalidArgumentError, | ||
[2002]: UnavailableError, | ||
[2003]: QueryFailedError, | ||
[3000]: NotFoundError | ||
[3000]: NotFoundError, | ||
[3008]: UnsupportedNetworkError | ||
}; | ||
@@ -1234,2 +1454,2 @@ | ||
export { API, AbortedError, GeoblockedError, InvalidArgumentError, NotFoundError, PermissionDeniedError, QueryFailedError, SardinePaymentType, SardineQuoteType, SequenceAPIClient, SessionExpiredError, SortOrder, TokenType, UnauthorizedError, UnavailableError, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion, WebrpcBadMethodError, WebrpcBadRequestError, WebrpcBadResponseError, WebrpcBadRouteError, WebrpcClientDisconnectedError, WebrpcEndpointError, WebrpcError, WebrpcInternalErrorError, WebrpcRequestFailedError, WebrpcServerPanicError, WebrpcStreamFinishedError, WebrpcStreamLostError, errors }; | ||
export { API, AbortedError, AccessKeyMismatchError, AccessKeyNotFoundError, AtLeastOneKeyError, GeoblockedError, InvalidArgumentError, InvalidOriginError, InvalidServiceError, MaxAccessKeysError, MethodNotFoundError, NoDefaultKeyError, NotFoundError, PermissionDeniedError, ProjectNotFoundError, QueryFailedError, QuotaExceededError, QuotaRateLimitError, RateLimitedError, RequestConflictError, SardinePaymentType, SardineQuoteType, SequenceAPIClient, SessionExpiredError, SortOrder, TimeoutError, TokenType, UnauthorizedError, UnauthorizedUserError, UnavailableError, UnsupportedNetworkError, VersionFromHeader, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion, WebrpcBadMethodError, WebrpcBadRequestError, WebrpcBadResponseError, WebrpcBadRouteError, WebrpcClientDisconnectedError, WebrpcEndpointError, WebrpcError, WebrpcErrorCodes, WebrpcHeader, WebrpcHeaderValue, WebrpcInternalErrorError, WebrpcRequestFailedError, WebrpcServerPanicError, WebrpcStreamFinishedError, WebrpcStreamLostError, errors, webrpcErrorByCode }; |
@@ -0,4 +1,14 @@ | ||
export declare const WebrpcHeader = "Webrpc"; | ||
export declare const WebrpcHeaderValue = "webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-api@v0.4.0"; | ||
export declare const WebRPCVersion = "v1"; | ||
export declare const WebRPCSchemaVersion = "v0.4.0"; | ||
export declare const WebRPCSchemaHash = "24814ebb88457c0545aa80e8388cb0f08ec59bec"; | ||
export declare const WebRPCSchemaHash = "c3eb9010746703c095291691cd8f08dc04999062"; | ||
type WebrpcGenVersions = { | ||
webrpcGenVersion: string; | ||
codeGenName: string; | ||
codeGenVersion: string; | ||
schemaName: string; | ||
schemaVersion: string; | ||
}; | ||
export declare function VersionFromHeader(headers: Headers): WebrpcGenVersions; | ||
export declare enum SortOrder { | ||
@@ -260,2 +270,7 @@ DESC = "DESC", | ||
} | ||
export interface SardineSupportedTokenForSwap { | ||
isSupported: boolean; | ||
isSupportedForAbstraction: boolean; | ||
currentBalance: string; | ||
} | ||
export interface SardineEnabledToken { | ||
@@ -421,2 +436,3 @@ network: string; | ||
sardineGetSupportedTokens(headers?: object, signal?: AbortSignal): Promise<SardineGetSupportedTokensReturn>; | ||
sardineGetSupportedTokenForSwap(args: SardineGetSupportedTokenForSwapArgs, headers?: object, signal?: AbortSignal): Promise<SardineGetSupportedTokenForSwapReturn>; | ||
sardineGetEnabledTokens(headers?: object, signal?: AbortSignal): Promise<SardineGetEnabledTokensReturn>; | ||
@@ -694,2 +710,9 @@ sardineGetQuote(args: SardineGetQuoteArgs, headers?: object, signal?: AbortSignal): Promise<SardineGetQuoteReturn>; | ||
} | ||
export interface SardineGetSupportedTokenForSwapArgs { | ||
network: string; | ||
tokenAddress: string; | ||
} | ||
export interface SardineGetSupportedTokenForSwapReturn { | ||
token: SardineSupportedTokenForSwap; | ||
} | ||
export interface SardineGetEnabledTokensArgs { | ||
@@ -976,2 +999,3 @@ } | ||
sardineGetSupportedTokens: (headers?: object, signal?: AbortSignal) => Promise<SardineGetSupportedTokensReturn>; | ||
sardineGetSupportedTokenForSwap: (args: SardineGetSupportedTokenForSwapArgs, headers?: object, signal?: AbortSignal) => Promise<SardineGetSupportedTokenForSwapReturn>; | ||
sardineGetEnabledTokens: (headers?: object, signal?: AbortSignal) => Promise<SardineGetEnabledTokensReturn>; | ||
@@ -1064,2 +1088,8 @@ sardineGetQuote: (args: SardineGetQuoteArgs, headers?: object, signal?: AbortSignal) => Promise<SardineGetQuoteReturn>; | ||
} | ||
export declare class MethodNotFoundError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class RequestConflictError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class AbortedError extends WebrpcError { | ||
@@ -1071,2 +1101,41 @@ constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class RateLimitedError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class ProjectNotFoundError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class AccessKeyNotFoundError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class AccessKeyMismatchError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class InvalidOriginError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class InvalidServiceError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class UnauthorizedUserError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class QuotaExceededError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class QuotaRateLimitError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class NoDefaultKeyError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class MaxAccessKeysError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class AtLeastOneKeyError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class TimeoutError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class InvalidArgumentError extends WebrpcError { | ||
@@ -1084,2 +1153,5 @@ constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class UnsupportedNetworkError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare enum errors { | ||
@@ -1100,9 +1172,67 @@ WebrpcEndpoint = "WebrpcEndpoint", | ||
SessionExpired = "SessionExpired", | ||
MethodNotFound = "MethodNotFound", | ||
RequestConflict = "RequestConflict", | ||
Aborted = "Aborted", | ||
Geoblocked = "Geoblocked", | ||
RateLimited = "RateLimited", | ||
ProjectNotFound = "ProjectNotFound", | ||
AccessKeyNotFound = "AccessKeyNotFound", | ||
AccessKeyMismatch = "AccessKeyMismatch", | ||
InvalidOrigin = "InvalidOrigin", | ||
InvalidService = "InvalidService", | ||
UnauthorizedUser = "UnauthorizedUser", | ||
QuotaExceeded = "QuotaExceeded", | ||
QuotaRateLimit = "QuotaRateLimit", | ||
NoDefaultKey = "NoDefaultKey", | ||
MaxAccessKeys = "MaxAccessKeys", | ||
AtLeastOneKey = "AtLeastOneKey", | ||
Timeout = "Timeout", | ||
InvalidArgument = "InvalidArgument", | ||
Unavailable = "Unavailable", | ||
QueryFailed = "QueryFailed", | ||
NotFound = "NotFound" | ||
NotFound = "NotFound", | ||
UnsupportedNetwork = "UnsupportedNetwork" | ||
} | ||
export declare enum WebrpcErrorCodes { | ||
WebrpcEndpoint = 0, | ||
WebrpcRequestFailed = -1, | ||
WebrpcBadRoute = -2, | ||
WebrpcBadMethod = -3, | ||
WebrpcBadRequest = -4, | ||
WebrpcBadResponse = -5, | ||
WebrpcServerPanic = -6, | ||
WebrpcInternalError = -7, | ||
WebrpcClientDisconnected = -8, | ||
WebrpcStreamLost = -9, | ||
WebrpcStreamFinished = -10, | ||
Unauthorized = 1000, | ||
PermissionDenied = 1001, | ||
SessionExpired = 1002, | ||
MethodNotFound = 1003, | ||
RequestConflict = 1004, | ||
Aborted = 1005, | ||
Geoblocked = 1006, | ||
RateLimited = 1007, | ||
ProjectNotFound = 1008, | ||
AccessKeyNotFound = 1101, | ||
AccessKeyMismatch = 1102, | ||
InvalidOrigin = 1103, | ||
InvalidService = 1104, | ||
UnauthorizedUser = 1105, | ||
QuotaExceeded = 1200, | ||
QuotaRateLimit = 1201, | ||
NoDefaultKey = 1300, | ||
MaxAccessKeys = 1301, | ||
AtLeastOneKey = 1302, | ||
Timeout = 1900, | ||
InvalidArgument = 2000, | ||
Unavailable = 2002, | ||
QueryFailed = 2003, | ||
NotFound = 3000, | ||
UnsupportedNetwork = 3008 | ||
} | ||
export declare const webrpcErrorByCode: { | ||
[code: number]: any; | ||
}; | ||
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>; | ||
export {}; |
{ | ||
"name": "@0xsequence/api", | ||
"version": "2.2.10", | ||
"version": "2.2.11", | ||
"description": "api sub-package for Sequence", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/api", |
Sorry, the diff of this file is too big to display
310003
8450