UNPKG

@simbachain/libsimba-js

Version:

libsimba-js is a library simplifying the use of SIMBAChain APIs. We aim to abstract away the various blockchain concepts, reducing the necessary time needed to get to working code.

1,303 lines 544 kB
{ "type": "File", "start": 0, "end": 5093, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 192, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 5093, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 192, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportNamedDeclaration", "start": 65, "end": 849, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 27, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 72, "end": 849, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 27, "column": 1 } }, "id": { "type": "Identifier", "start": 78, "end": 91, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 26 }, "identifierName": "BaseException" }, "name": "BaseException", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 100, "end": 105, "loc": { "start": { "line": 4, "column": 35 }, "end": { "line": 4, "column": 40 }, "identifierName": "Error" }, "name": "Error" }, "body": { "type": "ClassBody", "start": 105, "end": 849, "loc": { "start": { "line": 4, "column": 40 }, "end": { "line": 27, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 315, "end": 846, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 26, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 315, "end": 326, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 327, "end": 334, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 23 }, "identifierName": "message" }, "name": "message" }, { "type": "Identifier", "start": 336, "end": 341, "loc": { "start": { "line": 10, "column": 25 }, "end": { "line": 10, "column": 30 }, "identifierName": "cause" }, "name": "cause" } ], "body": { "type": "BlockStatement", "start": 342, "end": 846, "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 26, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 353, "end": 361, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 16 } }, "expression": { "type": "CallExpression", "start": 353, "end": 360, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 15 } }, "callee": { "type": "Super", "start": 353, "end": 358, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 13 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 371, "end": 399, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 371, "end": 398, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 371, "end": 380, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 17 } }, "object": { "type": "ThisExpression", "start": 371, "end": 375, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } } }, "property": { "type": "Identifier", "start": 376, "end": 380, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 17 }, "identifierName": "name" }, "name": "name" }, "computed": false }, "right": { "type": "StringLiteral", "start": 383, "end": 398, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 35 } }, "extra": { "rawValue": "BaseException", "raw": "'BaseException'" }, "value": "BaseException" } } }, { "type": "IfStatement", "start": 411, "end": 629, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 20, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 414, "end": 435, "loc": { "start": { "line": 14, "column": 11 }, "end": { "line": 14, "column": 32 } }, "left": { "type": "StringLiteral", "start": 414, "end": 424, "loc": { "start": { "line": 14, "column": 11 }, "end": { "line": 14, "column": 21 } }, "extra": { "rawValue": "response", "raw": "'response'" }, "value": "response" }, "operator": "in", "right": { "type": "Identifier", "start": 428, "end": 435, "loc": { "start": { "line": 14, "column": 25 }, "end": { "line": 14, "column": 32 }, "identifierName": "message" }, "name": "message" } }, "consequent": { "type": "BlockStatement", "start": 436, "end": 543, "loc": { "start": { "line": 14, "column": 33 }, "end": { "line": 17, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 451, "end": 488, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 49 } }, "expression": { "type": "AssignmentExpression", "start": 451, "end": 487, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 48 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 451, "end": 463, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 24 } }, "object": { "type": "ThisExpression", "start": 451, "end": 455, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 16 } } }, "property": { "type": "Identifier", "start": 456, "end": 463, "loc": { "start": { "line": 15, "column": 17 }, "end": { "line": 15, "column": 24 }, "identifierName": "message" }, "name": "message" }, "computed": false }, "right": { "type": "MemberExpression", "start": 466, "end": 487, "loc": { "start": { "line": 15, "column": 27 }, "end": { "line": 15, "column": 48 } }, "object": { "type": "MemberExpression", "start": 466, "end": 482, "loc": { "start": { "line": 15, "column": 27 }, "end": { "line": 15, "column": 43 } }, "object": { "type": "Identifier", "start": 466, "end": 473, "loc": { "start": { "line": 15, "column": 27 }, "end": { "line": 15, "column": 34 }, "identifierName": "message" }, "name": "message" }, "property": { "type": "Identifier", "start": 474, "end": 482, "loc": { "start": { "line": 15, "column": 35 }, "end": { "line": 15, "column": 43 }, "identifierName": "response" }, "name": "response" }, "computed": false }, "property": { "type": "Identifier", "start": 483, "end": 487, "loc": { "start": { "line": 15, "column": 44 }, "end": { "line": 15, "column": 48 }, "identifierName": "data" }, "name": "data" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 502, "end": 532, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 502, "end": 531, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 502, "end": 512, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 22 } }, "object": { "type": "ThisExpression", "start": 502, "end": 506, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 16 } } }, "property": { "type": "Identifier", "start": 507, "end": 512, "loc": { "start": { "line": 16, "column": 17 }, "end": { "line": 16, "column": 22 }, "identifierName": "cause" }, "name": "cause" }, "computed": false }, "right": { "type": "LogicalExpression", "start": 515, "end": 531, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 41 } }, "left": { "type": "Identifier", "start": 515, "end": 520, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 30 }, "identifierName": "cause" }, "name": "cause" }, "operator": "||", "right": { "type": "Identifier", "start": 524, "end": 531, "loc": { "start": { "line": 16, "column": 34 }, "end": { "line": 16, "column": 41 }, "identifierName": "message" }, "name": "message" } } } } ], "directives": [] }, "alternate": { "type": "BlockStatement", "start": 547, "end": 629, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 20, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 562, "end": 585, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 35 } }, "expression": { "type": "AssignmentExpression", "start": 562, "end": 584, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 562, "end": 574, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 24 } }, "object": { "type": "ThisExpression", "start": 562, "end": 566, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 16 } } }, "property": { "type": "Identifier", "start": 567, "end": 574, "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 24 }, "identifierName": "message" }, "name": "message" }, "computed": false }, "right": { "type": "Identifier", "start": 577, "end": 584, "loc": { "start": { "line": 18, "column": 27 }, "end": { "line": 18, "column": 34 }, "identifierName": "message" }, "name": "message" } } }, { "type": "ExpressionStatement", "start": 599, "end": 618, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 19, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 599, "end": 617, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 19, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 599, "end": 609, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 19, "column": 22 } }, "object": { "type": "ThisExpression", "start": 599, "end": 603, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 19, "column": 16 } } }, "property": { "type": "Identifier", "start": 604, "end": 609, "loc": { "start": { "line": 19, "column": 17 }, "end": { "line": 19, "column": 22 }, "identifierName": "cause" }, "name": "cause" }, "computed": false }, "right": { "type": "Identifier", "start": 612, "end": 617, "loc": { "start": { "line": 19, "column": 25 }, "end": { "line": 19, "column": 30 }, "identifierName": "cause" }, "name": "cause" } } } ], "directives": [], "trailingComments": null }, "trailingComments": [ { "type": "CommentLine", "value": " Maintains proper stack trace for where our error was thrown (only available on V8)", "start": 641, "end": 726, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 93 } } } ] }, { "type": "IfStatement", "start": 736, "end": 839, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 25, "column": 9 } }, "test": { "type": "MemberExpression", "start": 740, "end": 763, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 35 } }, "object": { "type": "Identifier", "start": 740, "end": 745, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 17 }, "identifierName": "Error" }, "name": "Error", "leadingComments": null }, "property": { "type": "Identifier", "start": 746, "end": 763, "loc": { "start": { "line": 23, "column": 18 }, "end": { "line": 23, "column": 35 }, "identifierName": "captureStackTrace" }, "name": "captureStackTrace" }, "computed": false, "leadingComments": null }, "consequent": { "type": "BlockStatement", "start": 765, "end": 839, "loc": { "start": { "line": 23, "column": 37 }, "end": { "line": 25, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 780, "end": 828, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 60 } }, "expression": { "type": "CallExpression", "start": 780, "end": 827, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 59 } }, "callee": { "type": "MemberExpression", "start": 780, "end": 803, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 35 } }, "object": { "type": "Identifier", "start": 780, "end": 785, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 17 }, "identifierName": "Error" }, "name": "Error" }, "property": { "type": "Identifier", "start": 786, "end": 803, "loc": { "start": { "line": 24, "column": 18 }, "end": { "line": 24, "column": 35 }, "identifierName": "captureStackTrace" }, "name": "captureStackTrace" }, "computed": false }, "arguments": [ { "type": "ThisExpression", "start": 804, "end": 808, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 40 } } }, { "type": "MemberExpression", "start": 810, "end": 826, "loc": { "start": { "line": 24, "column": 42 }, "end": { "line": 24, "column": 58 } }, "object": { "type": "ThisExpression", "start": 810, "end": 814, "loc": { "start": { "line": 24, "column": 42 }, "end": { "line": 24, "column": 46 } } }, "property": { "type": "Identifier", "start": 815, "end": 826, "loc": { "start": { "line": 24, "column": 47 }, "end": { "line": 24, "column": 58 }, "identifierName": "constructor" }, "name": "constructor" }, "computed": false } ] } } ], "directives": [] }, "alternate": null, "leadingComments": [ { "type": "CommentLine", "value": " Maintains proper stack trace for where our error was thrown (only available on V8)", "start": 641, "end": 726, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 93 } } } ] } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Base exception that all libsimba Exceptions extend\r\n * @param {string} message - the error message\r\n * @param {Error|string} [cause] - (Optional) wrap an existing error\r\n ", "start": 112, "end": 309, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 9, "column": 7 } } } ] } ], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Base exception that all libsimba Exceptions extend\r\n ", "start": 0, "end": 63, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Thrown when a method that should be implemented is not\r\n ", "start": 853, "end": 920, "loc": { "start": { "line": 29, "column": 0 }, "end": { "line": 31, "column": 3 } } } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Base exception that all libsimba Exceptions extend\r\n ", "start": 0, "end": 63, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Thrown when a method that should be implemented is not\r\n ", "start": 853, "end": 920, "loc": { "start": { "line": 29, "column": 0 }, "end": { "line": 31, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 922, "end