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,292 lines (1,291 loc) 265 kB
{ "type": "File", "start": 0, "end": 3340, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 102, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 3340, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 102, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 76, "end": 3338, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 101, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 91, "end": 3338, "loc": { "start": { "line": 5, "column": 15 }, "end": { "line": 101, "column": 1 } }, "id": { "type": "Identifier", "start": 97, "end": 103, "loc": { "start": { "line": 5, "column": 21 }, "end": { "line": 5, "column": 27 }, "identifierName": "Wallet" }, "name": "Wallet", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 104, "end": 3338, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 101, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 396, "end": 1694, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 43, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 396, "end": 407, "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": 408, "end": 427, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 35 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" } ], "body": { "type": "BlockStatement", "start": 429, "end": 1694, "loc": { "start": { "line": 11, "column": 37 }, "end": { "line": 43, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 440, "end": 538, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 14, "column": 9 } }, "test": { "type": "UnaryExpression", "start": 443, "end": 463, "loc": { "start": { "line": 12, "column": 11 }, "end": { "line": 12, "column": 31 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 444, "end": 463, "loc": { "start": { "line": 12, "column": 12 }, "end": { "line": 12, "column": 31 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 464, "end": 538, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 14, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 479, "end": 527, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 60 } }, "expression": { "type": "AssignmentExpression", "start": 479, "end": 526, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 59 } }, "operator": "=", "left": { "type": "Identifier", "start": 479, "end": 498, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 31 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" }, "right": { "type": "ArrowFunctionExpression", "start": 501, "end": 526, "loc": { "start": { "line": 13, "column": 34 }, "end": { "line": 13, "column": 59 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [], "body": { "type": "CallExpression", "start": 505, "end": 526, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 59 } }, "callee": { "type": "MemberExpression", "start": 505, "end": 520, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 53 } }, "object": { "type": "Identifier", "start": 505, "end": 512, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 45 }, "identifierName": "Promise" }, "name": "Promise" }, "property": { "type": "Identifier", "start": 513, "end": 520, "loc": { "start": { "line": 13, "column": 46 }, "end": { "line": 13, "column": 53 }, "identifierName": "resolve" }, "name": "resolve" }, "computed": false }, "arguments": [ { "type": "BooleanLiteral", "start": 521, "end": 525, "loc": { "start": { "line": 13, "column": 54 }, "end": { "line": 13, "column": 58 } }, "value": true } ] } } } } ], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "start": 548, "end": 595, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 55 } }, "expression": { "type": "AssignmentExpression", "start": 548, "end": 594, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 54 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 548, "end": 572, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 32 } }, "object": { "type": "ThisExpression", "start": 548, "end": 552, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 12 } } }, "property": { "type": "Identifier", "start": 553, "end": 572, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 32 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" }, "computed": false }, "right": { "type": "Identifier", "start": 575, "end": 594, "loc": { "start": { "line": 15, "column": 35 }, "end": { "line": 15, "column": 54 }, "identifierName": "signingConfirmation" }, "name": "signingConfirmation" } } }, { "type": "IfStatement", "start": 605, "end": 721, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 18, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 609, "end": 636, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 39 } }, "left": { "type": "MemberExpression", "start": 609, "end": 625, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 28 } }, "object": { "type": "ThisExpression", "start": 609, "end": 613, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 16 } } }, "property": { "type": "Identifier", "start": 614, "end": 625, "loc": { "start": { "line": 16, "column": 17 }, "end": { "line": 16, "column": 28 }, "identifierName": "constructor" }, "name": "constructor" }, "computed": false }, "operator": "===", "right": { "type": "Identifier", "start": 630, "end": 636, "loc": { "start": { "line": 16, "column": 33 }, "end": { "line": 16, "column": 39 }, "identifierName": "Wallet" }, "name": "Wallet" } }, "consequent": { "type": "BlockStatement", "start": 638, "end": 721, "loc": { "start": { "line": 16, "column": 41 }, "end": { "line": 18, "column": 9 } }, "body": [ { "type": "ThrowStatement", "start": 653, "end": 710, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 69 } }, "argument": { "type": "NewExpression", "start": 659, "end": 709, "loc": { "start": { "line": 17, "column": 18 }, "end": { "line": 17, "column": 68 } }, "callee": { "type": "Identifier", "start": 663, "end": 672, "loc": { "start": { "line": 17, "column": 22 }, "end": { "line": 17, "column": 31 }, "identifierName": "TypeError" }, "name": "TypeError" }, "arguments": [ { "type": "StringLiteral", "start": 673, "end": 708, "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": 733, "end": 886, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 22, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 737, "end": 788, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 63 } }, "left": { "type": "MemberExpression", "start": 737, "end": 754, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 29 } }, "object": { "type": "ThisExpression", "start": 737, "end": 741, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 16 } } }, "property": { "type": "Identifier", "start": 742, "end": 754, "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 20, "column": 29 }, "identifierName": "unlockWallet" }, "name": "unlockWallet" }, "computed": false }, "operator": "===", "right": { "type": "MemberExpression", "start": 759, "end": 788, "loc": { "start": { "line": 20, "column": 34 }, "end": { "line": 20, "column": 63 } }, "object": { "type": "MemberExpression", "start": 759, "end": 775, "loc": { "start": { "line": 20, "column": 34 }, "end": { "line": 20, "column": 50 } }, "object": { "type": "Identifier", "start": 759, "end": 765, "loc": { "start": { "line": 20, "column": 34 }, "end": { "line": 20, "column": 40 }, "identifierName": "Wallet" }, "name": "Wallet" }, "property": { "type": "Identifier", "start": 766, "end": 775, "loc": { "start": { "line": 20, "column": 41 }, "end": { "line": 20, "column": 50 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 776, "end": 788, "loc": { "start": { "line": 20, "column": 51 }, "end": { "line": 20, "column": 63 }, "identifierName": "unlockWallet" }, "name": "unlockWallet" }, "computed": false } }, "consequent": { "type": "BlockStatement", "start": 790, "end": 886, "loc": { "start": { "line": 20, "column": 65 }, "end": { "line": 22, "column": 9 } }, "body": [ { "type": "ThrowStatement", "start": 805, "end": 875, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 82 } }, "argument": { "type": "NewExpression", "start": 811, "end": 874, "loc": { "start": { "line": 21, "column": 18 }, "end": { "line": 21, "column": 81 } }, "callee": { "type": "Identifier", "start": 815, "end": 824, "loc": { "start": { "line": 21, "column": 22 }, "end": { "line": 21, "column": 31 }, "identifierName": "TypeError" }, "name": "TypeError" }, "arguments": [ { "type": "StringLiteral", "start": 825, "end": 873, "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": 898, "end": 1057, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 26, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 902, "end": 957, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 67 } }, "left": { "type": "MemberExpression", "start": 902, "end": 921, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 31 } }, "object": { "type": "ThisExpression", "start": 902, "end": 906, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 16 } } }, "property": { "type": "Identifier", "start": 907, "end": 921, "loc": { "start": { "line": 24, "column": 17 }, "end": { "line": 24, "column": 31 }, "identifierName": "generateWallet" }, "name": "generateWallet" }, "computed": false }, "operator": "===", "right": { "type": "MemberExpression", "start": 926, "end": 957, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 67 } }, "object": { "type": "MemberExpression", "start": 926, "end": 942, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 52 } }, "object": { "type": "Identifier", "start": 926, "end": 932, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 42 }, "identifierName": "Wallet" }, "name": "Wallet" }, "property": { "type": "Identifier", "start": 933, "end": 942, "loc": { "start": { "line": 24, "column": 43 }, "end": { "line": 24, "column": 52 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 943, "end": 957, "loc": { "start": { "line": 24, "column": 53 }, "end": { "line": 24, "column": 67 }, "identifierName": "generateWallet" }, "name": "generateWallet" }, "computed": false } }, "consequent": { "type": "BlockStatement", "start": 959, "end": 1057, "loc": { "start": { "line": 24, "column": 69 }, "end": { "line": 26, "column": 9 } }, "body": [ { "type": "ThrowStatement", "start": 974, "end": 1046, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 84 } }, "argument": { "type": "NewExpression", "start": 980, "end": 1045, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 83 } }, "callee": { "type": "Identifier", "start": 984, "end": 993, "loc": { "start": { "line": 25, "column": 22 }, "end": { "line": 25, "column": 31 }, "identifierName": "TypeError" }, "name": "TypeError" }, "arguments": [ { "type": "StringLiteral", "start": 994, "end": 1044, "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": 1069, "end": 1222, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 30, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 1073, "end": 1124, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 63 } }, "left": { "type": "MemberExpression", "start": 1073, "end": 1090, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 29 } }, "object": { "type": "ThisExpression", "start": 1073, "end": 1077, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 16 } } }, "property": { "type": "Identifier", "start": 1078, "end": 1090, "loc": { "start": { "line": 28, "column": 17 }, "end": { "line": 28, "column": 29 }, "identifierName": "deleteWallet" }, "name": "deleteWallet" }, "computed": false }, "operator": "===", "right": { "type": "MemberExpression", "start": 1095, "end": 1124, "loc": { "start": { "line": 28, "column": 34 }, "end": { "line": 28, "column": 63 } }, "object": { "type": "MemberExpression", "start": 1095, "end": 1111, "loc": { "start": { "line": 28, "column": 34 }, "end": { "line": 28, "column": 50 } }, "object": { "type": "Identifier", "start": 1095, "end": 1101, "loc": { "start": { "line": 28, "column": 34 }, "end": { "line": 28, "column": 40 }, "identifierName": "Wallet" }, "name": "Wallet" }, "property": { "type": "Identifier",