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,578 lines (1,577 loc) 2.43 MB
{ "type": "File", "start": 0, "end": 18488, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 574, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 18488, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 574, "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": 38, "end": 382, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 13, "column": 23 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 52, "end": 75, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 27 } }, "imported": { "type": "Identifier", "start": 52, "end": 75, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 27 }, "identifierName": "WalletNotFoundException" }, "name": "WalletNotFoundException" }, "local": { "type": "Identifier", "start": 52, "end": 75, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 27 }, "identifierName": "WalletNotFoundException" }, "name": "WalletNotFoundException" } }, { "type": "ImportSpecifier", "start": 82, "end": 106, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 28 } }, "imported": { "type": "Identifier", "start": 82, "end": 106, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 28 }, "identifierName": "MissingMetadataException" }, "name": "MissingMetadataException" }, "local": { "type": "Identifier", "start": 82, "end": 106, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 28 }, "identifierName": "MissingMetadataException" }, "name": "MissingMetadataException" } }, { "type": "ImportSpecifier", "start": 113, "end": 141, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 32 } }, "imported": { "type": "Identifier", "start": 113, "end": 141, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 32 }, "identifierName": "GenerateTransactionException" }, "name": "GenerateTransactionException" }, "local": { "type": "Identifier", "start": 113, "end": 141, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 32 }, "identifierName": "GenerateTransactionException" }, "name": "GenerateTransactionException" } }, { "type": "ImportSpecifier", "start": 148, "end": 174, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 30 } }, "imported": { "type": "Identifier", "start": 148, "end": 174, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 30 }, "identifierName": "SubmitTransactionException" }, "name": "SubmitTransactionException" }, "local": { "type": "Identifier", "start": 148, "end": 174, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 30 }, "identifierName": "SubmitTransactionException" }, "name": "SubmitTransactionException" } }, { "type": "ImportSpecifier", "start": 181, "end": 212, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 35 } }, "imported": { "type": "Identifier", "start": 181, "end": 212, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 35 }, "identifierName": "TransactionStatusCheckException" }, "name": "TransactionStatusCheckException" }, "local": { "type": "Identifier", "start": 181, "end": 212, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 35 }, "identifierName": "TransactionStatusCheckException" }, "name": "TransactionStatusCheckException" } }, { "type": "ImportSpecifier", "start": 219, "end": 242, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 } }, "imported": { "type": "Identifier", "start": 219, "end": 242, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 }, "identifierName": "NotImplementedException" }, "name": "NotImplementedException" }, "local": { "type": "Identifier", "start": 219, "end": 242, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 27 }, "identifierName": "NotImplementedException" }, "name": "NotImplementedException" } }, { "type": "ImportSpecifier", "start": 249, "end": 273, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 28 } }, "imported": { "type": "Identifier", "start": 249, "end": 273, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 28 }, "identifierName": "GetTransactionsException" }, "name": "GetTransactionsException" }, "local": { "type": "Identifier", "start": 249, "end": 273, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 28 }, "identifierName": "GetTransactionsException" }, "name": "GetTransactionsException" } }, { "type": "ImportSpecifier", "start": 280, "end": 299, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 23 } }, "imported": { "type": "Identifier", "start": 280, "end": 299, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 23 }, "identifierName": "GetRequestException" }, "name": "GetRequestException" }, "local": { "type": "Identifier", "start": 280, "end": 299, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 23 }, "identifierName": "GetRequestException" }, "name": "GetRequestException" } }, { "type": "ImportSpecifier", "start": 306, "end": 326, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 24 } }, "imported": { "type": "Identifier", "start": 306, "end": 326, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 24 }, "identifierName": "PostRequestException" }, "name": "PostRequestException" }, "local": { "type": "Identifier", "start": 306, "end": 326, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 24 }, "identifierName": "PostRequestException" }, "name": "PostRequestException" } }, { "type": "ImportSpecifier", "start": 333, "end": 357, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 28 } }, "imported": { "type": "Identifier", "start": 333, "end": 357, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 28 }, "identifierName": "RetriesExceededException" }, "name": "RetriesExceededException" }, "local": { "type": "Identifier", "start": 333, "end": 357, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 28 }, "identifierName": "RetriesExceededException" }, "name": "RetriesExceededException" } } ], "source": { "type": "StringLiteral", "start": 366, "end": 381, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 22 } }, "extra": { "rawValue": "../exceptions", "raw": "'../exceptions'" }, "value": "../exceptions" } }, { "type": "ImportDeclaration", "start": 384, "end": 428, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 44 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 391, "end": 404, "loc": { "start": { "line": 14, "column": 7 }, "end": { "line": 14, "column": 20 } }, "local": { "type": "Identifier", "start": 391, "end": 404, "loc": { "start": { "line": 14, "column": 7 }, "end": { "line": 14, "column": 20 }, "identifierName": "PagedResponse" }, "name": "PagedResponse" } } ], "source": { "type": "StringLiteral", "start": 410, "end": 427, "loc": { "start": { "line": 14, "column": 26 }, "end": { "line": 14, "column": 43 } }, "extra": { "rawValue": "./pagedresponse", "raw": "\"./pagedresponse\"" }, "value": "./pagedresponse" } }, { "type": "VariableDeclaration", "start": 430, "end": 466, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 434, "end": 465, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 35 } }, "id": { "type": "Identifier", "start": 434, "end": 442, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 12 }, "identifierName": "FormData" }, "name": "FormData" }, "init": { "type": "CallExpression", "start": 445, "end": 465, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 15, "column": 35 } }, "callee": { "type": "Identifier", "start": 445, "end": 452, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 15, "column": 22 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 453, "end": 464, "loc": { "start": { "line": 15, "column": 23 }, "end": { "line": 15, "column": 34 } }, "extra": { "rawValue": "form-data", "raw": "'form-data'" }, "value": "form-data" } ] } } ], "kind": "var" }, { "type": "ImportDeclaration", "start": 468, "end": 494, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 26 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 475, "end": 480, "loc": { "start": { "line": 16, "column": 7 }, "end": { "line": 16, "column": 12 } }, "local": { "type": "Identifier", "start": 475, "end": 480, "loc": { "start": { "line": 16, "column": 7 }, "end": { "line": 16, "column": 12 }, "identifierName": "axios" }, "name": "axios" } } ], "source": { "type": "StringLiteral", "start": 486, "end": 493, "loc": { "start": { "line": 16, "column": 18 }, "end": { "line": 16, "column": 25 } }, "extra": { "rawValue": "axios", "raw": "'axios'" }, "value": "axios" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * libsimba API Interaction for Simbachain.com\r\n ", "start": 498, "end": 554, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 20, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 556, "end": 18486, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 573, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 571, "end": 18486, "loc": { "start": { "line": 21, "column": 15 }, "end": { "line": 573, "column": 1 } }, "id": { "type": "Identifier", "start": 577, "end": 587, "loc": { "start": { "line": 21, "column": 21 }, "end": { "line": 21, "column": 31 }, "identifierName": "Simbachain" }, "name": "Simbachain", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 596, "end": 605, "loc": { "start": { "line": 21, "column": 40 }, "end": { "line": 21, "column": 49 }, "identifierName": "SimbaBase" }, "name": "SimbaBase" }, "body": { "type": "ClassBody", "start": 606, "end": 18486, "loc": { "start": { "line": 21, "column": 50 }, "end": { "line": 573, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 813, "end": 885, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 29, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 813, "end": 824, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 825, "end": 833, "loc": { "start": { "line": 27, "column": 16 }, "end": { "line": 27, "column": 24 }, "identifierName": "endpoint" }, "name": "endpoint" }, { "type": "Identifier", "start": 835, "end": 841, "loc": { "start": { "line": 27, "column": 26 }, "end": { "line": 27, "column": 32 }, "identifierName": "wallet" }, "name": "wallet" } ], "body": { "type": "BlockStatement", "start": 843, "end": 885, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 29, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 854, "end": 878, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 32 } }, "expression": { "type": "CallExpression", "start": 854, "end": 877, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 31 } }, "callee": { "type": "Super", "start": 854, "end": 859, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 860, "end": 868, "loc": { "start": { "line": 28, "column": 14 }, "end": { "line": 28, "column": 22 }, "identifierName": "endpoint" }, "name": "endpoint" }, { "type": "Identifier", "start": 870, "end": 876, "loc": { "start": { "line": 28, "column": 24 }, "end": { "line": 28, "column": 30 }, "identifierName": "wallet" }, "name": "wallet" } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * libsimba API Interaction for Simbachain.com\r\n * @param {string} endpoint - The endpoint of the API\r\n * @param {Wallet} [wallet] - an optional {@link Wallet} instance\r\n ", "start": 613, "end": 807, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 26, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @private\r\n * Perform asynchronous actions needed to initialise this class\r\n ", "start": 893, "end": 991, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 34, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 997, "end": 1350, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 45, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1003, "end": 1013, "loc": { "start": { "line": 35, "column": 10 }, "end": { "line": 35, "column": 20 }, "identifierName": "initialize" }, "name": "initialize" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [], "body": { "type": "BlockStatement", "start": 1016, "end": 1350, "loc": { "start": { "line": 35, "column": 23 }, "end": { "line": 45, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 1027, "end": 1163, "loc": { "start": { "line": 36, "column": 8 }, "end": { "line": 39, "column": 11 } }, "declarations": [ { "type": "VariableDeclarator", "start": 1031, "end": 1162, "loc": { "start": { "line": 36, "column": 12 }, "end": { "line": 39, "column": 10 } }, "id": { "type": "Identifier", "start": 1031, "end": 1039, "loc": { "start": { "line": 36, "column": 12 }, "end": { "line": 36, "column": 20 }, "identifierName": "response" }, "name": "response" }, "init": { "type": "AwaitExpression", "start": 1042, "end": 1162, "loc": { "start": { "line": 36, "column": 23 }, "end": { "line": 39, "column": 10 } }, "argument": { "type": "CallExpression", "start": 1048, "end": 1162, "loc": { "start": { "line": 36, "column": 29 }, "end": { "line": 39, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 1048, "end": 1061, "loc": { "start": { "line": 36, "column": 29 }, "end": { "line": 36, "column": 42 } }, "object": { "type": "Identifier", "start": 1048, "end": 1053, "loc": { "start": { "line": 36, "column": 29 }, "end": { "line": 36, "column": 34 }, "identifierName": "axios" }, "name": "axios" }, "property": { "type": "Identifier", "start": 1054, "end": 1061, "loc": { "start": { "line": 36, "column": 35 }, "end": { "line": 36, "column": 42 }, "identifierName": "request" }, "name": "request" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 1062, "end": 1161, "loc": { "start": { "line": 36, "column": 43 }, "end": { "line": 39, "column": 9 } }, "properties": [ { "type": "ObjectProperty", "start": 1077, "end": 1115, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 50 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1077, "end": 1080, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 15 }, "identifierName": "url" }, "name": "url" }, "value": { "type": "TemplateLiteral", "start": 1082, "end": 1115, "loc": { "start": { "line": 37, "column": 17 }, "end": { "line": 37, "column": 50 } }, "expressions": [ { "type": "MemberExpression", "start": 1085, "end": 1098, "loc": { "start": { "line": 37, "column": 20 }, "end": { "line": 37, "column": 33 } }, "object": { "type": "ThisExpression", "start": 1085, "end": 1089, "loc": { "start": { "line": 37, "column": 20 }, "end": { "line": 37, "column": 24 } } }, "property": { "type": "Identifier", "start": 1090, "end": 1098, "loc": { "start": { "line": 37, "column": 25 }, "end": { "line": 37, "column": 33 }, "identifierName": "endpoint" }, "name": "endpoint" }, "computed": false } ], "quasis": [ { "type": "TemplateElement", "start": 1083, "end": 1083, "loc": { "start": { "line": 37, "column": 18 }, "end": { "line": 37, "column": 18 } }, "value": { "raw": "", "cooked": "" }, "tail": false }, { "type": "TemplateElement", "start": 1099, "end": 1114, "loc": { "start": { "line": 37, "column": 34 }, "end": { "line": 37, "column": 49 } }, "value": { "raw": "?format=openapi", "cooked": "?format=openapi" }, "tail": true } ] } }, { "type": "ObjectProperty", "start": 1130, "end": 1150, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1130, "end": 1142, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 24 }, "identifierName": "responseType" }, "name": "responseType" }, "value": { "type": "StringLiteral", "start": 1144, "end": 1150, "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 32 } }, "extra": { "rawValue": "json", "raw": "'json'" }, "value": "json" } } ] } ] } } } ], "kind": "let" }, {