Skip to content

Commit

Permalink
feat(2847512314): Add Stark Error Code (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgluskin-starkware authored and dan-ziv committed Sep 5, 2022
1 parent 5a3e5d3 commit b276cda
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@starkware-industries/starkex-js",
"version": "0.0.6",
"version": "1.0.0",
"description": "`starkex-js` is a JavaScript wrapper around the [StarkEx API](https://starkware.co/starkex/api/) that can be used in both NodeJS and Browser environments.",
"keywords": [
"starkware",
Expand Down
53 changes: 53 additions & 0 deletions src/lib/common/error-codes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// https://starkware.co/StarkExRESTAPI/error_codes.html

export enum StarkErrorCode {
API_FUNCTION_TEMPORARILY_DISABLED = 0,
BATCH_CREATION_FAILURE = 1,
BATCH_FULL = 2,
BATCH_NOT_READY = 3,
CONFLICTING_ORDER_AMOUNTS = 4,
FACT_NOT_REGISTERED = 5,
INSUFFICIENT_ONCHAIN_BALANCE = 6,
INVALID_BATCH_ID = 7,
INVALID_CLAIM_HASH = 8,
INVALID_COMMITTEE_MEMBER = 9,
INVALID_CONTRACT_ADDRESS = 10,
INVALID_CONTRACT_RESPONSE = 11,
INVALID_DEPLOYMENT_INFO = 12,
INVALID_ETH_ADDRESS = 13,
INVALID_FACT = 14,
INVALID_FEE_TAKEN = 15,
INVALID_ORDER_ID = 16,
INVALID_ORDER_TYPE = 17,
INVALID_REQUEST = 18,
INVALID_REQUEST_PARAMETERS = 19,
INVALID_SETTLEMENT_INFO = 20,
INVALID_SETTLEMENT_RATIO = 21,
INVALID_SETTLEMENT_TOKENS = 22,
INVALID_SIGNATURE = 23,
INVALID_TRANSACTION = 24,
INVALID_TRANSACTION_ID = 25,
INVALID_VAULT = 26,
MALFORMED_REQUEST = 27,
MIGRATED_PIPELINE_OBJECT_MISSING = 28,
MISSING_FEE_OBJECT = 29,
ORDER_OVERDUE = 30,
OUT_OF_RANGE_AMOUNT = 32,
OUT_OF_RANGE_BALANCE = 33,
OUT_OF_RANGE_BATCH_ID = 34,
OUT_OF_RANGE_ETH_ADDRESS = 35,
OUT_OF_RANGE_EXPIRATION_TIMESTAMP = 36,
OUT_OF_RANGE_NONCE = 37,
OUT_OF_RANGE_ORACLE_PRICE_QUORUM = 38,
OUT_OF_RANGE_ORDER_ID = 39,
OUT_OF_RANGE_POSITIVE_AMOUNT = 31,
OUT_OF_RANGE_PUBLIC_KEY = 40,
OUT_OF_RANGE_SIGNATURE_SUBFIELD = 41,
OUT_OF_RANGE_TOKEN_ID = 42,
OUT_OF_RANGE_VAULT_ID = 43,
REPLACED_BEFORE = 44,
REQUEST_FAILED = 45,
SCHEMA_VALIDATION_ERROR = 46,
TRANSACTION_CANCELLED = 47,
TRANSACTION_PENDING = 48
}
1 change: 1 addition & 0 deletions src/lib/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './error-codes';
3 changes: 3 additions & 0 deletions src/lib/starkex-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {StarkErrorCode} from './common';
import {AvailabilityGateway, FeederGateway, Gateway} from './index';

class StarkExClient {
public static readonly StarkErrorCode = StarkErrorCode;

public gateway: Gateway;
public feederGateway: FeederGateway;
public availabilityGateway: AvailabilityGateway;
Expand Down

0 comments on commit b276cda

Please sign in to comment.