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,362 lines (1,361 loc) 214 kB
{ "type": "File", "start": 0, "end": 1903, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 78, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1903, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 78, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 42, "end": 1901, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 77, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 57, "end": 1901, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 77, "column": 1 } }, "id": { "type": "Identifier", "start": 63, "end": 76, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 34 }, "identifierName": "PagedResponse" }, "name": "PagedResponse", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 77, "end": 1901, "loc": { "start": { "line": 4, "column": 35 }, "end": { "line": 77, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 330, "end": 598, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 18, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 330, "end": 341, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 342, "end": 346, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 20 }, "identifierName": "data" }, "name": "data" }, { "type": "Identifier", "start": 348, "end": 351, "loc": { "start": { "line": 11, "column": 22 }, "end": { "line": 11, "column": 25 }, "identifierName": "url" }, "name": "url" }, { "type": "Identifier", "start": 353, "end": 358, "loc": { "start": { "line": 11, "column": 27 }, "end": { "line": 11, "column": 32 }, "identifierName": "simba" }, "name": "simba" } ], "body": { "type": "BlockStatement", "start": 359, "end": 598, "loc": { "start": { "line": 11, "column": 33 }, "end": { "line": 18, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 370, "end": 405, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 43 } }, "expression": { "type": "AssignmentExpression", "start": 370, "end": 404, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 42 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 370, "end": 378, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 16 } }, "object": { "type": "ThisExpression", "start": 370, "end": 374, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } } }, "property": { "type": "Identifier", "start": 375, "end": 378, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 16 }, "identifierName": "url" }, "name": "url" }, "computed": false }, "right": { "type": "CallExpression", "start": 381, "end": 404, "loc": { "start": { "line": 12, "column": 19 }, "end": { "line": 12, "column": 42 } }, "callee": { "type": "MemberExpression", "start": 381, "end": 402, "loc": { "start": { "line": 12, "column": 19 }, "end": { "line": 12, "column": 40 } }, "object": { "type": "NewExpression", "start": 381, "end": 393, "loc": { "start": { "line": 12, "column": 19 }, "end": { "line": 12, "column": 31 } }, "callee": { "type": "Identifier", "start": 385, "end": 388, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 26 }, "identifierName": "URL" }, "name": "URL" }, "arguments": [ { "type": "Identifier", "start": 389, "end": 392, "loc": { "start": { "line": 12, "column": 27 }, "end": { "line": 12, "column": 30 }, "identifierName": "url" }, "name": "url" } ] }, "property": { "type": "Identifier", "start": 394, "end": 402, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 40 }, "identifierName": "toString" }, "name": "toString" }, "computed": false }, "arguments": [] } } }, { "type": "ExpressionStatement", "start": 415, "end": 440, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 415, "end": 439, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 415, "end": 426, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 19 } }, "object": { "type": "ThisExpression", "start": 415, "end": 419, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 12 } } }, "property": { "type": "Identifier", "start": 420, "end": 426, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 19 }, "identifierName": "_count" }, "name": "_count" }, "computed": false }, "right": { "type": "MemberExpression", "start": 429, "end": 439, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 13, "column": 32 } }, "object": { "type": "Identifier", "start": 429, "end": 433, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 13, "column": 26 }, "identifierName": "data" }, "name": "data" }, "property": { "type": "Identifier", "start": 434, "end": 439, "loc": { "start": { "line": 13, "column": 27 }, "end": { "line": 13, "column": 32 }, "identifierName": "count" }, "name": "count" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 450, "end": 478, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 450, "end": 477, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 450, "end": 465, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 23 } }, "object": { "type": "ThisExpression", "start": 450, "end": 454, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 } } }, "property": { "type": "Identifier", "start": 455, "end": 465, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 23 }, "identifierName": "_next_page" }, "name": "_next_page" }, "computed": false }, "right": { "type": "MemberExpression", "start": 468, "end": 477, "loc": { "start": { "line": 14, "column": 26 }, "end": { "line": 14, "column": 35 } }, "object": { "type": "Identifier", "start": 468, "end": 472, "loc": { "start": { "line": 14, "column": 26 }, "end": { "line": 14, "column": 30 }, "identifierName": "data" }, "name": "data" }, "property": { "type": "Identifier", "start": 473, "end": 477, "loc": { "start": { "line": 14, "column": 31 }, "end": { "line": 14, "column": 35 }, "identifierName": "next" }, "name": "next" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 488, "end": 524, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 44 } }, "expression": { "type": "AssignmentExpression", "start": 488, "end": 523, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 43 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 488, "end": 507, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 27 } }, "object": { "type": "ThisExpression", "start": 488, "end": 492, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 12 } } }, "property": { "type": "Identifier", "start": 493, "end": 507, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 27 }, "identifierName": "_previous_page" }, "name": "_previous_page" }, "computed": false }, "right": { "type": "MemberExpression", "start": 510, "end": 523, "loc": { "start": { "line": 15, "column": 30 }, "end": { "line": 15, "column": 43 } }, "object": { "type": "Identifier", "start": 510, "end": 514, "loc": { "start": { "line": 15, "column": 30 }, "end": { "line": 15, "column": 34 }, "identifierName": "data" }, "name": "data" }, "property": { "type": "Identifier", "start": 515, "end": 523, "loc": { "start": { "line": 15, "column": 35 }, "end": { "line": 15, "column": 43 }, "identifierName": "previous" }, "name": "previous" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 534, "end": 562, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 534, "end": 561, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 534, "end": 546, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 20 } }, "object": { "type": "ThisExpression", "start": 534, "end": 538, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 12 } } }, "property": { "type": "Identifier", "start": 539, "end": 546, "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 20 }, "identifierName": "results" }, "name": "results" }, "computed": false }, "right": { "type": "MemberExpression", "start": 549, "end": 561, "loc": { "start": { "line": 16, "column": 23 }, "end": { "line": 16, "column": 35 } }, "object": { "type": "Identifier", "start": 549, "end": 553, "loc": { "start": { "line": 16, "column": 23 }, "end": { "line": 16, "column": 27 }, "identifierName": "data" }, "name": "data" }, "property": { "type": "Identifier", "start": 554, "end": 561, "loc": { "start": { "line": 16, "column": 28 }, "end": { "line": 16, "column": 35 }, "identifierName": "results" }, "name": "results" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 572, "end": 591, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 572, "end": 590, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 572, "end": 582, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 18 } }, "object": { "type": "ThisExpression", "start": 572, "end": 576, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 12 } } }, "property": { "type": "Identifier", "start": 577, "end": 582, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 18 }, "identifierName": "simba" }, "name": "simba" }, "computed": false }, "right": { "type": "Identifier", "start": 585, "end": 590, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 26 }, "identifierName": "simba" }, "name": "simba" } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Wrapper for paged responses\r\n * @param {Object} data - The response\r\n * @param {URL} url - The URL that provided the response\r\n * @param {SimbaBase} simba - The SimbaBase instance that requested the response\r\n ", "start": 84, "end": 324, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 10, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Grab the next page\r\n * @returns {Promise<PagedResponse> | null} - Null if there's no next page\r\n ", "start": 606, "end": 725, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 731, "end": 882, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 27, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 737, "end": 741, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 14 }, "identifierName": "next" }, "name": "next" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [], "body": { "type": "BlockStatement", "start": 743, "end": 882, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 754, "end": 787, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 41 } }, "test": { "type": "UnaryExpression", "start": 757, "end": 773, "loc": { "start": { "line": 25, "column": 11 }, "end": { "line": 25, "column": 27 } }, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", "start": 758, "end": 773, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 27 } }, "object": { "type": "ThisExpression", "start": 758, "end": 762, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 16 } } }, "property": { "type": "Identifier", "start": 763, "end": 773, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 27 }, "identifierName": "_next_page" }, "name": "_next_page" }, "computed": false }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "ReturnStatement", "start": 775, "end": 787, "loc": { "start": { "line": 25, "column": 29 }, "end": { "line": 25, "column": 41 } }, "argument": { "type": "NullLiteral", "start": 782, "end": 786, "loc": { "start": { "line": 25, "column": 36 }, "end": { "line": 25, "column": 40 } } } }, "alternate": null }, { "type": "ReturnStatement", "start": 797, "end": 875, "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 86 } }, "argument": { "type": "CallExpression", "start": 804, "end": 874, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 85 } }, "callee": { "type": "MemberExpression", "start": 804, "end": 837, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 48 } }, "object": { "type": "MemberExpression", "start": 804, "end": 814, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 25 } }, "object": { "type": "ThisExpression", "start": 804, "end": 808, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 19 } } }, "property": { "type": "Identifier", "start": 809, "end": 814, "loc": { "start": { "line": 26, "column": 20 }, "end": { "line": 26, "column": 25 }, "identifierName": "simba" }, "name": "simba" }, "computed": false }, "property": { "type": "Identifier", "start": 815, "end": 837, "loc": { "start": { "line": 26, "column": 26 }, "end": { "line": 26, "column": 48 }, "identifierName": "sendTransactionRequest" }, "name": "sendTransactionRequest" }, "computed": false }, "arguments": [ { "type": "CallExpression", "start": 838, "end": 873, "loc": { "start": { "line": 26, "column": 49 }, "end": { "line": 26, "column": 84 } }, "callee": { "type": "MemberExpression", "start": 838, "end": 871, "loc": { "start": { "line": 26, "column": 49 }, "end": { "line": 26, "column": 82 } }, "object": { "type": "NewExpression", "start": 838, "end": 862, "loc": { "start": { "line": 26, "column": 49 }, "end": { "line": 26, "column": 73 } }, "callee": { "type": "Identifier", "start": 842, "end": 845, "loc": { "start": { "line": 26, "column": 53 }, "end": {