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,504 lines 2.31 MB
{ "type": "File", "start": 0, "end": 16896, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 548, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 16896, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 548, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 36, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 36 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 } }, "local": { "type": "Identifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 }, "identifierName": "SimbaBase" }, "name": "SimbaBase" } } ], "source": { "type": "StringLiteral", "start": 22, "end": 35, "loc": { "start": { "line": 1, "column": 22 }, "end": { "line": 1, "column": 35 } }, "extra": { "rawValue": "./simbabase", "raw": "'./simbabase'" }, "value": "./simbabase" } }, { "type": "ImportDeclaration", "start": 37, "end": 344, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 12, "column": 23 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 50, "end": 73, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 27 } }, "imported": { "type": "Identifier", "start": 50, "end": 73, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 27 }, "identifierName": "WalletNotFoundException" }, "name": "WalletNotFoundException" }, "local": { "type": "Identifier", "start": 50, "end": 73, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 27 }, "identifierName": "WalletNotFoundException" }, "name": "WalletNotFoundException" } }, { "type": "ImportSpecifier", "start": 79, "end": 103, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 28 } }, "imported": { "type": "Identifier", "start": 79, "end": 103, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 28 }, "identifierName": "MissingMetadataException" }, "name": "MissingMetadataException" }, "local": { "type": "Identifier", "start": 79, "end": 103, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 28 }, "identifierName": "MissingMetadataException" }, "name": "MissingMetadataException" } }, { "type": "ImportSpecifier", "start": 109, "end": 137, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 32 } }, "imported": { "type": "Identifier", "start": 109, "end": 137, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 32 }, "identifierName": "GenerateTransactionException" }, "name": "GenerateTransactionException" }, "local": { "type": "Identifier", "start": 109, "end": 137, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 32 }, "identifierName": "GenerateTransactionException" }, "name": "GenerateTransactionException" } }, { "type": "ImportSpecifier", "start": 143, "end": 169, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 30 } }, "imported": { "type": "Identifier", "start": 143, "end": 169, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 30 }, "identifierName": "SubmitTransactionException" }, "name": "SubmitTransactionException" }, "local": { "type": "Identifier", "start": 143, "end": 169, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 30 }, "identifierName": "SubmitTransactionException" }, "name": "SubmitTransactionException" } }, { "type": "ImportSpecifier", "start": 175, "end": 206, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 35 } }, "imported": { "type": "Identifier", "start": 175, "end": 206, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 35 }, "identifierName": "TransactionStatusCheckException" }, "name": "TransactionStatusCheckException" }, "local": { "type": "Identifier", "start": 175, "end": 206, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 35 }, "identifierName": "TransactionStatusCheckException" }, "name": "TransactionStatusCheckException" } }, { "type": "ImportSpecifier", "start": 212, "end": 235, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 } }, "imported": { "type": "Identifier", "start": 212, "end": 235, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 }, "identifierName": "NotImplementedException" }, "name": "NotImplementedException" }, "local": { "type": "Identifier", "start": 212, "end": 235, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 }, "identifierName": "NotImplementedException" }, "name": "NotImplementedException" } }, { "type": "ImportSpecifier", "start": 241, "end": 265, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 28 } }, "imported": { "type": "Identifier", "start": 241, "end": 265, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 28 }, "identifierName": "GetTransactionsException" }, "name": "GetTransactionsException" }, "local": { "type": "Identifier", "start": 241, "end": 265, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 28 }, "identifierName": "GetTransactionsException" }, "name": "GetTransactionsException" } }, { "type": "ImportSpecifier", "start": 271, "end": 290, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 23 } }, "imported": { "type": "Identifier", "start": 271, "end": 290, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 23 }, "identifierName": "GetRequestException" }, "name": "GetRequestException" }, "local": { "type": "Identifier", "start": 271, "end": 290, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 23 }, "identifierName": "GetRequestException" }, "name": "GetRequestException" } }, { "type": "ImportSpecifier", "start": 296, "end": 320, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 28 } }, "imported": { "type": "Identifier", "start": 296, "end": 320, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 28 }, "identifierName": "RetriesExceededException" }, "name": "RetriesExceededException" }, "local": { "type": "Identifier", "start": 296, "end": 320, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 28 }, "identifierName": "RetriesExceededException" }, "name": "RetriesExceededException" } } ], "source": { "type": "StringLiteral", "start": 328, "end": 343, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 22 } }, "extra": { "rawValue": "../exceptions", "raw": "'../exceptions'" }, "value": "../exceptions" } }, { "type": "ImportDeclaration", "start": 345, "end": 389, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 44 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 352, "end": 365, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 20 } }, "local": { "type": "Identifier", "start": 352, "end": 365, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 20 }, "identifierName": "PagedResponse" }, "name": "PagedResponse" } } ], "source": { "type": "StringLiteral", "start": 371, "end": 388, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 13, "column": 43 } }, "extra": { "rawValue": "./pagedresponse", "raw": "\"./pagedresponse\"" }, "value": "./pagedresponse" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * libsimba API Interaction for Simbachain.com\n ", "start": 391, "end": 445, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 17, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 446, "end": 16895, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 547, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 461, "end": 16895, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 547, "column": 1 } }, "id": { "type": "Identifier", "start": 467, "end": 477, "loc": { "start": { "line": 18, "column": 21 }, "end": { "line": 18, "column": 31 }, "identifierName": "Simbachain" }, "name": "Simbachain", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 486, "end": 495, "loc": { "start": { "line": 18, "column": 40 }, "end": { "line": 18, "column": 49 }, "identifierName": "SimbaBase" }, "name": "SimbaBase" }, "body": { "type": "ClassBody", "start": 496, "end": 16895, "loc": { "start": { "line": 18, "column": 50 }, "end": { "line": 547, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 697, "end": 767, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 697, "end": 708, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 709, "end": 717, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 24 }, "identifierName": "endpoint" }, "name": "endpoint" }, { "type": "Identifier", "start": 719, "end": 725, "loc": { "start": { "line": 24, "column": 26 }, "end": { "line": 24, "column": 32 }, "identifierName": "wallet" }, "name": "wallet" } ], "body": { "type": "BlockStatement", "start": 727, "end": 767, "loc": { "start": { "line": 24, "column": 34 }, "end": { "line": 26, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 737, "end": 761, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 32 } }, "expression": { "type": "CallExpression", "start": 737, "end": 760, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 31 } }, "callee": { "type": "Super", "start": 737, "end": 742, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 743, "end": 751, "loc": { "start": { "line": 25, "column": 14 }, "end": { "line": 25, "column": 22 }, "identifierName": "endpoint" }, "name": "endpoint" }, { "type": "Identifier", "start": 753, "end": 759, "loc": { "start": { "line": 25, "column": 24 }, "end": { "line": 25, "column": 30 }, "identifierName": "wallet" }, "name": "wallet" } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * libsimba API Interaction for Simbachain.com\n * @param {string} endpoint - The endpoint of the API\n * @param {Wallet} [wallet] - an optional {@link Wallet} instance\n ", "start": 502, "end": 692, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 23, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @private\n * Perform asynchronous actions needed to initialise this class\n ", "start": 773, "end": 868, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 873, "end": 1149, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 39, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 879, "end": 889, "loc": { "start": { "line": 32, "column": 10 }, "end": { "line": 32, "column": 20 }, "identifierName": "initialize" }, "name": "initialize" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [], "body": { "type": "BlockStatement", "start": 892, "end": 1149, "loc": { "start": { "line": 32, "column": 23 }, "end": { "line": 39, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 902, "end": 962, "loc": { "start": { "line": 33, "column": 8 }, "end": { "line": 33, "column": 68 } }, "declarations": [ { "type": "VariableDeclarator", "start": 906, "end": 961, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 67 } }, "id": { "type": "Identifier", "start": 906, "end": 912, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 18 }, "identifierName": "result" }, "name": "result" }, "init": { "type": "AwaitExpression", "start": 915, "end": 961, "loc": { "start": { "line": 33, "column": 21 }, "end": { "line": 33, "column": 67 } }, "argument": { "type": "CallExpression", "start": 921, "end": 961, "loc": { "start": { "line": 33, "column": 27 }, "end": { "line": 33, "column": 67 } }, "callee": { "type": "Identifier", "start": 921, "end": 926, "loc": { "start": { "line": 33, "column": 27 }, "end": { "line": 33, "column": 32 }, "identifierName": "fetch" }, "name": "fetch" }, "arguments": [ { "type": "TemplateLiteral", "start": 927, "end": 960, "loc": { "start": { "line": 33, "column": 33 }, "end": { "line": 33, "column": 66 } }, "expressions": [ { "type": "MemberExpression", "start": 930, "end": 943, "loc": { "start": { "line": 33, "column": 36 }, "end": { "line": 33, "column": 49 } }, "object": { "type": "ThisExpression", "start": 930, "end": 934, "loc": { "start": { "line": 33, "column": 36 }, "end": { "line": 33, "column": 40 } } }, "property": { "type": "Identifier", "start": 935, "end": 943, "loc": { "start": { "line": 33, "column": 41 }, "end": { "line": 33, "column": 49 }, "identifierName": "endpoint" }, "name": "endpoint" }, "computed": false } ], "quasis": [ { "type": "TemplateElement", "start": 928, "end": 928, "loc": { "start": { "line": 33, "column": 34 }, "end": { "line": 33, "column": 34 } }, "value": { "raw": "", "cooked": "" }, "tail": false }, { "type": "TemplateElement", "start": 944, "end": 959, "loc": { "start": { "line": 33, "column": 50 }, "end": { "line": 33, "column": 65 } }, "value": { "raw": "?format=openapi", "cooked": "?format=openapi" }, "tail": true } ] } ] } } } ], "kind": "let" }, { "type": "VariableDeclaration", "start": 971, "end": 1005, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 42 } }, "declarations": [ { "type": "VariableDeclarator", "start": 975, "end": 1004, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 41 } }, "id": { "type": "Identifier", "start": 975, "end": 982, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 19 }, "identifierName": "swagger" }, "name": "swagger" }, "init": { "type": "AwaitExpression", "start": 985, "end": 1004, "loc": { "start": { "line": 34, "column": 22 }, "end": { "line": 34, "column": 41 } }, "argument": { "type": "CallExpression", "start": 991, "end": 1004, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 991, "end": 1002, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 39 } }, "object": { "type": "Identifier", "start": 991, "end": 997, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 34 }, "identifierName": "result" }, "name": "result" }, "property": { "type": "Identifier", "start": 998, "end": 1002, "loc": { "start": { "line": 34, "column": 35 }, "end": { "line": 34, "column": 39 }, "identifierName": "json" }, "name": "json" }, "computed": false }, "arguments": [] } } } ], "kind": "let" }, { "type": "IfStatement", "start": 1015, "end": 1143, "loc": { "start": { "line": 36, "column": 8 }, "end": { "line": 38, "column": 9 } }, "test": { "type": "LogicalExpression", "start": 1019, "end": 1071, "loc": { "start": { "line": 36, "column": 12 }, "end": { "line": 36, "column": 64 } }, "left": { "type": "BinaryExpression", "start": 1019, "end": 1036, "loc": { "start": { "line": 36, "column": 12 }, "end": { "line": 36, "column": 29 } }, "left": { "type": "StringLiteral", "start": 1019, "end": 1025, "loc": { "start": { "line": 36, "column": 12 }, "end": { "line": 36, "column": 18 } }, "extra": { "rawValue": "info", "raw": "'info'" }, "value": "info" }, "operator": "in", "right": { "type": "Identifier", "start": 1029, "end": 1036, "loc": { "start": { "line": 36, "column": 22 }, "end": { "line": 36, "column": 29 }, "identifierName": "swagger" }, "name": "swagger" } }, "operator": "&&", "right": { "type": "BinaryExpression", "start": 1040, "end": 1071, "loc": { "start": { "line": 36, "column": 33 }, "end": { "line": 36, "column": 64 } }, "left": { "type": "StringLiteral", "start": 1040, "end": 1055, "loc": { "start": { "line": 36, "column": 33 }, "end": { "line": 36, "column": 48 } }, "extra": { "rawValue": "x-simba-attrs", "raw": "'x-simba-attrs'" }, "value": "x-simba-attrs" }, "operator": "in", "right": { "type": "MemberExpression", "start": 1059, "end": 1071, "loc": { "start": { "line": 36, "column": 52 }, "end": { "line": 36, "column": 64 } }, "object": { "type": "Identifier", "start": 1059, "end": 1066, "loc": { "start": { "line": 36, "column": 52 }, "end": { "line": 36, "column": 59 }, "identifierName": "swagger" }, "name": "swagger" }, "property": { "type": "Identifier", "start": 1067, "end": 1071, "loc": { "start": { "line": 36, "column": 60 }, "end": { "line": 36,