@massalabs/wallet-provider 1.2.1-dev.20230801093549 → 1.2.1-dev.20230803141012

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.
Files changed (227) hide show
  1. package/bundle.js +5662 -5204
  2. package/bundle.min.js +3 -0
  3. package/dist/cmd/account/Account.d.ts +103 -0
  4. package/dist/cmd/account/Account.d.ts.map +1 -0
  5. package/dist/cmd/account/Account.js +179 -0
  6. package/dist/cmd/account/Account.js.map +1 -0
  7. package/dist/cmd/account/AccountBalance.d.ts +14 -0
  8. package/dist/cmd/account/AccountBalance.d.ts.map +1 -0
  9. package/dist/cmd/account/AccountBalance.js +3 -0
  10. package/dist/cmd/account/AccountBalance.js.map +1 -0
  11. package/dist/cmd/account/AccountSign.d.ts +16 -0
  12. package/dist/cmd/account/AccountSign.d.ts.map +1 -0
  13. package/dist/cmd/account/AccountSign.js +3 -0
  14. package/dist/cmd/account/AccountSign.js.map +1 -0
  15. package/dist/cmd/account/IAccount.d.ts +20 -0
  16. package/dist/cmd/account/IAccount.d.ts.map +1 -0
  17. package/dist/cmd/account/IAccount.js +3 -0
  18. package/dist/cmd/account/IAccount.js.map +1 -0
  19. package/dist/cmd/account/IAccountCallSCRequest.d.ts +25 -0
  20. package/dist/cmd/account/IAccountCallSCRequest.d.ts.map +1 -0
  21. package/dist/cmd/account/IAccountCallSCRequest.js +3 -0
  22. package/dist/cmd/account/IAccountCallSCRequest.js.map +1 -0
  23. package/dist/cmd/account/IAccountDetails.d.ts +8 -0
  24. package/dist/cmd/account/IAccountDetails.d.ts.map +1 -0
  25. package/dist/cmd/account/IAccountDetails.js +3 -0
  26. package/dist/cmd/account/IAccountDetails.js.map +1 -0
  27. package/dist/cmd/account/IAccountRolls.d.ts +8 -0
  28. package/dist/cmd/account/IAccountRolls.d.ts.map +1 -0
  29. package/dist/cmd/account/IAccountRolls.js +3 -0
  30. package/dist/cmd/account/IAccountRolls.js.map +1 -0
  31. package/dist/cmd/account/IAccountSendTransaction.d.ts +9 -0
  32. package/dist/cmd/account/IAccountSendTransaction.d.ts.map +1 -0
  33. package/dist/cmd/account/IAccountSendTransaction.js +3 -0
  34. package/dist/cmd/account/IAccountSendTransaction.js.map +1 -0
  35. package/dist/cmd/account/index.d.ts +9 -0
  36. package/dist/cmd/account/index.d.ts.map +1 -0
  37. package/dist/cmd/account/index.js +6 -0
  38. package/dist/cmd/account/index.js.map +1 -0
  39. package/dist/cmd/connector/Connector.d.ts +87 -0
  40. package/dist/cmd/connector/Connector.d.ts.map +1 -0
  41. package/dist/cmd/connector/Connector.js +173 -0
  42. package/dist/cmd/connector/Connector.js.map +1 -0
  43. package/dist/cmd/connector/ICustomEventMessageRequest.d.ts +10 -0
  44. package/dist/cmd/connector/ICustomEventMessageRequest.d.ts.map +1 -0
  45. package/dist/cmd/connector/ICustomEventMessageRequest.js +3 -0
  46. package/dist/cmd/connector/ICustomEventMessageRequest.js.map +1 -0
  47. package/dist/cmd/connector/ICustomEventMessageResponse.d.ts +11 -0
  48. package/dist/cmd/connector/ICustomEventMessageResponse.d.ts.map +1 -0
  49. package/dist/cmd/connector/ICustomEventMessageResponse.js +3 -0
  50. package/dist/cmd/connector/ICustomEventMessageResponse.js.map +1 -0
  51. package/dist/cmd/connector/IRegisterEvent.d.ts +8 -0
  52. package/dist/cmd/connector/IRegisterEvent.d.ts.map +1 -0
  53. package/dist/cmd/connector/IRegisterEvent.js +3 -0
  54. package/dist/cmd/connector/IRegisterEvent.js.map +1 -0
  55. package/dist/cmd/connector/index.d.ts +5 -0
  56. package/dist/cmd/connector/index.d.ts.map +1 -0
  57. package/dist/cmd/connector/index.js +7 -0
  58. package/dist/cmd/connector/index.js.map +1 -0
  59. package/dist/cmd/index.d.ts +48 -0
  60. package/dist/cmd/index.d.ts.map +1 -0
  61. package/dist/cmd/index.js +89 -0
  62. package/dist/cmd/index.js.map +1 -0
  63. package/dist/cmd/massaStation/MassaStationAccount.d.ts +103 -0
  64. package/dist/cmd/massaStation/MassaStationAccount.d.ts.map +1 -0
  65. package/dist/cmd/massaStation/MassaStationAccount.js +312 -0
  66. package/dist/cmd/massaStation/MassaStationAccount.js.map +1 -0
  67. package/dist/cmd/massaStation/MassaStationDiscovery.d.ts +57 -0
  68. package/dist/cmd/massaStation/MassaStationDiscovery.d.ts.map +1 -0
  69. package/dist/cmd/massaStation/MassaStationDiscovery.js +80 -0
  70. package/dist/cmd/massaStation/MassaStationDiscovery.js.map +1 -0
  71. package/dist/cmd/massaStation/MassaStationProvider.d.ts +91 -0
  72. package/dist/cmd/massaStation/MassaStationProvider.d.ts.map +1 -0
  73. package/dist/cmd/massaStation/MassaStationProvider.js +193 -0
  74. package/dist/cmd/massaStation/MassaStationProvider.js.map +1 -0
  75. package/dist/cmd/massaStation/RequestHandler.d.ts +47 -0
  76. package/dist/cmd/massaStation/RequestHandler.d.ts.map +1 -0
  77. package/dist/cmd/massaStation/RequestHandler.js +133 -0
  78. package/dist/cmd/massaStation/RequestHandler.js.map +1 -0
  79. package/dist/cmd/provider/AccountDeletion.d.ts +24 -0
  80. package/dist/cmd/provider/AccountDeletion.d.ts.map +1 -0
  81. package/dist/cmd/provider/AccountDeletion.js +14 -0
  82. package/dist/cmd/provider/AccountDeletion.js.map +1 -0
  83. package/dist/cmd/provider/AccountImport.d.ts +26 -0
  84. package/dist/cmd/provider/AccountImport.d.ts.map +1 -0
  85. package/dist/cmd/provider/AccountImport.js +14 -0
  86. package/dist/cmd/provider/AccountImport.js.map +1 -0
  87. package/dist/cmd/provider/AccoutGeneration.d.ts +8 -0
  88. package/dist/cmd/provider/AccoutGeneration.d.ts.map +1 -0
  89. package/dist/cmd/provider/AccoutGeneration.js +3 -0
  90. package/dist/cmd/provider/AccoutGeneration.js.map +1 -0
  91. package/dist/cmd/provider/IProvider.d.ts +16 -0
  92. package/dist/cmd/provider/IProvider.d.ts.map +1 -0
  93. package/dist/cmd/provider/IProvider.js +3 -0
  94. package/dist/cmd/provider/IProvider.js.map +1 -0
  95. package/dist/cmd/provider/Provider.d.ts +68 -0
  96. package/dist/cmd/provider/Provider.d.ts.map +1 -0
  97. package/dist/cmd/provider/Provider.js +126 -0
  98. package/dist/cmd/provider/Provider.js.map +1 -0
  99. package/dist/cmd/provider/index.d.ts +5 -0
  100. package/dist/cmd/provider/index.d.ts.map +1 -0
  101. package/dist/cmd/provider/index.js +10 -0
  102. package/dist/cmd/provider/index.js.map +1 -0
  103. package/dist/cmd/utils/argsToBase64.d.ts +16 -0
  104. package/dist/cmd/utils/argsToBase64.d.ts.map +1 -0
  105. package/dist/cmd/utils/argsToBase64.js +25 -0
  106. package/dist/cmd/utils/argsToBase64.js.map +1 -0
  107. package/dist/cmd/utils/time.d.ts +77 -0
  108. package/dist/cmd/utils/time.d.ts.map +1 -0
  109. package/dist/cmd/utils/time.js +120 -0
  110. package/dist/cmd/utils/time.js.map +1 -0
  111. package/dist/connector/Connector.d.ts +2 -0
  112. package/dist/connector/Connector.d.ts.map +1 -1
  113. package/dist/connector/Connector.js +13 -9
  114. package/dist/esm/account/Account.d.ts +103 -0
  115. package/dist/esm/account/Account.d.ts.map +1 -0
  116. package/dist/esm/account/Account.js +178 -0
  117. package/dist/esm/account/Account.js.map +1 -0
  118. package/dist/esm/account/AccountBalance.d.ts +14 -0
  119. package/dist/esm/account/AccountBalance.d.ts.map +1 -0
  120. package/dist/esm/account/AccountBalance.js +2 -0
  121. package/dist/esm/account/AccountBalance.js.map +1 -0
  122. package/dist/esm/account/AccountSign.d.ts +16 -0
  123. package/dist/esm/account/AccountSign.d.ts.map +1 -0
  124. package/dist/esm/account/AccountSign.js +2 -0
  125. package/dist/esm/account/AccountSign.js.map +1 -0
  126. package/dist/esm/account/IAccount.d.ts +20 -0
  127. package/dist/esm/account/IAccount.d.ts.map +1 -0
  128. package/dist/esm/account/IAccount.js +2 -0
  129. package/dist/esm/account/IAccount.js.map +1 -0
  130. package/dist/esm/account/IAccountCallSCRequest.d.ts +25 -0
  131. package/dist/esm/account/IAccountCallSCRequest.d.ts.map +1 -0
  132. package/dist/esm/account/IAccountCallSCRequest.js +2 -0
  133. package/dist/esm/account/IAccountCallSCRequest.js.map +1 -0
  134. package/dist/esm/account/IAccountDetails.d.ts +8 -0
  135. package/dist/esm/account/IAccountDetails.d.ts.map +1 -0
  136. package/dist/esm/account/IAccountDetails.js +2 -0
  137. package/dist/esm/account/IAccountDetails.js.map +1 -0
  138. package/dist/esm/account/IAccountRolls.d.ts +8 -0
  139. package/dist/esm/account/IAccountRolls.d.ts.map +1 -0
  140. package/dist/esm/account/IAccountRolls.js +2 -0
  141. package/dist/esm/account/IAccountRolls.js.map +1 -0
  142. package/dist/esm/account/IAccountSendTransaction.d.ts +9 -0
  143. package/dist/esm/account/IAccountSendTransaction.d.ts.map +1 -0
  144. package/dist/esm/account/IAccountSendTransaction.js +2 -0
  145. package/dist/esm/account/IAccountSendTransaction.js.map +1 -0
  146. package/dist/esm/account/index.d.ts +9 -0
  147. package/dist/esm/account/index.d.ts.map +1 -0
  148. package/dist/esm/account/index.js +2 -0
  149. package/dist/esm/account/index.js.map +1 -0
  150. package/dist/esm/connector/Connector.d.ts +87 -0
  151. package/dist/esm/connector/Connector.d.ts.map +1 -0
  152. package/dist/esm/connector/Connector.js +172 -0
  153. package/dist/esm/connector/Connector.js.map +1 -0
  154. package/dist/esm/connector/ICustomEventMessageRequest.d.ts +10 -0
  155. package/dist/esm/connector/ICustomEventMessageRequest.d.ts.map +1 -0
  156. package/dist/esm/connector/ICustomEventMessageRequest.js +2 -0
  157. package/dist/esm/connector/ICustomEventMessageRequest.js.map +1 -0
  158. package/dist/esm/connector/ICustomEventMessageResponse.d.ts +11 -0
  159. package/dist/esm/connector/ICustomEventMessageResponse.d.ts.map +1 -0
  160. package/dist/esm/connector/ICustomEventMessageResponse.js +2 -0
  161. package/dist/esm/connector/ICustomEventMessageResponse.js.map +1 -0
  162. package/dist/esm/connector/IRegisterEvent.d.ts +8 -0
  163. package/dist/esm/connector/IRegisterEvent.d.ts.map +1 -0
  164. package/dist/esm/connector/IRegisterEvent.js +2 -0
  165. package/dist/esm/connector/IRegisterEvent.js.map +1 -0
  166. package/dist/esm/connector/index.d.ts +5 -0
  167. package/dist/esm/connector/index.d.ts.map +1 -0
  168. package/dist/esm/connector/index.js +2 -0
  169. package/dist/esm/connector/index.js.map +1 -0
  170. package/dist/esm/index.d.ts +48 -0
  171. package/dist/esm/index.d.ts.map +1 -0
  172. package/dist/esm/index.js +79 -0
  173. package/dist/esm/index.js.map +1 -0
  174. package/dist/esm/massaStation/MassaStationAccount.d.ts +103 -0
  175. package/dist/esm/massaStation/MassaStationAccount.d.ts.map +1 -0
  176. package/dist/esm/massaStation/MassaStationAccount.js +311 -0
  177. package/dist/esm/massaStation/MassaStationAccount.js.map +1 -0
  178. package/dist/esm/massaStation/MassaStationDiscovery.d.ts +57 -0
  179. package/dist/esm/massaStation/MassaStationDiscovery.d.ts.map +1 -0
  180. package/dist/esm/massaStation/MassaStationDiscovery.js +76 -0
  181. package/dist/esm/massaStation/MassaStationDiscovery.js.map +1 -0
  182. package/dist/esm/massaStation/MassaStationProvider.d.ts +91 -0
  183. package/dist/esm/massaStation/MassaStationProvider.d.ts.map +1 -0
  184. package/dist/esm/massaStation/MassaStationProvider.js +190 -0
  185. package/dist/esm/massaStation/MassaStationProvider.js.map +1 -0
  186. package/dist/esm/massaStation/RequestHandler.d.ts +47 -0
  187. package/dist/esm/massaStation/RequestHandler.d.ts.map +1 -0
  188. package/dist/esm/massaStation/RequestHandler.js +126 -0
  189. package/dist/esm/massaStation/RequestHandler.js.map +1 -0
  190. package/dist/esm/provider/AccountDeletion.d.ts +24 -0
  191. package/dist/esm/provider/AccountDeletion.d.ts.map +1 -0
  192. package/dist/esm/provider/AccountDeletion.js +11 -0
  193. package/dist/esm/provider/AccountDeletion.js.map +1 -0
  194. package/dist/esm/provider/AccountImport.d.ts +26 -0
  195. package/dist/esm/provider/AccountImport.d.ts.map +1 -0
  196. package/dist/esm/provider/AccountImport.js +11 -0
  197. package/dist/esm/provider/AccountImport.js.map +1 -0
  198. package/dist/esm/provider/AccoutGeneration.d.ts +8 -0
  199. package/dist/esm/provider/AccoutGeneration.d.ts.map +1 -0
  200. package/dist/esm/provider/AccoutGeneration.js +2 -0
  201. package/dist/esm/provider/AccoutGeneration.js.map +1 -0
  202. package/dist/esm/provider/IProvider.d.ts +16 -0
  203. package/dist/esm/provider/IProvider.d.ts.map +1 -0
  204. package/dist/esm/provider/IProvider.js +2 -0
  205. package/dist/esm/provider/IProvider.js.map +1 -0
  206. package/dist/esm/provider/Provider.d.ts +68 -0
  207. package/dist/esm/provider/Provider.d.ts.map +1 -0
  208. package/dist/esm/provider/Provider.js +123 -0
  209. package/dist/esm/provider/Provider.js.map +1 -0
  210. package/dist/esm/provider/index.d.ts +5 -0
  211. package/dist/esm/provider/index.d.ts.map +1 -0
  212. package/dist/esm/provider/index.js +4 -0
  213. package/dist/esm/provider/index.js.map +1 -0
  214. package/dist/esm/utils/argsToBase64.d.ts +16 -0
  215. package/dist/esm/utils/argsToBase64.d.ts.map +1 -0
  216. package/dist/esm/utils/argsToBase64.js +20 -0
  217. package/dist/esm/utils/argsToBase64.js.map +1 -0
  218. package/dist/esm/utils/time.d.ts +77 -0
  219. package/dist/esm/utils/time.d.ts.map +1 -0
  220. package/dist/esm/utils/time.js +119 -0
  221. package/dist/esm/utils/time.js.map +1 -0
  222. package/dist/index.d.ts.map +1 -1
  223. package/dist/index.js +1 -0
  224. package/dist/massaStation/MassaStationDiscovery.d.ts +2 -16
  225. package/dist/massaStation/MassaStationDiscovery.d.ts.map +1 -1
  226. package/dist/massaStation/MassaStationDiscovery.js +4 -30
  227. package/package.json +11 -8
