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,262 lines (1,261 loc) 275 kB
{ "type": "File", "start": 0, "end": 3239, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 102, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 3239, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 102, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 72, "end": 3238, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 101, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 87, "end": 3238, "loc": { "start": { "line": 5, "column": 15 }, "end": { "line": 101, "column": 1 } }, "id": { "type": "Identifier", "start": 93, "end": 99, "loc": { "start": { "line": 5, "column": 21 }, "end": { "line": 5, "column": 27 }, "identifierName": "Wallet" }, "name": "Wallet", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 100, "end": 3238, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 101, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 386, "end": 1652, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 43, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 386, "end": 397, "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": 398, "end": 417, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 35 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" } ], "body": { "type": "BlockStatement", "start": 419, "end": 1652, "loc": { "start": { "line": 11, "column": 37 }, "end": { "line": 43, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 429, "end": 525, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 14, "column": 9 } }, "test": { "type": "UnaryExpression", "start": 432, "end": 452, "loc": { "start": { "line": 12, "column": 11 }, "end": { "line": 12, "column": 31 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 433, "end": 452, "loc": { "start": { "line": 12, "column": 12 }, "end": { "line": 12, "column": 31 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 453, "end": 525, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 14, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 467, "end": 515, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 60 } }, "expression": { "type": "AssignmentExpression", "start": 467, "end": 514, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 59 } }, "operator": "=", "left": { "type": "Identifier", "start": 467, "end": 486, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 31 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" }, "right": { "type": "ArrowFunctionExpression", "start": 489, "end": 514, "loc": { "start": { "line": 13, "column": 34 }, "end": { "line": 13, "column": 59 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [], "body": { "type": "CallExpression", "start": 493, "end": 514, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 59 } }, "callee": { "type": "MemberExpression", "start": 493, "end": 508, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 53 } }, "object": { "type": "Identifier", "start": 493, "end": 500, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 45 }, "identifierName": "Promise" }, "name": "Promise" }, "property": { "type": "Identifier", "start": 501, "end": 508, "loc": { "start": { "line": 13, "column": 46 }, "end": { "line": 13, "column": 53 }, "identifierName": "resolve" }, "name": "resolve" }, "computed": false }, "arguments": [ { "type": "BooleanLiteral", "start": 509, "end": 513, "loc": { "start": { "line": 13, "column": 54 }, "end": { "line": 13, "column": 58 } }, "value": true } ] } } } } ], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "start": 534, "end": 581, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 55 } }, "expression": { "type": "AssignmentExpression", "start": 534, "end": 580, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 54 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 534, "end": 558, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 32 } }, "object": { "type": "ThisExpression", "start": 534, "end": 538, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 12 } } }, "property": { "type": "Identifier", "start": 539, "end": 558, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 32 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" }, "computed": false }, "right": { "type": "Identifier", "start": 561, "end": 580, "loc": { "start": { "line": 15, "column": 35 }, "end": { "line": 15, "column": 54 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" } } }, { "type": "IfStatement", "start": 590, "end": 704, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 18, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 594, "end": 621, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 39 } }, "left": { "type": "MemberExpression", "start": 594, "end": 610, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 28 } }, "object": { "type": "ThisExpression", "start": 594, "end": 598, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 16 } } }, "property": { "type": "Identifier", "start": 599, "end": 610, "loc": { "start": { "line": 16, "column": 17 }, "end": { "line": 16, "column": 28 }, "identifierName": "constructor" }, "name": "constructor" }, "computed": false }, "operator": "===", "right": { "type": "Identifier", "start": 615, "end": 621, "loc": { "start": { "line": 16, "column": 33 }, "end": { "line": 16, "column": 39 }, "identifierName": "Wallet" }, "name": "Wallet" } }, "consequent": { "type": "BlockStatement", "start": 623, "end": 704, "loc": { "start": { "line": 16, "column": 41 }, "end": { "line": 18, "column": 9 } }, "body": [ { "type": "ThrowStatement", "start": 637, "end": 694, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 69 } }, "argument": { "type": "NewExpression", "start": 643, "end": 693, "loc": { "start": { "line": 17, "column": 18 }, "end": { "line": 17, "column": 68 } }, "callee": { "type": "Identifier", "start": 647, "end": 656, "loc": { "start": { "line": 17, "column": 22 }, "end": { "line": 17, "column": 31 }, "identifierName": "TypeError" }, "name": "TypeError" }, "arguments": [ { "type": "StringLiteral", "start": 657, "end": 692, "loc": { "start": { "line": 17, "column": 32 }, "end": { "line": 17, "column": 67 } }, "extra": { "rawValue": "Can not construct abstract class.", "raw": "'Can not construct abstract class.'" }, "value": "Can not construct abstract class." } ] } } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 714, "end": 865, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 22, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 718, "end": 769, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 63 } }, "left": { "type": "MemberExpression", "start": 718, "end": 735, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 29 } }, "object": { "type": "ThisExpression", "start": 718, "end": 722, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 16 } } }, "property": { "type": "Identifier", "start": 723, "end": 735, "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 20, "column": 29 }, "identifierName": "unlockWallet" }, "name": "unlockWallet" }, "computed": false }, "operator": "===", "right": { "type": "MemberExpression", "start": 740, "end": 769, "loc": { "start": { "line": 20, "column": 34 }, "end": { "line": 20, "column": 63 } }, "object": { "type": "MemberExpression", "start": 740, "end": 756, "loc": { "start": { "line": 20, "column": 34 }, "end": { "line": 20, "column": 50 } }, "object": { "type": "Identifier", "start": 740, "end": 746, "loc": { "start": { "line": 20, "column": 34 }, "end": { "line": 20, "column": 40 }, "identifierName": "Wallet" }, "name": "Wallet" }, "property": { "type": "Identifier", "start": 747, "end": 756, "loc": { "start": { "line": 20, "column": 41 }, "end": { "line": 20, "column": 50 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 757, "end": 769, "loc": { "start": { "line": 20, "column": 51 }, "end": { "line": 20, "column": 63 }, "identifierName": "unlockWallet" }, "name": "unlockWallet" }, "computed": false } }, "consequent": { "type": "BlockStatement", "start": 771, "end": 865, "loc": { "start": { "line": 20, "column": 65 }, "end": { "line": 22, "column": 9 } }, "body": [ { "type": "ThrowStatement", "start": 785, "end": 855, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 82 } }, "argument": { "type": "NewExpression", "start": 791, "end": 854, "loc": { "start": { "line": 21, "column": 18 }, "end": { "line": 21, "column": 81 } }, "callee": { "type": "Identifier", "start": 795, "end": 804, "loc": { "start": { "line": 21, "column": 22 }, "end": { "line": 21, "column": 31 }, "identifierName": "TypeError" }, "name": "TypeError" }, "arguments": [ { "type": "StringLiteral", "start": 805, "end": 853, "loc": { "start": { "line": 21, "column": 32 }, "end": { "line": 21, "column": 80 } }, "extra": { "rawValue": "Please implement abstract method unlockWallet.", "raw": "'Please implement abstract method unlockWallet.'" }, "value": "Please implement abstract method unlockWallet." } ] } } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 875, "end": 1032, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 26, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 879, "end": 934, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 67 } }, "left": { "type": "MemberExpression", "start": 879, "end": 898, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 31 } }, "object": { "type": "ThisExpression", "start": 879, "end": 883, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 16 } } }, "property": { "type": "Identifier", "start": 884, "end": 898, "loc": { "start": { "line": 24, "column": 17 }, "end": { "line": 24, "column": 31 }, "identifierName": "generateWallet" }, "name": "generateWallet" }, "computed": false }, "operator": "===", "right": { "type": "MemberExpression", "start": 903, "end": 934, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 67 } }, "object": { "type": "MemberExpression", "start": 903, "end": 919, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 52 } }, "object": { "type": "Identifier", "start": 903, "end": 909, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 42 }, "identifierName": "Wallet" }, "name": "Wallet" }, "property": { "type": "Identifier", "start": 910, "end": 919, "loc": { "start": { "line": 24, "column": 43 }, "end": { "line": 24, "column": 52 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 920, "end": 934, "loc": { "start": { "line": 24, "column": 53 }, "end": { "line": 24, "column": 67 }, "identifierName": "generateWallet" }, "name": "generateWallet" }, "computed": false } }, "consequent": { "type": "BlockStatement", "start": 936, "end": 1032, "loc": { "start": { "line": 24, "column": 69 }, "end": { "line": 26, "column": 9 } }, "body": [ { "type": "ThrowStatement", "start": 950, "end": 1022, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 84 } }, "argument": { "type": "NewExpression", "start": 956, "end": 1021, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 83 } }, "callee": { "type": "Identifier", "start": 960, "end": 969, "loc": { "start": { "line": 25, "column": 22 }, "end": { "line": 25, "column": 31 }, "identifierName": "TypeError" }, "name": "TypeError" }, "arguments": [ { "type": "StringLiteral", "start": 970, "end": 1020, "loc": { "start": { "line": 25, "column": 32 }, "end": { "line": 25, "column": 82 } }, "extra": { "rawValue": "Please implement abstract method generateWallet.", "raw": "'Please implement abstract method generateWallet.'" }, "value": "Please implement abstract method generateWallet." } ] } } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 1042, "end": 1193, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 30, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 1046, "end": 1097, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 63 } }, "left": { "type": "MemberExpression", "start": 1046, "end": 1063, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 29 } }, "object": { "type": "ThisExpression", "start": 1046, "end": 1050, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 16 } } }, "property": { "type": "Identifier", "start": 1051, "end": 1063, "loc": { "start": { "line": 28, "column": 17 }, "end": { "line": 28, "column": 29 }, "identifierName": "deleteWallet" }, "name": "deleteWallet" }, "computed": false }, "operator": "===", "right": { "type": "MemberExpression", "start": 1068, "end": 1097, "loc": { "start": { "line": 28, "column": 34 }, "end": { "line": 28, "column": 63 } }, "object": { "type": "MemberExpression", "start": 1068,