@massalabs/wallet-provider 0.0.1-dev.20230522090628 → 0.0.1-dev.20230525092413

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle.js CHANGED
@@ -553,7 +553,7 @@ Object.defineProperty(exports, "Provider", { enumerable: true, get: function ()
553
553
  },{"./AccountDeletion":5,"./AccountImport":6,"./Provider":7}],9:[function(require,module,exports){
554
554
  "use strict";
555
555
  Object.defineProperty(exports, "__esModule", { value: true });
556
- exports.deleteRequest = exports.postRequest = exports.getRequest = void 0;
556
+ exports.putRequest = exports.deleteRequest = exports.postRequest = exports.getRequest = void 0;
557
557
  /**
558
558
  * This file defines a TypeScript module with methods for performing GET, POST and DELETE http requests.
559
559
  *
@@ -604,6 +604,7 @@ exports.getRequest = getRequest;
604
604
  *
605
605
  *
606
606
  * @param url - The url to call.
607
+ * @param body - The body of the request.
607
608
  * @returns a Promise that resolves to an instance of JsonRpcResponseData.
608
609
  *
609
610
  */
@@ -653,6 +654,34 @@ async function deleteRequest(url) {
653
654
  };
654
655
  }
655
656
  exports.deleteRequest = deleteRequest;
657
+ /**
658
+ * This method makes a PUT request to an http rest point.
659
+ *
660
+ *
661
+ * @param url - The url to call.
662
+ * @param body - The body of the request.
663
+ * @returns a Promise that resolves to an instance of JsonRpcResponseData.
664
+ *
665
+ */
666
+ async function putRequest(url, body) {
667
+ let resp = null;
668
+ try {
669
+ resp = await axios_1.default.put(url, body, requestHeaders);
670
+ }
671
+ catch (ex) {
672
+ return {
673
+ isError: true,
674
+ result: null,
675
+ error: new Error('Axios error: ' + String(ex)),
676
+ };
677
+ }
678
+ return {
679
+ isError: false,
680
+ result: resp.data,
681
+ error: null,
682
+ };
683
+ }
684
+ exports.putRequest = putRequest;
656
685
 
657
686
  },{"axios":14}],10:[function(require,module,exports){
658
687
  "use strict";
@@ -740,7 +769,7 @@ class ThyraAccount {
740
769
  async sign(data) {
741
770
  let signOpResponse = null;
742
771
  try {
743
- signOpResponse = await (0, RequestHandler_1.postRequest)(`${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/signOperation`, {
772
+ signOpResponse = await (0, RequestHandler_1.postRequest)(`${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/sign`, {
744
773
  operation: data,
745
774
  batch: false,
746
775
  });
@@ -761,8 +790,25 @@ class ThyraAccount {
761
790
  * @param fee - The fee to be paid for the transaction execution by the node.
762
791
  * @returns An ITransactionDetails object. It contains the operationId on the network.
763
792
  */
764
- buyRolls(amount, fee) {
765
- throw new Error('Method not implemented.');
793
+ async buyRolls(amount, fee) {
794
+ let buyRollsOpResponse = null;
795
+ const url = `${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/rolls`;
796
+ const body = {
797
+ fee: fee.toString(),
798
+ amount: amount.toString(),
799
+ side: 'buy',
800
+ };
801
+ try {
802
+ buyRollsOpResponse = await (0, RequestHandler_1.postRequest)(url, body);
803
+ }
804
+ catch (ex) {
805
+ console.error(`Thyra account: error while buying rolls: ${ex}`);
806
+ throw ex;
807
+ }
808
+ if (buyRollsOpResponse.isError || buyRollsOpResponse.error) {
809
+ throw buyRollsOpResponse.error;
810
+ }
811
+ return buyRollsOpResponse.result;
766
812
  }
767
813
  /**
768
814
  * This method aims to sell rolls on behalf of the sender.
@@ -771,8 +817,25 @@ class ThyraAccount {
771
817
  * @param fee - The fee to be paid for the transaction execution by the node.
772
818
  * @returns An ITransactionDetails object. It contains the operationId on the network.
773
819
  */
774
- sellRolls(amount, fee) {
775
- throw new Error('Method not implemented.');
820
+ async sellRolls(amount, fee) {
821
+ let sellRollsOpResponse = null;
822
+ const url = `${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/rolls`;
823
+ const body = {
824
+ fee: fee.toString(),
825
+ amount: amount.toString(),
826
+ side: 'sell',
827
+ };
828
+ try {
829
+ sellRollsOpResponse = await (0, RequestHandler_1.postRequest)(url, body);
830
+ }
831
+ catch (ex) {
832
+ console.error(`Thyra account: error while selling rolls: ${ex}`);
833
+ throw ex;
834
+ }
835
+ if (sellRollsOpResponse.isError || sellRollsOpResponse.error) {
836
+ throw sellRollsOpResponse.error;
837
+ }
838
+ return sellRollsOpResponse.result;
776
839
  }
777
840
  /**
778
841
  * This method aims to transfer MAS on behalf of the sender to a recipient.
@@ -899,18 +962,23 @@ exports.ThyraDiscovery = ThyraDiscovery;
899
962
  Object.defineProperty(exports, "__esModule", {
900
963
  value: true
901
964
  });
902
- exports.ThyraProvider = exports.THYRA_PROVIDER_NAME = exports.THYRA_IMPORT_ACCOUNTS_URL = exports.THYRA_ACCOUNTS_URL = void 0;
965
+ exports.ThyraProvider = exports.THYRA_PROVIDER_NAME = exports.THYRA_URL = exports.THYRA_IMPORT_ACCOUNTS_URL = exports.THYRA_ACCOUNTS_URL = void 0;
903
966
  const AccountDeletion_1 = require("../provider/AccountDeletion");
967
+ const AccountImport_1 = require("../provider/AccountImport");
904
968
  const RequestHandler_1 = require("./RequestHandler");
905
969
  const ThyraAccount_1 = require("./ThyraAccount");
906
970
  /**
907
971
  * The Thyra accounts url
908
972
  */
909
- exports.THYRA_ACCOUNTS_URL = 'https://my.massa/thyra/plugin/massalabs/wallet/rest/wallet';
973
+ exports.THYRA_ACCOUNTS_URL = 'https://my.massa/thyra/plugin/massalabs/wallet/api/accounts';
910
974
  /**
911
975
  * Thyra's url for importing accounts
912
976
  */
913
977
  exports.THYRA_IMPORT_ACCOUNTS_URL = `${exports.THYRA_ACCOUNTS_URL}/import/`;
978
+ /**
979
+ * MassaStation url
980
+ */
981
+ exports.THYRA_URL = 'https://my.massa/';
914
982
  /**
915
983
  * Thyra's wallet provider name
916
984
  */
@@ -964,16 +1032,30 @@ class ThyraProvider {
964
1032
  /**
965
1033
  * This method makes an http call to the Thyra server to import an account with the given publicKey and privateKey.
966
1034
  *
967
- * @remarks This method in not yet implemented and depends on `massalabs/thyra-plugin-wallet#82` to be merged first
968
- *
969
1035
  * @param publicKey - The public key of the account.
970
1036
  * @param privateKey - The private key of the account.
971
- * @returns a Promise that resolves to an instance of IAccountImportResponse.
972
1037
  *
1038
+ * @returns a Promise that resolves to an instance of IAccountImportResponse.
973
1039
  */
974
1040
  async importAccount(publicKey, privateKey) {
975
- // TODO: once massalabs/thyra-plugin-wallet#82 is merged, to be updated here
976
- throw new Error(`Unimplemented method!`);
1041
+ const accountImportRequest = {
1042
+ publicKey,
1043
+ privateKey
1044
+ };
1045
+ let thyraAccountsResponse = null;
1046
+ try {
1047
+ thyraAccountsResponse = await (0, RequestHandler_1.putRequest)(exports.THYRA_ACCOUNTS_URL, accountImportRequest);
1048
+ } catch (ex) {
1049
+ console.log(`Thyra accounts retrieval error: ${ex}`);
1050
+ throw ex;
1051
+ }
1052
+ if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
1053
+ throw thyraAccountsResponse.error.message;
1054
+ }
1055
+ return {
1056
+ response: AccountImport_1.EAccountImportResponse.OK,
1057
+ message: 'Account imported successfully'
1058
+ };
977
1059
  }
978
1060
  /**
979
1061
  * This method sends an http call to the Thyra server to delete the account associated with the given address.
@@ -987,7 +1069,7 @@ class ThyraProvider {
987
1069
  try {
988
1070
  allAccounts = await (0, RequestHandler_1.getRequest)(exports.THYRA_ACCOUNTS_URL);
989
1071
  } catch (ex) {
990
- console.error(`Thyra accounts retrieval error`);
1072
+ console.log(`Thyra accounts retrieval error: ${ex}`);
991
1073
  throw ex;
992
1074
  }
993
1075
  if (allAccounts.isError || allAccounts.error) {
@@ -1000,13 +1082,13 @@ class ThyraProvider {
1000
1082
  try {
1001
1083
  thyraAccountsResponse = await (0, RequestHandler_1.deleteRequest)(`${exports.THYRA_ACCOUNTS_URL}/${accountToDelete.nickname}`);
1002
1084
  } catch (ex) {
1003
- console.error(`Thyra accounts deletion error`, ex);
1085
+ console.log(`Thyra accounts deletion error`, ex);
1004
1086
  return {
1005
1087
  response: AccountDeletion_1.EAccountDeletionResponse.ERROR
1006
1088
  };
1007
1089
  }
1008
1090
  if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
1009
- console.error(`Thyra accounts deletion error`, thyraAccountsResponse.error.message);
1091
+ console.log(`Thyra accounts deletion error`, thyraAccountsResponse.error.message);
1010
1092
  return {
1011
1093
  response: AccountDeletion_1.EAccountDeletionResponse.ERROR
1012
1094
  };
@@ -1021,7 +1103,19 @@ class ThyraProvider {
1021
1103
  * @returns a Promise that resolves to a list of node urls.
1022
1104
  */
1023
1105
  async getNodesUrls() {
1024
- throw new Error('Method not implemented.');
1106
+ let nodesResponse = null;
1107
+ try {
1108
+ nodesResponse = await (0, RequestHandler_1.getRequest)(`${exports.THYRA_URL}massa/node`);
1109
+ if (nodesResponse.isError || nodesResponse.error) {
1110
+ throw nodesResponse.error.message;
1111
+ }
1112
+ // transform nodesResponse.result to a json and then get the "url" property
1113
+ const nodes = nodesResponse.result;
1114
+ return Array(nodes.url);
1115
+ } catch (ex) {
1116
+ console.error(`Thyra nodes retrieval error`, ex);
1117
+ throw ex;
1118
+ }
1025
1119
  }
1026
1120
  /**
1027
1121
  * This method sends an http call to the Thyra server to create a new random account.
@@ -1029,12 +1123,26 @@ class ThyraProvider {
1029
1123
  * @returns a Promise that resolves to the details of the newly generated account.
1030
1124
  */
1031
1125
  async generateNewAccount(name) {
1032
- throw new Error('Method not implemented.');
1126
+ let thyraAccountsResponse = null;
1127
+ console.log(exports.THYRA_ACCOUNTS_URL + '/' + name);
1128
+ try {
1129
+ thyraAccountsResponse = await (0, RequestHandler_1.postRequest)(exports.THYRA_ACCOUNTS_URL + '/' + name, {});
1130
+ if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
1131
+ throw thyraAccountsResponse.error.message;
1132
+ }
1133
+ return {
1134
+ address: thyraAccountsResponse.result.address,
1135
+ name: thyraAccountsResponse.result.nickname
1136
+ };
1137
+ } catch (ex) {
1138
+ console.error(`Error while generating account: ${ex}`);
1139
+ throw ex;
1140
+ }
1033
1141
  }
1034
1142
  }
1035
1143
  exports.ThyraProvider = ThyraProvider;
1036
1144
 
1037
- },{"../provider/AccountDeletion":5,"./RequestHandler":9,"./ThyraAccount":10}],13:[function(require,module,exports){
1145
+ },{"../provider/AccountDeletion":5,"../provider/AccountImport":6,"./RequestHandler":9,"./ThyraAccount":10}],13:[function(require,module,exports){
1038
1146
  "use strict";
1039
1147
  /**
1040
1148
  * This file defines a TypeScript module with various time-related Typescript methods.
@@ -20,6 +20,7 @@ export declare function getRequest<T>(url: string): Promise<JsonRpcResponseData<
20
20
  *
21
21
  *
22
22
  * @param url - The url to call.
23
+ * @param body - The body of the request.
23
24
  * @returns a Promise that resolves to an instance of JsonRpcResponseData.
24
25
  *
25
26
  */
@@ -33,3 +34,13 @@ export declare function postRequest<T>(url: string, body: object): Promise<JsonR
33
34
  *
34
35
  */
35
36
  export declare function deleteRequest<T>(url: string): Promise<JsonRpcResponseData<T>>;
37
+ /**
38
+ * This method makes a PUT request to an http rest point.
39
+ *
40
+ *
41
+ * @param url - The url to call.
42
+ * @param body - The body of the request.
43
+ * @returns a Promise that resolves to an instance of JsonRpcResponseData.
44
+ *
45
+ */
46
+ export declare function putRequest<T>(url: string, body: object): Promise<JsonRpcResponseData<T>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteRequest = exports.postRequest = exports.getRequest = void 0;
3
+ exports.putRequest = exports.deleteRequest = exports.postRequest = exports.getRequest = void 0;
4
4
  /**
5
5
  * This file defines a TypeScript module with methods for performing GET, POST and DELETE http requests.
6
6
  *
@@ -51,6 +51,7 @@ exports.getRequest = getRequest;
51
51
  *
52
52
  *
53
53
  * @param url - The url to call.
54
+ * @param body - The body of the request.
54
55
  * @returns a Promise that resolves to an instance of JsonRpcResponseData.
55
56
  *
56
57
  */
@@ -100,4 +101,32 @@ async function deleteRequest(url) {
100
101
  };
101
102
  }
102
103
  exports.deleteRequest = deleteRequest;
104
+ /**
105
+ * This method makes a PUT request to an http rest point.
106
+ *
107
+ *
108
+ * @param url - The url to call.
109
+ * @param body - The body of the request.
110
+ * @returns a Promise that resolves to an instance of JsonRpcResponseData.
111
+ *
112
+ */
113
+ async function putRequest(url, body) {
114
+ let resp = null;
115
+ try {
116
+ resp = await axios_1.default.put(url, body, requestHeaders);
117
+ }
118
+ catch (ex) {
119
+ return {
120
+ isError: true,
121
+ result: null,
122
+ error: new Error('Axios error: ' + String(ex)),
123
+ };
124
+ }
125
+ return {
126
+ isError: false,
127
+ result: resp.data,
128
+ error: null,
129
+ };
130
+ }
131
+ exports.putRequest = putRequest;
103
132
  //# sourceMappingURL=RequestHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestHandler.js","sourceRoot":"","sources":["../../src/thyra/RequestHandler.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,iCAAkE;AAElE,MAAM,cAAc,GAAG;IACrB,MAAM,EACJ,kFAAkF;IACpF,6BAA6B,EAAE,GAAG;IAClC,kCAAkC,EAAE,IAAI;IACxC,8BAA8B,EAAE,mCAAmC;IACnE,cAAc,EAAE,kBAAkB;IAClC,8BAA8B,EAC5B,iDAAiD;CAC7B,CAAC;AAWzB;;;;;;;GAOG;AACI,KAAK,UAAU,UAAU,CAC9B,GAAW;IAEX,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI;QACF,IAAI,GAAG,MAAM,eAAK,CAAC,GAAG,CAAiC,GAAG,EAAE,cAAc,CAAC,CAAC;KAC7E;IAAC,OAAO,EAAE,EAAE;QACX,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;SACrB,CAAC;KAC7B;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI,CAAC,IAAS;QACtB,KAAK,EAAE,IAAI;KACc,CAAC;AAC9B,CAAC;AAnBD,gCAmBC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAY;IAEZ,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI;QACF,IAAI,GAAG,MAAM,eAAK,CAAC,IAAI,CACrB,GAAG,EACH,IAAI,EACJ,cAAc,CACf,CAAC;KACH;IAAC,OAAO,EAAE,EAAE;QACX,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;SACrB,CAAC;KAC7B;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI,CAAC,IAAS;QACtB,KAAK,EAAE,IAAI;KACc,CAAC;AAC9B,CAAC;AAxBD,kCAwBC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,aAAa,CACjC,GAAW;IAEX,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI;QACF,IAAI,GAAG,MAAM,eAAK,CAAC,MAAM,CACvB,GAAG,EACH,cAAc,CACf,CAAC;KACH;IAAC,OAAO,EAAE,EAAE;QACX,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;SACrB,CAAC;KAC7B;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI,CAAC,IAAS;QACtB,KAAK,EAAE,IAAI;KACc,CAAC;AAC9B,CAAC;AAtBD,sCAsBC"}
1
+ {"version":3,"file":"RequestHandler.js","sourceRoot":"","sources":["../../src/thyra/RequestHandler.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,iCAAkE;AAElE,MAAM,cAAc,GAAG;IACrB,MAAM,EACJ,kFAAkF;IACpF,6BAA6B,EAAE,GAAG;IAClC,kCAAkC,EAAE,IAAI;IACxC,8BAA8B,EAAE,mCA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AC,MAAM,CACvB,GAAG,EACH,cAAc,CACf,CAAC;KACH;IAAC,OAAO,EAAE,EAAE;QACX,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;SACrB,CAAC;KAC7B;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI,CAAC,IAAS;QACtB,KAAK,EAAE,IAAI;KACc,CAAC;AAC9B,CAAC;AAtBD,sCAsBC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,UAAU,CAC9B,GAAW,EACX,IAAY;IAEZ,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI;QACF,IAAI,GAAG,MAAM,eAAK,CAAC,GAAG,CACpB,GAAG,EACH,IAAI,EACJ,cAAc,CACf,CAAC;KACH;IAAC,OAAO,EAAE,EAAE;QACX,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;SACrB,CAAC;KAC7B;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI,CAAC,IAAS;QACtB,KAAK,EAAE,IAAI;KACc,CAAC;AAC9B,CAAC;AAxBD,gCAwBC"}
@@ -83,7 +83,7 @@ class ThyraAccount {
83
83
  async sign(data) {
84
84
  let signOpResponse = null;
85
85
  try {
86
- signOpResponse = await (0, RequestHandler_1.postRequest)(`${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/signOperation`, {
86
+ signOpResponse = await (0, RequestHandler_1.postRequest)(`${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/sign`, {
87
87
  operation: data,
88
88
  batch: false,
89
89
  });
@@ -104,8 +104,25 @@ class ThyraAccount {
104
104
  * @param fee - The fee to be paid for the transaction execution by the node.
105
105
  * @returns An ITransactionDetails object. It contains the operationId on the network.
106
106
  */
107
- buyRolls(amount, fee) {
108
- throw new Error('Method not implemented.');
107
+ async buyRolls(amount, fee) {
108
+ let buyRollsOpResponse = null;
109
+ const url = `${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/rolls`;
110
+ const body = {
111
+ fee: fee.toString(),
112
+ amount: amount.toString(),
113
+ side: 'buy',
114
+ };
115
+ try {
116
+ buyRollsOpResponse = await (0, RequestHandler_1.postRequest)(url, body);
117
+ }
118
+ catch (ex) {
119
+ console.error(`Thyra account: error while buying rolls: ${ex}`);
120
+ throw ex;
121
+ }
122
+ if (buyRollsOpResponse.isError || buyRollsOpResponse.error) {
123
+ throw buyRollsOpResponse.error;
124
+ }
125
+ return buyRollsOpResponse.result;
109
126
  }
110
127
  /**
111
128
  * This method aims to sell rolls on behalf of the sender.
@@ -114,8 +131,25 @@ class ThyraAccount {
114
131
  * @param fee - The fee to be paid for the transaction execution by the node.
115
132
  * @returns An ITransactionDetails object. It contains the operationId on the network.
116
133
  */
117
- sellRolls(amount, fee) {
118
- throw new Error('Method not implemented.');
134
+ async sellRolls(amount, fee) {
135
+ let sellRollsOpResponse = null;
136
+ const url = `${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/rolls`;
137
+ const body = {
138
+ fee: fee.toString(),
139
+ amount: amount.toString(),
140
+ side: 'sell',
141
+ };
142
+ try {
143
+ sellRollsOpResponse = await (0, RequestHandler_1.postRequest)(url, body);
144
+ }
145
+ catch (ex) {
146
+ console.error(`Thyra account: error while selling rolls: ${ex}`);
147
+ throw ex;
148
+ }
149
+ if (sellRollsOpResponse.isError || sellRollsOpResponse.error) {
150
+ throw sellRollsOpResponse.error;
151
+ }
152
+ return sellRollsOpResponse.result;
119
153
  }
120
154
  /**
121
155
  * This method aims to transfer MAS on behalf of the sender to a recipient.
@@ -1 +1 @@
1
- {"version":3,"file":"ThyraAccount.js","sourceRoot":"","sources":["../../src/thyra/ThyraA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AsB,GAAG,EAAE,IAAI,CAAC,CAAC;SACzE;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,EAAE,CAAC,CAAC;YACjE,MAAM,EAAE,CAAC;SACV;QACD,IAAI,mBAAmB,CAAC,OAAO,IAAI,mBAAmB,CAAC,KAAK,EAAE;YAC5D,MAAM,mBAAmB,CAAC,KAAK,CAAC;SACjC;QACD,OAAO,mBAAmB,CAAC,MAAM,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CACb,MAAc,EACd,gBAAwB,EACxB,GAAW;QAEX,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AA3KD,oCA2KC"}
@@ -6,11 +6,15 @@ import { IAccountDetails } from '../account';
6
6
  /**
7
7
  * The Thyra accounts url
8
8
  */
9
- export declare const THYRA_ACCOUNTS_URL = "https://my.massa/thyra/plugin/massalabs/wallet/rest/wallet";
9
+ export declare const THYRA_ACCOUNTS_URL = "https://my.massa/thyra/plugin/massalabs/wallet/api/accounts";
10
10
  /**
11
11
  * Thyra's url for importing accounts
12
12
  */
13
13
  export declare const THYRA_IMPORT_ACCOUNTS_URL: string;
14
+ /**
15
+ * MassaStation url
16
+ */
17
+ export declare const THYRA_URL = "https://my.massa/";
14
18
  /**
15
19
  * Thyra's wallet provider name
16
20
  */
@@ -57,12 +61,10 @@ export declare class ThyraProvider implements IProvider {
57
61
  /**
58
62
  * This method makes an http call to the Thyra server to import an account with the given publicKey and privateKey.
59
63
  *
60
- * @remarks This method in not yet implemented and depends on `massalabs/thyra-plugin-wallet#82` to be merged first
61
- *
62
64
  * @param publicKey - The public key of the account.
63
65
  * @param privateKey - The private key of the account.
64
- * @returns a Promise that resolves to an instance of IAccountImportResponse.
65
66
  *
67
+ * @returns a Promise that resolves to an instance of IAccountImportResponse.
66
68
  */
67
69
  importAccount(publicKey: string, privateKey: string): Promise<IAccountImportResponse>;
68
70
  /**
@@ -1,17 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ThyraProvider = exports.THYRA_PROVIDER_NAME = exports.THYRA_IMPORT_ACCOUNTS_URL = exports.THYRA_ACCOUNTS_URL = void 0;
3
+ exports.ThyraProvider = exports.THYRA_PROVIDER_NAME = exports.THYRA_URL = exports.THYRA_IMPORT_ACCOUNTS_URL = exports.THYRA_ACCOUNTS_URL = void 0;
4
4
  const AccountDeletion_1 = require("../provider/AccountDeletion");
5
+ const AccountImport_1 = require("../provider/AccountImport");
5
6
  const RequestHandler_1 = require("./RequestHandler");
6
7
  const ThyraAccount_1 = require("./ThyraAccount");
7
8
  /**
8
9
  * The Thyra accounts url
9
10
  */
10
- exports.THYRA_ACCOUNTS_URL = 'https://my.massa/thyra/plugin/massalabs/wallet/rest/wallet';
11
+ exports.THYRA_ACCOUNTS_URL = 'https://my.massa/thyra/plugin/massalabs/wallet/api/accounts';
11
12
  /**
12
13
  * Thyra's url for importing accounts
13
14
  */
14
15
  exports.THYRA_IMPORT_ACCOUNTS_URL = `${exports.THYRA_ACCOUNTS_URL}/import/`;
16
+ /**
17
+ * MassaStation url
18
+ */
19
+ exports.THYRA_URL = 'https://my.massa/';
15
20
  /**
16
21
  * Thyra's wallet provider name
17
22
  */
@@ -63,16 +68,31 @@ class ThyraProvider {
63
68
  /**
64
69
  * This method makes an http call to the Thyra server to import an account with the given publicKey and privateKey.
65
70
  *
66
- * @remarks This method in not yet implemented and depends on `massalabs/thyra-plugin-wallet#82` to be merged first
67
- *
68
71
  * @param publicKey - The public key of the account.
69
72
  * @param privateKey - The private key of the account.
70
- * @returns a Promise that resolves to an instance of IAccountImportResponse.
71
73
  *
74
+ * @returns a Promise that resolves to an instance of IAccountImportResponse.
72
75
  */
73
76
  async importAccount(publicKey, privateKey) {
74
- // TODO: once massalabs/thyra-plugin-wallet#82 is merged, to be updated here
75
- throw new Error(`Unimplemented method!`);
77
+ const accountImportRequest = {
78
+ publicKey,
79
+ privateKey,
80
+ };
81
+ let thyraAccountsResponse = null;
82
+ try {
83
+ thyraAccountsResponse = await (0, RequestHandler_1.putRequest)(exports.THYRA_ACCOUNTS_URL, accountImportRequest);
84
+ }
85
+ catch (ex) {
86
+ console.log(`Thyra accounts retrieval error: ${ex}`);
87
+ throw ex;
88
+ }
89
+ if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
90
+ throw thyraAccountsResponse.error.message;
91
+ }
92
+ return {
93
+ response: AccountImport_1.EAccountImportResponse.OK,
94
+ message: 'Account imported successfully',
95
+ };
76
96
  }
77
97
  /**
78
98
  * This method sends an http call to the Thyra server to delete the account associated with the given address.
@@ -87,7 +107,7 @@ class ThyraProvider {
87
107
  allAccounts = await (0, RequestHandler_1.getRequest)(exports.THYRA_ACCOUNTS_URL);
88
108
  }
89
109
  catch (ex) {
90
- console.error(`Thyra accounts retrieval error`);
110
+ console.log(`Thyra accounts retrieval error: ${ex}`);
91
111
  throw ex;
92
112
  }
93
113
  if (allAccounts.isError || allAccounts.error) {
@@ -101,13 +121,13 @@ class ThyraProvider {
101
121
  thyraAccountsResponse = await (0, RequestHandler_1.deleteRequest)(`${exports.THYRA_ACCOUNTS_URL}/${accountToDelete.nickname}`);
102
122
  }
103
123
  catch (ex) {
104
- console.error(`Thyra accounts deletion error`, ex);
124
+ console.log(`Thyra accounts deletion error`, ex);
105
125
  return {
106
126
  response: AccountDeletion_1.EAccountDeletionResponse.ERROR,
107
127
  };
108
128
  }
109
129
  if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
110
- console.error(`Thyra accounts deletion error`, thyraAccountsResponse.error.message);
130
+ console.log(`Thyra accounts deletion error`, thyraAccountsResponse.error.message);
111
131
  return {
112
132
  response: AccountDeletion_1.EAccountDeletionResponse.ERROR,
113
133
  };
@@ -122,7 +142,20 @@ class ThyraProvider {
122
142
  * @returns a Promise that resolves to a list of node urls.
123
143
  */
124
144
  async getNodesUrls() {
125
- throw new Error('Method not implemented.');
145
+ let nodesResponse = null;
146
+ try {
147
+ nodesResponse = await (0, RequestHandler_1.getRequest)(`${exports.THYRA_URL}massa/node`);
148
+ if (nodesResponse.isError || nodesResponse.error) {
149
+ throw nodesResponse.error.message;
150
+ }
151
+ // transform nodesResponse.result to a json and then get the "url" property
152
+ const nodes = nodesResponse.result;
153
+ return Array(nodes.url);
154
+ }
155
+ catch (ex) {
156
+ console.error(`Thyra nodes retrieval error`, ex);
157
+ throw ex;
158
+ }
126
159
  }
127
160
  /**
128
161
  * This method sends an http call to the Thyra server to create a new random account.
@@ -130,7 +163,22 @@ class ThyraProvider {
130
163
  * @returns a Promise that resolves to the details of the newly generated account.
131
164
  */
132
165
  async generateNewAccount(name) {
133
- throw new Error('Method not implemented.');
166
+ let thyraAccountsResponse = null;
167
+ console.log(exports.THYRA_ACCOUNTS_URL + '/' + name);
168
+ try {
169
+ thyraAccountsResponse = await (0, RequestHandler_1.postRequest)(exports.THYRA_ACCOUNTS_URL + '/' + name, {});
170
+ if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
171
+ throw thyraAccountsResponse.error.message;
172
+ }
173
+ return {
174
+ address: thyraAccountsResponse.result.address,
175
+ name: thyraAccountsResponse.result.nickname,
176
+ };
177
+ }
178
+ catch (ex) {
179
+ console.error(`Error while generating account: ${ex}`);
180
+ throw ex;
181
+ }
134
182
  }
135
183
  }
136
184
  exports.ThyraProvider = ThyraProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"ThyraProvider.js","sourceRoot":"","sources":["../../src/thyra/ThyraProvider.ts"],"names":[],"mappings":";;;AAAA,iEAIqC;AAMrC,qDAI0B;AAC1B,iDAA8C;AAI9C;;GAEG;AACU,QAAA,kBAAkB,GAC7B,4DAA4D,CAAC;AAE/D;;GAEG;AACU,QAAA,yBAAyB,GAAG,GAAG,0BAAkB,UAAU,CAAC;AAEzE;;GAEG;AACU,QAAA,mBAAmB,GAAG,OAAO,CAAC;AAgB3C;;;;GAIG;AACH,MAAa,aAAa;IAGxB;;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G,GAAG,GAAG,IAAI,EAC/B,EAAE,CACH,CAAC;YACF,IAAI,qBAAqB,CAAC,OAAO,IAAI,qBAAqB,CAAC,KAAK,EAAE;gBAChE,MAAM,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;aAC3C;YACD,OAAO;gBACL,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,OAAO;gBAC7C,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ;aACzB,CAAC;SACtB;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;YACvD,MAAM,EAAE,CAAC;SACV;IACH,CAAC;CACF;AApLD,sCAoLC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/wallet-provider",
3
- "version": "0.0.1-dev.20230522090628",
3
+ "version": "0.0.1-dev.20230525092413",
4
4
  "description": "massa's wallet provider",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",