@@ -42,6 +42,8 @@ class Connector {
42
42
  constructor() {
43
43
  this.registeredProviders = {};
44
44
  this.pendingRequests = new Map();
45
+ this.massaStationListener = new MassaStationDiscovery_1.MassaStationDiscovery();
46
+ this.initMassaStationListener();
45
47
  this.register();
46
48
  // start listening to messages from content script
47
49
  document
@@ -77,16 +79,18 @@ class Connector {
77
79
  this.registeredProviders[payload.providerName] =
78
80
  providerEventTargetName;
79
81
  });
82
+ }
83
+ initMassaStationListener() {
84
+ this.massaStationListener.on(MassaStationDiscovery_1.ON_MASSA_STATION_DISCOVERED, () => {
85
+ this.registeredProviders[MassaStationProvider_1.MASSA_STATION_PROVIDER_NAME] = `${exports.MASSA_WINDOW_OBJECT}_${MassaStationProvider_1.MASSA_STATION_PROVIDER_NAME}`;
86
+ });
87
+ this.massaStationListener.on(MassaStationDiscovery_1.ON_MASSA_STATION_DISCONNECTED, () => {
88
+ delete this.registeredProviders[MassaStationProvider_1.MASSA_STATION_PROVIDER_NAME];
89
+ });
90
+ }
91
+ async startMassaStationDiscovery() {
80
92
  try {
81
- // start MassaStation discovery
82
- this.massaStationListener = new MassaStationDiscovery_1.MassaStationDiscovery(1000);
83
- this.massaStationListener.startListening();
84
- this.massaStationListener.on(MassaStationDiscovery_1.ON_MASSA_STATION_DISCOVERED, () => {
85
- this.registeredProviders[MassaStationProvider_1.MASSA_STATION_PROVIDER_NAME] = `${exports.MASSA_WINDOW_OBJECT}_${MassaStationProvider_1.MASSA_STATION_PROVIDER_NAME}`;
86
- });
87
- this.massaStationListener.on(MassaStationDiscovery_1.ON_MASSA_STATION_DISCONNECTED, () => {
88
- delete this.registeredProviders[MassaStationProvider_1.MASSA_STATION_PROVIDER_NAME];
89
- });
93
+ await this.massaStationListener.startListening();
90
94
  }
91
95
  catch (e) {
92
96
  console.log('MassaStation is not detected');
@@ -0,0 +1,103 @@
1
+ import { IAccountBalanceResponse } from './AccountBalance';
2
+ import { IAccountSignResponse } from './AccountSign';
3
+ import { IAccountDetails } from './IAccountDetails';
4
+ import { ITransactionDetails } from '..';
5
+ import { IAccount } from './IAccount';
6
+ import { Args, IContractReadOperationResponse } from '@massalabs/web3-utils';
7
+ /**
8
+ * This module contains the Account class. It is responsible for representing an account in the wallet.
9
+ *
10
+ * @remarks
11
+ * This class provides methods to interact with the account's {@link balance} and to {@link sign} messages.
12
+ *
13
+ */
14
+ export declare class Account implements IAccount {
15
+ private _providerName;
16
+ private _address;
17
+ private _name;
18
+ /**
19
+ * This constructor takes an object of type IAccountDetails and a providerName string as its arguments.
20
+ *
21
+ * @param address - The address of the account.
22
+ * @param name - The name of the account.
23
+ * @param providerName - The name of the provider.
24
+ * @returns An instance of the Account class.
25
+ *
26
+ * @remarks
27
+ * - The Account constructor takes an object of type IAccountDetails and a providerName string as its arguments.
28
+ * - The IAccountDetails object contains the account's address and name.
29
+ * - The providerName string identifies the provider that is used to interact with the blockchain.
30
+ */
31
+ constructor({ address, name }: IAccountDetails, providerName: string);
32
+ /**
33
+ * @returns The address of the account.
34
+ */
35
+ address(): string;
36
+ /**
37
+ * @returns The name of the account.
38
+ */
39
+ name(): string;
40
+ /**
41
+ * @returns The name of the provider.
42
+ */
43
+ providerName(): string;
44
+ /**
45
+ * This method aims to retrieve the account's balance.
46
+ *
47
+ * @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.
48
+ */
49
+ balance(): Promise<IAccountBalanceResponse>;
50
+ /**
51
+ * This method aims to sign a message.
52
+ *
53
+ * @param data - The message to be signed.
54
+ * @returns An IAccountSignResponse object. It contains the signature of the message.
55
+ */
56
+ sign(data: Uint8Array): Promise<IAccountSignResponse>;
57
+ /**
58
+ * This method aims to buy rolls on behalf of the sender.
59
+ *
60
+ * @param amount - The amount of rolls to be purchased
61
+ * @param fee - The fee to be paid for the transaction execution by the node..
62
+ * @returns An ITransactionDetails object. It contains the operationId on the network.
63
+ */
64
+ buyRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
65
+ /**
66
+ * This method aims to sell rolls on behalf of the sender.
67
+ *
68
+ * @param amount - The amount of rolls to be sold.
69
+ * @param fee - The fee to be paid for the transaction execution by the node..
70
+ * @returns An ITransactionDetails object. It contains the operationId on the network.
71
+ */
72
+ sellRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
73
+ /**
74
+ * This method aims to transfer MAS on behalf of the sender to a recipient.
75
+ *
76
+ * @param amount - The amount of MAS (in the smallest unit) to be transferred.
77
+ * @param fee - The fee to be paid for the transaction execution (in the smallest unit).
78
+ * @returns An ITransactionDetails object. It contains the operationId on the network.
79
+ */
80
+ sendTransaction(amount: bigint, recipientAddress: string, fee: bigint): Promise<ITransactionDetails>;
81
+ /**
82
+ * This method aims to interact with a smart contract deployed on the MASSA blockchain.
83
+ *
84
+ * @remarks
85
+ * If dryRun.dryRun is true, the method will dry run the smart contract call and return an
86
+ * IContractReadOperationResponse object which contains all the information about the dry run
87
+ * (state changes, gas used, etc.)
88
+ *
89
+ * @param contractAddress - The address of the smart contract.
90
+ * @param functionName - The name of the function to be called.
91
+ * @param parameter - The parameters as an Args object to be passed to the function.
92
+ * @param amount - The amount of MASSA coins to be sent to the contract (in the smallest unit).
93
+ * @param fee - The fee to be paid for the transaction execution (in the smallest unit).
94
+ * @param maxGas - The maximum amount of gas to be used for the transaction execution.
95
+ * @param nonPersistentExecution - The dryRun object to be passed to the function.
96
+ *
97
+ * @returns if 'nonPersistentExecution' is true, it returns an IContractReadOperationResponse object.
98
+ * Otherwise, it returns an ITransactionDetails object which contains the operationId on the network.
99
+ *
100
+ */
101
+ callSC(contractAddress: string, functionName: string, parameter: Uint8Array | Args, amount: bigint, fee: bigint, maxGas: bigint, nonPersistentExecution?: boolean): Promise<ITransactionDetails | IContractReadOperationResponse>;
102
+ }
103
+ //# sourceMappingURL=Account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../../src/account/Account.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAqB,mBAAmB,EAAE,MAAM,IAAI,CAAC;AAC5D,OAAO,E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0BjE"}
@@ -0,0 +1,178 @@
1
+ import { connector } from '../connector/Connector';
2
+ import { AvailableCommands } from '..';
3
+ /**
4
+ * This module contains the Account class. It is responsible for representing an account in the wallet.
5
+ *
6
+ * @remarks
7
+ * This class provides methods to interact with the account's {@link balance} and to {@link sign} messages.
8
+ *
9
+ */
10
+ export class Account {
11
+ _providerName;
12
+ _address;
13
+ _name;
14
+ /**
15
+ * This constructor takes an object of type IAccountDetails and a providerName string as its arguments.
16
+ *
17
+ * @param address - The address of the account.
18
+ * @param name - The name of the account.
19
+ * @param providerName - The name of the provider.
20
+ * @returns An instance of the Account class.
21
+ *
22
+ * @remarks
23
+ * - The Account constructor takes an object of type IAccountDetails and a providerName string as its arguments.
24
+ * - The IAccountDetails object contains the account's address and name.
25
+ * - The providerName string identifies the provider that is used to interact with the blockchain.
26
+ */
27
+ constructor({ address, name }, providerName) {
28
+ this._address = address;
29
+ this._name = name ?? '';
30
+ this._providerName = providerName;
31
+ }
32
+ /**
33
+ * @returns The address of the account.
34
+ */
35
+ address() {
36
+ return this._address;
37
+ }
38
+ /**
39
+ * @returns The name of the account.
40
+ */
41
+ name() {
42
+ return this._name;
43
+ }
44
+ /**
45
+ * @returns The name of the provider.
46
+ */
47
+ providerName() {
48
+ return this._providerName;
49
+ }
50
+ /**
51
+ * This method aims to retrieve the account's balance.
52
+ *
53
+ * @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.
54
+ */
55
+ async balance() {
56
+ return new Promise((resolve, reject) => {
57
+ connector.sendMessageToContentScript(this._providerName, AvailableCommands.AccountBalance, { address: this._address }, (result, err) => {
58
+ if (err)
59
+ return reject(err);
60
+ return resolve(result);
61
+ });
62
+ });
63
+ }
64
+ /**
65
+ * This method aims to sign a message.
66
+ *
67
+ * @param data - The message to be signed.
68
+ * @returns An IAccountSignResponse object. It contains the signature of the message.
69
+ */
70
+ async sign(data) {
71
+ return new Promise((resolve, reject) => {
72
+ connector.sendMessageToContentScript(this._providerName, AvailableCommands.AccountSign, { address: this._address, data }, (result, err) => {
73
+ if (err)
74
+ return reject(err);
75
+ return resolve(result);
76
+ });
77
+ });
78
+ }
79
+ /**
80
+ * This method aims to buy rolls on behalf of the sender.
81
+ *
82
+ * @param amount - The amount of rolls to be purchased
83
+ * @param fee - The fee to be paid for the transaction execution by the node..
84
+ * @returns An ITransactionDetails object. It contains the operationId on the network.
85
+ */
86
+ async buyRolls(amount, fee) {
87
+ return new Promise((resolve, reject) => {
88
+ connector.sendMessageToContentScript(this._providerName, AvailableCommands.AccountBuyRolls, {
89
+ amount: amount.toString(),
90
+ fee: fee.toString(),
91
+ }, (result, err) => {
92
+ if (err)
93
+ return reject(err);
94
+ return resolve(result);
95
+ });
96
+ });
97
+ }
98
+ /**
99
+ * This method aims to sell rolls on behalf of the sender.
100
+ *
101
+ * @param amount - The amount of rolls to be sold.
102
+ * @param fee - The fee to be paid for the transaction execution by the node..
103
+ * @returns An ITransactionDetails object. It contains the operationId on the network.
104
+ */
105
+ async sellRolls(amount, fee) {
106
+ return new Promise((resolve, reject) => {
107
+ connector.sendMessageToContentScript(this._providerName, AvailableCommands.AccountSellRolls, {
108
+ amount: amount.toString(),
109
+ fee: fee.toString(),
110
+ }, (result, err) => {
111
+ if (err)
112
+ return reject(err);
113
+ return resolve(result);
114
+ });
115
+ });
116
+ }
117
+ /**
118
+ * This method aims to transfer MAS on behalf of the sender to a recipient.
119
+ *
120
+ * @param amount - The amount of MAS (in the smallest unit) to be transferred.
121
+ * @param fee - The fee to be paid for the transaction execution (in the smallest unit).
122
+ * @returns An ITransactionDetails object. It contains the operationId on the network.
123
+ */
124
+ async sendTransaction(amount, recipientAddress, fee) {
125
+ return new Promise((resolve, reject) => {
126
+ connector.sendMessageToContentScript(this._providerName, AvailableCommands.AccountSendTransaction, {
127
+ amount: amount.toString(),
128
+ recipientAddress,
129
+ fee: fee.toString(),
130
+ }, (result, err) => {
131
+ if (err)
132
+ return reject(err);
133
+ return resolve(result);
134
+ });
135
+ });
136
+ }
137
+ /**
138
+ * This method aims to interact with a smart contract deployed on the MASSA blockchain.
139
+ *
140
+ * @remarks
141
+ * If dryRun.dryRun is true, the method will dry run the smart contract call and return an
142
+ * IContractReadOperationResponse object which contains all the information about the dry run
143
+ * (state changes, gas used, etc.)
144
+ *
145
+ * @param contractAddress - The address of the smart contract.
146
+ * @param functionName - The name of the function to be called.
147
+ * @param parameter - The parameters as an Args object to be passed to the function.
148
+ * @param amount - The amount of MASSA coins to be sent to the contract (in the smallest unit).
149
+ * @param fee - The fee to be paid for the transaction execution (in the smallest unit).
150
+ * @param maxGas - The maximum amount of gas to be used for the transaction execution.
151
+ * @param nonPersistentExecution - The dryRun object to be passed to the function.
152
+ *
153
+ * @returns if 'nonPersistentExecution' is true, it returns an IContractReadOperationResponse object.
154
+ * Otherwise, it returns an ITransactionDetails object which contains the operationId on the network.
155
+ *
156
+ */
157
+ async callSC(contractAddress, functionName, parameter, amount, fee, maxGas, nonPersistentExecution = false) {
158
+ return new Promise((resolve, reject) => {
159
+ connector.sendMessageToContentScript(this._providerName, AvailableCommands.AccountCallSC, {
160
+ nickname: this._name,
161
+ name: functionName,
162
+ at: contractAddress,
163
+ args: parameter,
164
+ coins: amount,
165
+ fee: fee,
166
+ maxGas: maxGas,
167
+ nonPersistentExecution: nonPersistentExecution,
168
+ }, (result, err) => {
169
+ if (err)
170
+ return reject(err);
171
+ return resolve(nonPersistentExecution
172
+ ? result
173
+ : result);
174
+ });
175
+ });
176
+ }
177
+ }
178
+ //# sourceMappingURL=Account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Account.js","sourceRoot":"","sources":["../../../src/account/Account.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAuB,MAAM,IAAI,CAAC;AAO5D;;;;;;GAMG;AACH,MAAM,OAAO,OAAO;IACV,aAAa,CAAS;IACtB,QAAQ,CAAS;IACjB,KAAK,CAAS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J,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {\n IAccountBalanceRequest,\n IAccountBalanceResponse,\n} from './AccountBalance';\nimport { IAccountSignRequest, IAccountSignResponse } from './AccountSign';\nimport { connector } from '../connector/Connector';\nimport { IAccountDetails } from './IAccountDetails';\nimport { AvailableCommands, ITransactionDetails } from '..';\nimport { IAccount } from './IAccount';\nimport { IAccountRollsRequest } from './IAccountRolls';\nimport { IAccountSendTransactionRequest } from './IAccountSendTransaction';\nimport { IAccountCallSCRequest } from './IAccountCallSCRequest';\nimport { Args, IContractReadOperationResponse } from '@massalabs/web3-utils';\n\n/**\n * This module contains the Account class. It is responsible for representing an account in the wallet.\n *\n * @remarks\n * This class provides methods to interact with the account's {@link balance} and to {@link sign} messages.\n *\n */\nexport class Account implements IAccount {\n private _providerName: string;\n private _address: string;\n private _name: string;\n\n /**\n * This constructor takes an object of type IAccountDetails and a providerName string as its arguments.\n *\n * @param address - The address of the account.\n * @param name - The name of the account.\n * @param providerName - The name of the provider.\n * @returns An instance of the Account class.\n *\n * @remarks\n * - The Account constructor takes an object of type IAccountDetails and a providerName string as its arguments.\n * - The IAccountDetails object contains the account's address and name.\n * - The providerName string identifies the provider that is used to interact with the blockchain.\n */\n public constructor({ address, name }: IAccountDetails, providerName: string) {\n this._address = address;\n this._name = name ?? '';\n this._providerName = providerName;\n }\n\n /**\n * @returns The address of the account.\n */\n public address(): string {\n return this._address;\n }\n\n /**\n * @returns The name of the account.\n */\n public name(): string {\n return this._name;\n }\n\n /**\n * @returns The name of the provider.\n */\n public providerName(): string {\n return this._providerName;\n }\n\n /**\n * This method aims to retrieve the account's balance.\n *\n * @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.\n */\n public async balance(): Promise<IAccountBalanceResponse> {\n return new Promise<IAccountBalanceResponse>((resolve, reject) => {\n connector.sendMessageToContentScript(\n this._providerName,\n AvailableCommands.AccountBalance,\n { address: this._address } as IAccountBalanceRequest,\n (result, err) => {\n if (err) return reject(err);\n return resolve(result as IAccountBalanceResponse);\n },\n );\n });\n }\n\n /**\n * This method aims to sign a message.\n *\n * @param data - The message to be signed.\n * @returns An IAccountSignResponse object. It contains the signature of the message.\n */\n public async sign(data: Uint8Array): Promise<IAccountSignResponse> {\n return new Promise<IAccountSignResponse>((resolve, reject) => {\n connector.sendMessageToContentScript(\n this._providerName,\n AvailableCommands.AccountSign,\n { address: this._address, data } as IAccountSignRequest,\n (result, err) => {\n if (err) return reject(err);\n return resolve(result as IAccountSignResponse);\n },\n );\n });\n }\n\n /**\n * This method aims to buy rolls on behalf of the sender.\n *\n * @param amount - The amount of rolls to be purchased\n * @param fee - The fee to be paid for the transaction execution by the node..\n * @returns An ITransactionDetails object. It contains the operationId on the network.\n */\n public async buyRolls(\n amount: bigint,\n fee: bigint,\n ): Promise<ITransactionDetails> {\n return new Promise<ITransactionDetails>((resolve, reject) => {\n connector.sendMessageToContentScript(\n this._providerName,\n AvailableCommands.AccountBuyRolls,\n {\n amount: amount.toString(),\n fee: fee.toString(),\n } as IAccountRollsRequest,\n (result, err) => {\n if (err) return reject(err);\n return resolve(result as ITransactionDetails);\n },\n );\n });\n }\n\n /**\n * This method aims to sell rolls on behalf of the sender.\n *\n * @param amount - The amount of rolls to be sold.\n * @param fee - The fee to be paid for the transaction execution by the node..\n * @returns An ITransactionDetails object. It contains the operationId on the network.\n */\n public async sellRolls(\n amount: bigint,\n fee: bigint,\n ): Promise<ITransactionDetails> {\n return new Promise<ITransactionDetails>((resolve, reject) => {\n connector.sendMessageToContentScript(\n this._providerName,\n AvailableCommands.AccountSellRolls,\n {\n amount: amount.toString(),\n fee: fee.toString(),\n } as IAccountRollsRequest,\n (result, err) => {\n if (err) return reject(err);\n return resolve(result as ITransactionDetails);\n },\n );\n });\n }\n\n /**\n * This method aims to transfer MAS on behalf of the sender to a recipient.\n *\n * @param amount - The amount of MAS (in the smallest unit) to be transferred.\n * @param fee - The fee to be paid for the transaction execution (in the smallest unit).\n * @returns An ITransactionDetails object. It contains the operationId on the network.\n */\n public async sendTransaction(\n amount: bigint,\n recipientAddress: string,\n fee: bigint,\n ): Promise<ITransactionDetails> {\n return new Promise<ITransactionDetails>((resolve, reject) => {\n connector.sendMessageToContentScript(\n this._providerName,\n AvailableCommands.AccountSendTransaction,\n {\n amount: amount.toString(),\n recipientAddress,\n fee: fee.toString(),\n } as IAccountSendTransactionRequest,\n (result, err) => {\n if (err) return reject(err);\n return resolve(result as ITransactionDetails);\n },\n );\n });\n }\n\n /**\n * This method aims to interact with a smart contract deployed on the MASSA blockchain.\n *\n * @remarks\n * If dryRun.dryRun is true, the method will dry run the smart contract call and return an\n * IContractReadOperationResponse object which contains all the information about the dry run\n * (state changes, gas used, etc.)\n *\n * @param contractAddress - The address of the smart contract.\n * @param functionName - The name of the function to be called.\n * @param parameter - The parameters as an Args object to be passed to the function.\n * @param amount - The amount of MASSA coins to be sent to the contract (in the smallest unit).\n * @param fee - The fee to be paid for the transaction execution (in the smallest unit).\n * @param maxGas - The maximum amount of gas to be used for the transaction execution.\n * @param nonPersistentExecution - The dryRun object to be passed to the function.\n *\n * @returns if 'nonPersistentExecution' is true, it returns an IContractReadOperationResponse object.\n * Otherwise, it returns an ITransactionDetails object which contains the operationId on the network.\n *\n */\n public async callSC(\n contractAddress: string,\n functionName: string,\n parameter: Uint8Array | Args,\n amount: bigint,\n fee: bigint,\n maxGas: bigint,\n nonPersistentExecution = false,\n ): Promise<ITransactionDetails | IContractReadOperationResponse> {\n return new Promise((resolve, reject) => {\n connector.sendMessageToContentScript(\n this._providerName,\n AvailableCommands.AccountCallSC,\n {\n nickname: this._name,\n name: functionName,\n at: contractAddress,\n args: parameter,\n coins: amount,\n fee: fee,\n maxGas: maxGas,\n nonPersistentExecution: nonPersistentExecution,\n } as IAccountCallSCRequest,\n (result, err) => {\n if (err) return reject(err);\n return resolve(\n nonPersistentExecution\n ? (result as IContractReadOperationResponse)\n : (result as ITransactionDetails),\n );\n },\n );\n });\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This interface represents the request object of the AccountBalance command.
3
+ */
4
+ export interface IAccountBalanceRequest {
5
+ address: string;
6
+ }
7
+ /**
8
+ * This interface represents the response object of the AccountBalance command sent by the content script.
9
+ */
10
+ export interface IAccountBalanceResponse {
11
+ finalBalance: string;
12
+ candidateBalance: string;
13
+ }
14
+ //# sourceMappingURL=AccountBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountBalance.d.ts","sourceRoot":"","sources":["../../../src/account/AccountBalance.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AccountBalance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountBalance.js","sourceRoot":"","sources":["../../../src/account/AccountBalance.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * This interface represents the request object of the AccountBalance command.\n */\nexport interface IAccountBalanceRequest {\n address: string;\n}\n\n/**\n * This interface represents the response object of the AccountBalance command sent by the content script.\n */\nexport interface IAccountBalanceResponse {\n finalBalance: string;\n candidateBalance: string;\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This interface represents the request object for the signing operation sent to the content script.
3
+ */
4
+ export interface IAccountSignRequest {
5
+ address: string;
6
+ data: Uint8Array;
7
+ }
8
+ /**
9
+ * This interface represents the response object containing the signed message data, which is sent by the content script
10
+ * after the signing operation.
11
+ */
12
+ export interface IAccountSignResponse {
13
+ publicKey: string;
14
+ signature: Uint8Array;
15
+ }
16
+ //# sourceMappingURL=AccountSign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountSign.d.ts","sourceRoot":"","sources":["../../../src/account/AccountSign.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AccountSign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountSign.js","sourceRoot":"","sources":["../../../src/account/AccountSign.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * This interface represents the request object for the signing operation sent to the content script.\n */\nexport interface IAccountSignRequest {\n address: string;\n data: Uint8Array;\n}\n\n/**\n * This interface represents the response object containing the signed message data, which is sent by the content script\n * after the signing operation.\n */\nexport interface IAccountSignResponse {\n publicKey: string;\n signature: Uint8Array;\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { ITransactionDetails } from '..';
2
+ import { IAccountBalanceResponse } from './AccountBalance';
3
+ import { IAccountSignResponse } from './AccountSign';
4
+ import { Args } from '@massalabs/web3-utils';
5
+ /**
6
+ * This interface represents an Account object.
7
+ *
8
+ */
9
+ export interface IAccount {
10
+ address(): string;
11
+ name(): string;
12
+ providerName(): string;
13
+ balance(): Promise<IAccountBalanceResponse>;
14
+ sign(data: Uint8Array | string): Promise<IAccountSignResponse>;
15
+ buyRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
16
+ sellRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
17
+ sendTransaction(amount: bigint, recipientAddress: string, fee: bigint): Promise<ITransactionDetails>;
18
+ callSC(contractAddress: string, functionName: string, parameter: Uint8Array | Args, amount: bigint, fee: bigint, maxGas: bigint, nonPersistentExecution?: boolean): any;
19
+ }
20
+ //# sourceMappingURL=IAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccount.d.ts","sourceRoot":"","sources":["../../../src/account/IAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,IAAI,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,IAAI,MAAM,CAAC;IAClB,IAAI,IAAI,MAAM,CAAC;IACf,YAAY,IAAI,MAAM,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACpE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrE,eAAe,CACb,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EACxB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,MAAM,CACJ,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,UAAU,GAAG,IAAI,EAC5B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,sBAAsB,CAAC,EAAE,OAAO,OAChC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccount.js","sourceRoot":"","sources":["../../../src/account/IAccount.ts"],"names":[],"mappings":"","sourcesContent":["import { ITransactionDetails } from '..';\nimport { IAccountBalanceResponse } from './AccountBalance';\nimport { IAccountSignResponse } from './AccountSign';\nimport { Args } from '@massalabs/web3-utils';\n\n/**\n * This interface represents an Account object.\n *\n */\nexport interface IAccount {\n address(): string;\n name(): string;\n providerName(): string;\n balance(): Promise<IAccountBalanceResponse>;\n sign(data: Uint8Array | string): Promise<IAccountSignResponse>;\n buyRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;\n sellRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;\n sendTransaction(\n amount: bigint,\n recipientAddress: string,\n fee: bigint,\n ): Promise<ITransactionDetails>;\n callSC(\n contractAddress: string,\n functionName: string,\n parameter: Uint8Array | Args,\n amount: bigint,\n fee: bigint,\n maxGas: bigint,\n nonPersistentExecution?: boolean,\n );\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import { Args } from '@massalabs/web3-utils';
2
+ /**
3
+ * This interface represents the request object to send to the content script to
4
+ * interact with a deployed smart contract.
5
+ *
6
+ * @remarks
7
+ * - If your smart contract function does not require any parameters, you can pass an empty array.
8
+ *
9
+ * @see nickname - The nickname of the account to use.
10
+ * @see name - The name of the function to be called.
11
+ * @see at - The address of the smart contract.
12
+ * @see args - The parameters as an Args object to be passed to the function.
13
+ * @see coins - The amount of MASSA coins to be sent to the block creator.
14
+ * @see dryRun - The parameters for the dry run.
15
+ */
16
+ export interface IAccountCallSCRequest {
17
+ nickname: string;
18
+ name: string;
19
+ at: string;
20
+ args: Args;
21
+ coins: bigint;
22
+ fee: bigint;
23
+ nonPersistentExecution: boolean;
24
+ }
25
+ //# sourceMappingURL=IAccountCallSCRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountCallSCRequest.d.ts","sourceRoot":"","sources":["../../../src/account/IAccountCallSCRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB,EAAE,OAAO,CAAC;CACjC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAccountCallSCRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountCallSCRequest.js","sourceRoot":"","sources":["../../../src/account/IAccountCallSCRequest.ts"],"names":[],"mappings":"","sourcesContent":["import { Args } from '@massalabs/web3-utils';\n\n/**\n * This interface represents the request object to send to the content script to\n * interact with a deployed smart contract.\n *\n * @remarks\n * - If your smart contract function does not require any parameters, you can pass an empty array.\n *\n * @see nickname - The nickname of the account to use.\n * @see name - The name of the function to be called.\n * @see at - The address of the smart contract.\n * @see args - The parameters as an Args object to be passed to the function.\n * @see coins - The amount of MASSA coins to be sent to the block creator.\n * @see dryRun - The parameters for the dry run.\n */\nexport interface IAccountCallSCRequest {\n nickname: string;\n name: string;\n at: string;\n args: Args;\n coins: bigint;\n fee: bigint;\n nonPersistentExecution: boolean;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This interface represents the account details such as name and address.
3
+ */
4
+ export interface IAccountDetails {
5
+ name?: string;
6
+ address: string;
7
+ }
8
+ //# sourceMappingURL=IAccountDetails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountDetails.d.ts","sourceRoot":"","sources":["../../../src/account/IAccountDetails.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAccountDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountDetails.js","sourceRoot":"","sources":["../../../src/account/IAccountDetails.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * This interface represents the account details such as name and address.\n */\nexport interface IAccountDetails {\n name?: string;\n address: string;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This interface represents the request object for roll operations (buy & sell) sent to the content script.
3
+ */
4
+ export interface IAccountRollsRequest {
5
+ amount: string;
6
+ fee: string;
7
+ }
8
+ //# sourceMappingURL=IAccountRolls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountRolls.d.ts","sourceRoot":"","sources":["../../../src/account/IAccountRolls.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAccountRolls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountRolls.js","sourceRoot":"","sources":["../../../src/account/IAccountRolls.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * This interface represents the request object for roll operations (buy & sell) sent to the content script.\n */\nexport interface IAccountRollsRequest {\n amount: string;\n fee: string;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This interface represents the request object for roll operations (buy & sell) sent to the content script.
3
+ */
4
+ export interface IAccountSendTransactionRequest {
5
+ recipientAddress: string;
6
+ amount: string;
7
+ fee: string;
8
+ }
9
+ //# sourceMappingURL=IAccountSendTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountSendTransaction.d.ts","sourceRoot":"","sources":["../../../src/account/IAccountSendTransaction.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAccountSendTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAccountSendTransaction.js","sourceRoot":"","sources":["../../../src/account/IAccountSendTransaction.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * This interface represents the request object for roll operations (buy & sell) sent to the content script.\n */\nexport interface IAccountSendTransactionRequest {\n recipientAddress: string;\n amount: string;\n fee: string;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ export { Account } from './Account';
2
+ export { IAccountBalanceRequest, IAccountBalanceResponse, } from './AccountBalance';
3
+ export { IAccount } from './IAccount';
4
+ export { IAccountSignRequest, IAccountSignResponse } from './AccountSign';
5
+ export { IAccountDetails } from './IAccountDetails';
6
+ export { IAccountRollsRequest } from './IAccountRolls';
7
+ export { IAccountSendTransactionRequest } from './IAccountSendTransaction';
8
+ export { IAccountCallSCRequest } from './IAccountCallSCRequest';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Account } from './Account';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { Account } from './Account';\nexport {\n IAccountBalanceRequest,\n IAccountBalanceResponse,\n} from './AccountBalance';\nexport { IAccount } from './IAccount';\nexport { IAccountSignRequest, IAccountSignResponse } from './AccountSign';\nexport { IAccountDetails } from './IAccountDetails';\nexport { IAccountRollsRequest } from './IAccountRolls';\nexport { IAccountSendTransactionRequest } from './IAccountSendTransaction';\nexport { IAccountCallSCRequest } from './IAccountCallSCRequest';\n"]}