@arkecosystem/typescript-crypto 0.0.3 → 0.0.5

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 (196) hide show
  1. package/.github/workflows/ci.yml +23 -23
  2. package/.github/workflows/format.yml +80 -0
  3. package/.github/workflows/publish.yml +1 -1
  4. package/.prettierrc.json +8 -0
  5. package/dist/enums/ContractAbiType.d.ts.map +1 -1
  6. package/dist/exceptions/index.d.ts.map +1 -1
  7. package/dist/identities/PrivateKey.d.ts +2 -2
  8. package/dist/identities/PrivateKey.d.ts.map +1 -1
  9. package/dist/identities/PrivateKey.js +1 -1
  10. package/dist/identities/WIF.d.ts.map +1 -1
  11. package/dist/identities/WIF.js +2 -2
  12. package/dist/index.js +532 -626
  13. package/dist/networks/AbstractNetwork.d.ts +1 -1
  14. package/dist/networks/AbstractNetwork.d.ts.map +1 -1
  15. package/dist/networks/Mainnet.d.ts +1 -1
  16. package/dist/networks/Mainnet.d.ts.map +1 -1
  17. package/dist/networks/Mainnet.js +1 -1
  18. package/dist/networks/Testnet.d.ts +1 -1
  19. package/dist/networks/Testnet.d.ts.map +1 -1
  20. package/dist/networks/Testnet.js +1 -1
  21. package/dist/transactions/Deserializer.d.ts +5 -5
  22. package/dist/transactions/Deserializer.d.ts.map +1 -1
  23. package/dist/transactions/Deserializer.js +18 -18
  24. package/dist/transactions/Serializer.d.ts +0 -1
  25. package/dist/transactions/Serializer.d.ts.map +1 -1
  26. package/dist/transactions/Serializer.js +0 -3
  27. package/dist/transactions/builders/AbstractTransactionBuilder.d.ts +7 -6
  28. package/dist/transactions/builders/AbstractTransactionBuilder.d.ts.map +1 -1
  29. package/dist/transactions/builders/AbstractTransactionBuilder.js +15 -8
  30. package/dist/transactions/builders/EvmCallBuilder.d.ts +3 -3
  31. package/dist/transactions/builders/EvmCallBuilder.d.ts.map +1 -1
  32. package/dist/transactions/builders/MultipaymentBuilder.d.ts +5 -4
  33. package/dist/transactions/builders/MultipaymentBuilder.d.ts.map +1 -1
  34. package/dist/transactions/builders/MultipaymentBuilder.js +6 -2
  35. package/dist/transactions/builders/TransferBuilder.d.ts +4 -3
  36. package/dist/transactions/builders/TransferBuilder.d.ts.map +1 -1
  37. package/dist/transactions/builders/TransferBuilder.js +4 -0
  38. package/dist/transactions/builders/UnvoteBuilder.d.ts +3 -3
  39. package/dist/transactions/builders/UnvoteBuilder.d.ts.map +1 -1
  40. package/dist/transactions/builders/UnvoteBuilder.js +1 -1
  41. package/dist/transactions/builders/UsernameRegistrationBuilder.d.ts +3 -3
  42. package/dist/transactions/builders/UsernameRegistrationBuilder.d.ts.map +1 -1
  43. package/dist/transactions/builders/UsernameRegistrationBuilder.js +1 -1
  44. package/dist/transactions/builders/UsernameResignationBuilder.d.ts +3 -3
  45. package/dist/transactions/builders/UsernameResignationBuilder.d.ts.map +1 -1
  46. package/dist/transactions/builders/UsernameResignationBuilder.js +1 -1
  47. package/dist/transactions/builders/ValidatorRegistrationBuilder.d.ts +3 -3
  48. package/dist/transactions/builders/ValidatorRegistrationBuilder.d.ts.map +1 -1
  49. package/dist/transactions/builders/ValidatorRegistrationBuilder.js +4 -2
  50. package/dist/transactions/builders/ValidatorResignationBuilder.d.ts +3 -3
  51. package/dist/transactions/builders/ValidatorResignationBuilder.d.ts.map +1 -1
  52. package/dist/transactions/builders/ValidatorResignationBuilder.js +1 -1
  53. package/dist/transactions/builders/VoteBuilder.d.ts +3 -3
  54. package/dist/transactions/builders/VoteBuilder.d.ts.map +1 -1
  55. package/dist/transactions/builders/VoteBuilder.js +1 -1
  56. package/dist/transactions/types/AbstractTransaction.d.ts +2 -5
  57. package/dist/transactions/types/AbstractTransaction.d.ts.map +1 -1
  58. package/dist/transactions/types/AbstractTransaction.js +13 -15
  59. package/dist/transactions/types/EvmCall.d.ts +0 -3
  60. package/dist/transactions/types/EvmCall.d.ts.map +1 -1
  61. package/dist/transactions/types/EvmCall.js +0 -8
  62. package/dist/transactions/types/Multipayment.d.ts +1 -3
  63. package/dist/transactions/types/Multipayment.d.ts.map +1 -1
  64. package/dist/transactions/types/Multipayment.js +1 -8
  65. package/dist/transactions/types/Transfer.d.ts +0 -3
  66. package/dist/transactions/types/Transfer.d.ts.map +1 -1
  67. package/dist/transactions/types/Transfer.js +0 -8
  68. package/dist/transactions/types/Unvote.d.ts +0 -3
  69. package/dist/transactions/types/Unvote.d.ts.map +1 -1
  70. package/dist/transactions/types/Unvote.js +0 -8
  71. package/dist/transactions/types/UsernameRegistration.d.ts +1 -3
  72. package/dist/transactions/types/UsernameRegistration.d.ts.map +1 -1
  73. package/dist/transactions/types/UsernameRegistration.js +0 -7
  74. package/dist/transactions/types/UsernameResignation.d.ts +0 -3
  75. package/dist/transactions/types/UsernameResignation.d.ts.map +1 -1
  76. package/dist/transactions/types/UsernameResignation.js +0 -7
  77. package/dist/transactions/types/ValidatorRegistration.d.ts +1 -3
  78. package/dist/transactions/types/ValidatorRegistration.d.ts.map +1 -1
  79. package/dist/transactions/types/ValidatorRegistration.js +0 -8
  80. package/dist/transactions/types/ValidatorResignation.d.ts +0 -3
  81. package/dist/transactions/types/ValidatorResignation.d.ts.map +1 -1
  82. package/dist/transactions/types/ValidatorResignation.js +0 -8
  83. package/dist/transactions/types/Vote.d.ts +1 -3
  84. package/dist/transactions/types/Vote.d.ts.map +1 -1
  85. package/dist/transactions/types/Vote.js +0 -8
  86. package/dist/types.d.ts +19 -19
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/utils/Abi/ArgumentDecoder.js +6 -6
  89. package/dist/utils/Abi/json/Abi.Consensus.json +15 -45
  90. package/dist/utils/Abi/json/Abi.Usernames.json +9 -27
  91. package/dist/utils/AbiDecoder.d.ts.map +1 -1
  92. package/dist/utils/AbiDecoder.js +3 -0
  93. package/dist/utils/AbiEncoder.d.ts +1 -1
  94. package/dist/utils/AbiEncoder.d.ts.map +1 -1
  95. package/dist/utils/AbiEncoder.js +2 -1
  96. package/dist/utils/Message.d.ts +1 -1
  97. package/dist/utils/Message.d.ts.map +1 -1
  98. package/dist/utils/Message.js +1 -1
  99. package/dist/utils/TransactionUtils.d.ts +0 -1
  100. package/dist/utils/TransactionUtils.d.ts.map +1 -1
  101. package/dist/utils/TransactionUtils.js +15 -18
  102. package/dist/utils/UnitConverter.d.ts.map +1 -1
  103. package/dist/utils/UnitConverter.js +12 -12
  104. package/eslint.config.mjs +19 -0
  105. package/jest.config.ts +6 -6
  106. package/package.json +6 -2
  107. package/src/enums/Constants.ts +1 -1
  108. package/src/enums/ContractAbiType.ts +4 -4
  109. package/src/exceptions/index.ts +1 -1
  110. package/src/identities/PrivateKey.ts +3 -3
  111. package/src/identities/WIF.ts +2 -3
  112. package/src/networks/AbstractNetwork.ts +3 -3
  113. package/src/networks/Mainnet.ts +3 -3
  114. package/src/networks/Testnet.ts +1 -1
  115. package/src/transactions/Deserializer.ts +39 -30
  116. package/src/transactions/Serializer.ts +1 -5
  117. package/src/transactions/builders/AbstractTransactionBuilder.ts +20 -11
  118. package/src/transactions/builders/EvmCallBuilder.ts +3 -3
  119. package/src/transactions/builders/MultipaymentBuilder.ts +13 -6
  120. package/src/transactions/builders/TransferBuilder.ts +8 -3
  121. package/src/transactions/builders/UnvoteBuilder.ts +4 -4
  122. package/src/transactions/builders/UsernameRegistrationBuilder.ts +4 -4
  123. package/src/transactions/builders/UsernameResignationBuilder.ts +4 -4
  124. package/src/transactions/builders/ValidatorRegistrationBuilder.ts +8 -5
  125. package/src/transactions/builders/ValidatorResignationBuilder.ts +4 -4
  126. package/src/transactions/builders/VoteBuilder.ts +4 -4
  127. package/src/transactions/types/AbstractTransaction.ts +17 -24
  128. package/src/transactions/types/EvmCall.ts +0 -15
  129. package/src/transactions/types/Multipayment.ts +3 -15
  130. package/src/transactions/types/Transfer.ts +0 -15
  131. package/src/transactions/types/Unvote.ts +0 -15
  132. package/src/transactions/types/UsernameRegistration.ts +1 -13
  133. package/src/transactions/types/UsernameResignation.ts +0 -14
  134. package/src/transactions/types/ValidatorRegistration.ts +1 -14
  135. package/src/transactions/types/ValidatorResignation.ts +0 -15
  136. package/src/transactions/types/Vote.ts +1 -14
  137. package/src/types.ts +19 -19
  138. package/src/utils/Abi/ArgumentDecoder.ts +6 -6
  139. package/src/utils/Abi/json/Abi.Consensus.json +1641 -1671
  140. package/src/utils/Abi/json/Abi.Multipayment.json +108 -108
  141. package/src/utils/Abi/json/Abi.Usernames.json +880 -898
  142. package/src/utils/AbiBase.ts +1 -1
  143. package/src/utils/AbiDecoder.ts +6 -3
  144. package/src/utils/AbiEncoder.ts +3 -2
  145. package/src/utils/Message.ts +1 -1
  146. package/src/utils/TransactionUtils.ts +24 -28
  147. package/src/utils/UnitConverter.ts +29 -29
  148. package/tests/fixtures/global.json +4 -4
  149. package/tests/fixtures/identity.json +10 -10
  150. package/tests/fixtures/transactions/evm-sign.json +4 -4
  151. package/tests/fixtures/transactions/multipayment-empty.json +4 -4
  152. package/tests/fixtures/transactions/multipayment-single.json +4 -4
  153. package/tests/fixtures/transactions/multipayment.json +4 -4
  154. package/tests/fixtures/transactions/transfer-0.json +4 -4
  155. package/tests/fixtures/transactions/transfer-large-amount.json +4 -4
  156. package/tests/fixtures/transactions/transfer.json +4 -4
  157. package/tests/fixtures/transactions/unvote.json +4 -4
  158. package/tests/fixtures/transactions/username-registration.json +4 -4
  159. package/tests/fixtures/transactions/username-resignation.json +4 -4
  160. package/tests/fixtures/transactions/validator-registration.json +4 -4
  161. package/tests/fixtures/transactions/validator-resignation.json +4 -4
  162. package/tests/fixtures/transactions/vote.json +4 -4
  163. package/tests/unit/configuration/Network.test.ts +52 -0
  164. package/tests/unit/identities/Address.test.ts +4 -4
  165. package/tests/unit/identities/PrivateKey.test.ts +5 -5
  166. package/tests/unit/identities/PublicKey.test.ts +9 -9
  167. package/tests/unit/identities/WIF.test.ts +1 -1
  168. package/tests/unit/transactions/Deserializer.test.ts +81 -63
  169. package/tests/unit/transactions/Serializer.test.ts +11 -1
  170. package/tests/unit/transactions/builders/EvmCallBuilder.test.ts +76 -9
  171. package/tests/unit/transactions/builders/MultipaymentBuilder.test.ts +125 -17
  172. package/tests/unit/transactions/builders/TransferBuilder.test.ts +146 -47
  173. package/tests/unit/transactions/builders/UnvoteBuilder.test.ts +75 -8
  174. package/tests/unit/transactions/builders/UsernameRegistrationBuilder.test.ts +75 -8
  175. package/tests/unit/transactions/builders/UsernameResignationBuilder.test.ts +75 -8
  176. package/tests/unit/transactions/builders/ValidatorRegistrationBuilder.test.ts +103 -8
  177. package/tests/unit/transactions/builders/ValidatorResignationBuilder.test.ts +75 -8
  178. package/tests/unit/transactions/builders/VoteBuilder.test.ts +75 -8
  179. package/tests/unit/transactions/types/AbstractTransaction.test.ts +27 -30
  180. package/tests/unit/transactions/types/EvmCall.test.ts +22 -0
  181. package/tests/unit/transactions/types/Multipayment.test.ts +38 -0
  182. package/tests/unit/transactions/types/Transfer.test.ts +18 -0
  183. package/tests/unit/transactions/types/Unvote.test.ts +18 -0
  184. package/tests/unit/transactions/types/UsernameRegistration.test.ts +22 -0
  185. package/tests/unit/transactions/types/UsernameResignation.test.ts +18 -0
  186. package/tests/unit/transactions/types/ValidatorRegistration.test.ts +22 -0
  187. package/tests/unit/transactions/types/ValidatorResignation.test.ts +18 -0
  188. package/tests/unit/transactions/types/Vote.test.ts +20 -0
  189. package/tests/unit/utils/Abi/ArgumentDecoder.test.ts +17 -16
  190. package/tests/unit/utils/AbiEncoder.test.ts +2 -2
  191. package/tests/unit/utils/Message.test.ts +1 -1
  192. package/tests/unit/utils/TransactionUtils.test.ts +1 -5
  193. package/tests/unit/utils/UnitConverter.test.ts +81 -47
  194. package/tsconfig.json +1 -1
  195. package/.eslintrc.js +0 -12
  196. package/prettier.config.js +0 -8
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Address } from "@/identities/Address";
11
11
  import { Constants } from "@/enums/Constants";
12
- import { ContractAbiType } from "@/enums/ContractAbiType";
13
12
  import { PublicKey } from "@/identities/PublicKey";
14
13
  import { Serializer } from "@/transactions/Serializer";
15
14
  import { TransactionUtils } from "@/utils/TransactionUtils";
15
+ import BigNumber from "bignumber.js";
16
16
  export class AbstractTransaction {
17
17
  constructor(data) {
18
18
  this.data = Object.assign({}, data);
@@ -22,9 +22,6 @@ export class AbstractTransaction {
22
22
  this.data.data = this.getPayload();
23
23
  return this;
24
24
  }
25
- getId() {
26
- return TransactionUtils.getId(this.data);
27
- }
28
25
  sign(privateKey) {
29
26
  return __awaiter(this, void 0, void 0, function* () {
30
27
  const hash = TransactionUtils.toBuffer(this.data, true).toString("hex");
@@ -38,7 +35,7 @@ export class AbstractTransaction {
38
35
  recoverSender() {
39
36
  const publicKey = this.recoverPublicKey();
40
37
  this.data["senderPublicKey"] = publicKey.publicKey;
41
- this.data["senderAddress"] = Address.fromPublicKey(publicKey.publicKey);
38
+ this.data["from"] = Address.fromPublicKey(publicKey.publicKey);
42
39
  }
43
40
  verify() {
44
41
  const recoveredPublicKey = this.recoverPublicKey();
@@ -48,29 +45,33 @@ export class AbstractTransaction {
48
45
  }
49
46
  return recoveredPublicKey.publicKey === senderPublicKey;
50
47
  }
51
- toArray() {
48
+ toObject() {
52
49
  return [
53
50
  "gasPrice",
54
51
  "network",
55
- "id",
56
- "gasLimit",
52
+ "hash",
53
+ "gas",
57
54
  "nonce",
58
55
  "senderPublicKey",
59
- "recipientAddress",
56
+ "to",
60
57
  "value",
61
58
  "data",
62
59
  "r",
63
60
  "s",
64
61
  "v",
65
62
  ].reduce((acc, key) => {
66
- if (this.data[key] !== undefined) {
67
- acc[key] = this.data[key];
63
+ let value = this.data[key];
64
+ if (typeof value === "bigint") {
65
+ value = BigNumber(value).toFixed();
66
+ }
67
+ if (value !== undefined) {
68
+ acc[key] = value;
68
69
  }
69
70
  return acc;
70
71
  }, {});
71
72
  }
72
73
  toJson() {
73
- return JSON.stringify(this.toArray());
74
+ return JSON.stringify(this.toObject());
74
75
  }
75
76
  hash(skipSignature = false) {
76
77
  return TransactionUtils.toHash(this.data, skipSignature);
@@ -84,7 +85,4 @@ export class AbstractTransaction {
84
85
  }
85
86
  return PublicKey.recover(Buffer.from(this.hash(true), "hex"), BigInt(`0x${this.data.r}`), BigInt(`0x${this.data.s}`), this.data.v - Constants.ETHEREUM_RECOVERY_ID_OFFSET);
86
87
  }
87
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
88
- throw new Error("Method not implemented.");
89
- }
90
88
  }
@@ -1,8 +1,5 @@
1
- import { AbiResult, TransactionData } from "@/types";
2
1
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
2
  export declare class EvmCall extends AbstractTransaction {
5
3
  getPayload(): string;
6
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
7
4
  }
8
5
  //# sourceMappingURL=EvmCall.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EvmCall.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/EvmCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,OAAQ,SAAQ,mBAAmB;IAC/C,UAAU,IAAI,MAAM;IAIpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"EvmCall.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/EvmCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,OAAQ,SAAQ,mBAAmB;IAC/C,UAAU,IAAI,MAAM;CAGpB"}
@@ -1,14 +1,6 @@
1
1
  import { AbstractTransaction } from "./AbstractTransaction";
2
- import { ContractAbiType } from "@/enums/ContractAbiType";
3
- import { Deserializer } from "@/transactions/Deserializer";
4
2
  export class EvmCall extends AbstractTransaction {
5
3
  getPayload() {
6
4
  return this.data["data"] || "";
7
5
  }
8
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
9
- if (!data["data"]) {
10
- return null;
11
- }
12
- return Deserializer.decodePayload(data, type);
13
- }
14
6
  }
@@ -1,9 +1,7 @@
1
- import { AbiResult, TransactionData } from "@/types";
1
+ import { TransactionData } from "@/types";
2
2
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
3
  export declare class Multipayment extends AbstractTransaction {
5
4
  constructor(data: TransactionData);
6
5
  getPayload(): string;
7
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
8
6
  }
9
7
  //# sourceMappingURL=Multipayment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Multipayment.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Multipayment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,YAAa,SAAQ,mBAAmB;gBACjC,IAAI,EAAE,eAAe;IAmBxC,UAAU,IAAI,MAAM;IAWpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"Multipayment.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Multipayment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,qBAAa,YAAa,SAAQ,mBAAmB;gBACjC,IAAI,EAAE,eAAe;IAmBxC,UAAU,IAAI,MAAM;CAUpB"}
@@ -3,7 +3,6 @@ import { AbiEncoder } from "@/utils/AbiEncoder";
3
3
  import { AbiFunction } from "@/enums/AbiFunction";
4
4
  import { AbstractTransaction } from "./AbstractTransaction";
5
5
  import { ContractAbiType } from "@/enums/ContractAbiType";
6
- import { Deserializer } from "@/transactions/Deserializer";
7
6
  export class Multipayment extends AbstractTransaction {
8
7
  constructor(data) {
9
8
  let payload;
@@ -24,15 +23,9 @@ export class Multipayment extends AbstractTransaction {
24
23
  super(data);
25
24
  }
26
25
  getPayload() {
27
- if (!this.data["pay"]) {
26
+ if (!this.data["pay"] || (Array.isArray(this.data["pay"]) && this.data["pay"].length === 0)) {
28
27
  return "";
29
28
  }
30
29
  return new AbiEncoder(ContractAbiType.MULTIPAYMENT).encodeFunctionCall(AbiFunction.MULTIPAYMENT, this.data["pay"]);
31
30
  }
32
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
33
- if (!data["data"]) {
34
- return null;
35
- }
36
- return Deserializer.decodePayload(data, ContractAbiType.MULTIPAYMENT);
37
- }
38
31
  }
@@ -1,8 +1,5 @@
1
- import { AbiResult, TransactionData } from "@/types";
2
1
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
2
  export declare class Transfer extends AbstractTransaction {
5
3
  getPayload(): string;
6
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
7
4
  }
8
5
  //# sourceMappingURL=Transfer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Transfer.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,QAAS,SAAQ,mBAAmB;IAChD,UAAU,IAAI,MAAM;IAIpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"Transfer.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,QAAS,SAAQ,mBAAmB;IAChD,UAAU,IAAI,MAAM;CAGpB"}
@@ -1,14 +1,6 @@
1
1
  import { AbstractTransaction } from "./AbstractTransaction";
2
- import { ContractAbiType } from "@/enums/ContractAbiType";
3
- import { Deserializer } from "@/transactions/Deserializer";
4
2
  export class Transfer extends AbstractTransaction {
5
3
  getPayload() {
6
4
  return "";
7
5
  }
8
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
9
- if (!data["data"]) {
10
- return null;
11
- }
12
- return Deserializer.decodePayload(data, type);
13
- }
14
6
  }
@@ -1,8 +1,5 @@
1
- import { AbiResult, TransactionData } from "@/types";
2
1
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
2
  export declare class Unvote extends AbstractTransaction {
5
3
  getPayload(): string;
6
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
7
4
  }
8
5
  //# sourceMappingURL=Unvote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Unvote.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Unvote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,MAAO,SAAQ,mBAAmB;IAC9C,UAAU,IAAI,MAAM;IAIpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"Unvote.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Unvote.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,MAAO,SAAQ,mBAAmB;IAC9C,UAAU,IAAI,MAAM;CAGpB"}
@@ -1,16 +1,8 @@
1
1
  import { AbiEncoder } from "@/utils/AbiEncoder";
2
2
  import { AbiFunction } from "@/enums/AbiFunction";
3
3
  import { AbstractTransaction } from "./AbstractTransaction";
4
- import { ContractAbiType } from "@/enums/ContractAbiType";
5
- import { Deserializer } from "@/transactions/Deserializer";
6
4
  export class Unvote extends AbstractTransaction {
7
5
  getPayload() {
8
6
  return new AbiEncoder().encodeFunctionCall(AbiFunction.UNVOTE, []);
9
7
  }
10
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
11
- if (!data["data"]) {
12
- return null;
13
- }
14
- return Deserializer.decodePayload(data, type);
15
- }
16
8
  }
@@ -1,9 +1,7 @@
1
- import { AbiResult, TransactionData } from "@/types";
1
+ import { TransactionData } from "@/types";
2
2
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
3
  export declare class UsernameRegistration extends AbstractTransaction {
5
4
  constructor(data: TransactionData);
6
5
  getPayload(): string;
7
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
8
6
  }
9
7
  //# sourceMappingURL=UsernameRegistration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UsernameRegistration.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/UsernameRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,oBAAqB,SAAQ,mBAAmB;gBACzC,IAAI,EAAE,eAAe;IAaxC,UAAU,IAAI,MAAM;IAUpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"UsernameRegistration.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/UsernameRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,qBAAa,oBAAqB,SAAQ,mBAAmB;gBACzC,IAAI,EAAE,eAAe;IAaxC,UAAU,IAAI,MAAM;CASpB"}
@@ -3,7 +3,6 @@ import { AbiEncoder } from "@/utils/AbiEncoder";
3
3
  import { AbiFunction } from "@/enums/AbiFunction";
4
4
  import { AbstractTransaction } from "./AbstractTransaction";
5
5
  import { ContractAbiType } from "@/enums/ContractAbiType";
6
- import { Deserializer } from "@/transactions/Deserializer";
7
6
  export class UsernameRegistration extends AbstractTransaction {
8
7
  constructor(data) {
9
8
  let payload;
@@ -24,10 +23,4 @@ export class UsernameRegistration extends AbstractTransaction {
24
23
  this.data["username"],
25
24
  ]);
26
25
  }
27
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
28
- if (!data["data"]) {
29
- return null;
30
- }
31
- return Deserializer.decodePayload(data, ContractAbiType.USERNAMES);
32
- }
33
26
  }
@@ -1,8 +1,5 @@
1
- import { AbiResult, TransactionData } from "@/types";
2
1
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
2
  export declare class UsernameResignation extends AbstractTransaction {
5
3
  getPayload(): string;
6
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
7
4
  }
8
5
  //# sourceMappingURL=UsernameResignation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UsernameResignation.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/UsernameResignation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC3D,UAAU,IAAI,MAAM;IAIpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"UsernameResignation.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/UsernameResignation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC3D,UAAU,IAAI,MAAM;CAGpB"}
@@ -2,15 +2,8 @@ import { AbiEncoder } from "@/utils/AbiEncoder";
2
2
  import { AbiFunction } from "@/enums/AbiFunction";
3
3
  import { AbstractTransaction } from "./AbstractTransaction";
4
4
  import { ContractAbiType } from "@/enums/ContractAbiType";
5
- import { Deserializer } from "@/transactions/Deserializer";
6
5
  export class UsernameResignation extends AbstractTransaction {
7
6
  getPayload() {
8
7
  return new AbiEncoder(ContractAbiType.USERNAMES).encodeFunctionCall(AbiFunction.USERNAME_RESIGNATION, []);
9
8
  }
10
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
11
- if (!data["data"]) {
12
- return null;
13
- }
14
- return Deserializer.decodePayload(data, ContractAbiType.USERNAMES);
15
- }
16
9
  }
@@ -1,9 +1,7 @@
1
- import { AbiResult, TransactionData } from "@/types";
1
+ import { TransactionData } from "@/types";
2
2
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
3
  export declare class ValidatorRegistration extends AbstractTransaction {
5
4
  constructor(data: TransactionData);
6
5
  getPayload(): string;
7
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
8
6
  }
9
7
  //# sourceMappingURL=ValidatorRegistration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ValidatorRegistration.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/ValidatorRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,qBAAsB,SAAQ,mBAAmB;gBAC1C,IAAI,EAAE,eAAe;IAaxC,UAAU,IAAI,MAAM;IAUpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"ValidatorRegistration.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/ValidatorRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,qBAAsB,SAAQ,mBAAmB;gBAC1C,IAAI,EAAE,eAAe;IAaxC,UAAU,IAAI,MAAM;CASpB"}
@@ -2,8 +2,6 @@ import { AbiDecoder } from "@/utils/AbiDecoder";
2
2
  import { AbiEncoder } from "@/utils/AbiEncoder";
3
3
  import { AbiFunction } from "@/enums/AbiFunction";
4
4
  import { AbstractTransaction } from "./AbstractTransaction";
5
- import { ContractAbiType } from "@/enums/ContractAbiType";
6
- import { Deserializer } from "@/transactions/Deserializer";
7
5
  export class ValidatorRegistration extends AbstractTransaction {
8
6
  constructor(data) {
9
7
  let payload;
@@ -24,10 +22,4 @@ export class ValidatorRegistration extends AbstractTransaction {
24
22
  this.data["validatorPublicKey"],
25
23
  ]);
26
24
  }
27
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
28
- if (!data["data"]) {
29
- return null;
30
- }
31
- return Deserializer.decodePayload(data, type);
32
- }
33
25
  }
@@ -1,8 +1,5 @@
1
- import { AbiResult, TransactionData } from "@/types";
2
1
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
2
  export declare class ValidatorResignation extends AbstractTransaction {
5
3
  getPayload(): string;
6
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
7
4
  }
8
5
  //# sourceMappingURL=ValidatorResignation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ValidatorResignation.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/ValidatorResignation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,oBAAqB,SAAQ,mBAAmB;IAC5D,UAAU,IAAI,MAAM;IAIpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"ValidatorResignation.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/ValidatorResignation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,oBAAqB,SAAQ,mBAAmB;IAC5D,UAAU,IAAI,MAAM;CAGpB"}
@@ -1,16 +1,8 @@
1
1
  import { AbiEncoder } from "@/utils/AbiEncoder";
2
2
  import { AbiFunction } from "@/enums/AbiFunction";
3
3
  import { AbstractTransaction } from "./AbstractTransaction";
4
- import { ContractAbiType } from "@/enums/ContractAbiType";
5
- import { Deserializer } from "@/transactions/Deserializer";
6
4
  export class ValidatorResignation extends AbstractTransaction {
7
5
  getPayload() {
8
6
  return new AbiEncoder().encodeFunctionCall(AbiFunction.VALIDATOR_RESIGNATION, []);
9
7
  }
10
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
11
- if (!data["data"]) {
12
- return null;
13
- }
14
- return Deserializer.decodePayload(data, type);
15
- }
16
8
  }
@@ -1,9 +1,7 @@
1
- import { AbiResult, TransactionData } from "@/types";
1
+ import { TransactionData } from "@/types";
2
2
  import { AbstractTransaction } from "./AbstractTransaction";
3
- import { ContractAbiType } from "@/enums/ContractAbiType";
4
3
  export declare class Vote extends AbstractTransaction {
5
4
  constructor(data: TransactionData);
6
5
  getPayload(): string;
7
- protected decodePayload(data: TransactionData, type?: ContractAbiType): AbiResult | null;
8
6
  }
9
7
  //# sourceMappingURL=Vote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Vote.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Vote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,qBAAa,IAAK,SAAQ,mBAAmB;gBACzB,IAAI,EAAE,eAAe;IAaxC,UAAU,IAAI,MAAM;IAQpB,SAAS,CAAC,aAAa,CACtB,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,eAA2C,GAC/C,SAAS,GAAG,IAAI;CAOnB"}
1
+ {"version":3,"file":"Vote.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/Vote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,IAAK,SAAQ,mBAAmB;gBACzB,IAAI,EAAE,eAAe;IAaxC,UAAU,IAAI,MAAM;CAOpB"}
@@ -2,8 +2,6 @@ import { AbiDecoder } from "@/utils/AbiDecoder";
2
2
  import { AbiEncoder } from "@/utils/AbiEncoder";
3
3
  import { AbiFunction } from "@/enums/AbiFunction";
4
4
  import { AbstractTransaction } from "./AbstractTransaction";
5
- import { ContractAbiType } from "@/enums/ContractAbiType";
6
- import { Deserializer } from "@/transactions/Deserializer";
7
5
  export class Vote extends AbstractTransaction {
8
6
  constructor(data) {
9
7
  let payload;
@@ -22,10 +20,4 @@ export class Vote extends AbstractTransaction {
22
20
  }
23
21
  return new AbiEncoder().encodeFunctionCall(AbiFunction.VOTE, [this.data["vote"]]);
24
22
  }
25
- decodePayload(data, type = ContractAbiType.CONSENSUS) {
26
- if (!data["data"]) {
27
- return null;
28
- }
29
- return Deserializer.decodePayload(data, type);
30
- }
31
23
  }
package/dist/types.d.ts CHANGED
@@ -1,56 +1,56 @@
1
+ import BigNumber from "bignumber.js";
1
2
  import { Result } from "ethers";
2
- export type TransactionData = {
3
+ export interface TransactionData {
3
4
  gasPrice?: string | null;
4
5
  network?: number | string | null;
5
- id?: string | null;
6
- gasLimit?: string | null;
6
+ hash?: string | null;
7
+ gas?: string | null;
7
8
  nonce?: number | string | null;
8
9
  senderPublicKey?: string | null;
9
- recipientAddress?: string | null;
10
+ to?: string | null;
10
11
  value?: string | null;
11
12
  data?: string | null;
12
13
  r?: string;
13
14
  s?: string;
14
15
  v?: number;
15
- [key: string]: number | string | undefined | null | Array<any> | string;
16
- };
17
- export type AbiResult = {
16
+ [key: string]: number | string | undefined | null | unknown[] | string;
17
+ }
18
+ export interface AbiResult {
18
19
  functionName: string;
19
20
  args: Result;
20
- };
21
- export type SignedMessage = {
21
+ }
22
+ export interface SignedMessage {
22
23
  publicKey: string;
23
24
  signature: string;
24
25
  message: string;
25
- };
26
+ }
26
27
  export interface ITransaction {
27
28
  data: TransactionData;
28
29
  serialized: Buffer | undefined;
29
30
  getPayload(): string;
30
31
  refreshPayloadData(): ITransaction;
31
- getId(): string;
32
- sign(privateKey: any): Promise<ITransaction>;
32
+ sign(privateKey: unknown): Promise<ITransaction>;
33
33
  recoverSender(): void;
34
34
  verify(): boolean;
35
- toArray(): TransactionData;
35
+ toObject(): TransactionData;
36
36
  toJson(): string;
37
37
  hash(skipSignature?: boolean): string;
38
38
  serialize(skipSignature?: boolean): Buffer;
39
39
  }
40
40
  export interface ITransactionBuilder<T extends ITransactionBuilder<T>> {
41
41
  transaction: ITransaction;
42
- gasLimit(gasLimit: string): T;
43
- gasPrice(gasPrice: string): T;
44
- recipientAddress(recipientAddress: string): T;
42
+ gas(gas: string | BigNumber): T;
43
+ gasPrice(gasPrice: string | BigNumber): T;
44
+ to(to: string): T;
45
45
  nonce(nonce: string): T;
46
46
  network(network: number): T;
47
47
  sign(passphrase: string): Promise<T>;
48
48
  verify(): boolean;
49
- toArray(): TransactionData;
49
+ toObject(): TransactionData;
50
50
  toJson(): string;
51
51
  }
52
52
  export interface ITransferBuilder extends ITransactionBuilder<ITransferBuilder> {
53
- value(value: string): ITransferBuilder;
53
+ value(value: string | BigNumber): ITransferBuilder;
54
54
  }
55
55
  export interface IVoteBuilder extends ITransactionBuilder<IVoteBuilder> {
56
56
  vote(vote: string): IVoteBuilder;
@@ -65,7 +65,7 @@ export interface IEvmCallBuilder extends ITransactionBuilder<IEvmCallBuilder> {
65
65
  payload(payload: string): IEvmCallBuilder;
66
66
  }
67
67
  export interface IMultipaymentBuilder extends ITransactionBuilder<IMultipaymentBuilder> {
68
- pay(address: string, amount: string): IMultipaymentBuilder;
68
+ pay(address: string, amount: string | BigNumber): IMultipaymentBuilder;
69
69
  }
70
70
  export interface IBasicTransactionBuilder extends ITransactionBuilder<IBasicTransactionBuilder> {
71
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":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,CAAC;IAC5B,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,IAAI,OAAO,CAAC;IAClB,QAAQ,IAAI,eAAe,CAAC;IAC5B,MAAM,IAAI,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC9E,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAAC;CACnD;AAED,MAAM,WAAW,YAAa,SAAQ,mBAAmB,CAAC,YAAY,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;CACjC;AAED,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB,CAAC,6BAA6B,CAAC;IACxG,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,GAAG,6BAA6B,CAAC;CAC9E;AAED,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB,CAAC,4BAA4B,CAAC;IACtG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,4BAA4B,CAAC;CACzD;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB,CAAC,eAAe,CAAC;IAC5E,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB,CAAC,oBAAoB,CAAC;IACtF,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,oBAAoB,CAAC;CACvE;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB,CAAC,wBAAwB,CAAC;CAAG"}
@@ -1,21 +1,21 @@
1
1
  import { AbiCoder } from "ethers";
2
2
  export class ArgumentDecoder {
3
3
  constructor(bytes) {
4
- this.bytes = Buffer.from(bytes, 'hex');
4
+ this.bytes = Buffer.from(bytes, "hex");
5
5
  }
6
6
  decodeString() {
7
- return new AbiCoder().decode(['string'], this.bytes)[0].toString();
7
+ return new AbiCoder().decode(["string"], this.bytes)[0].toString();
8
8
  }
9
9
  decodeAddress() {
10
- return new AbiCoder().decode(['address'], this.bytes).toString();
10
+ return new AbiCoder().decode(["address"], this.bytes).toString();
11
11
  }
12
12
  decodeUnsignedInt() {
13
- return new AbiCoder().decode(['uint'], this.bytes)[0].toString();
13
+ return new AbiCoder().decode(["uint"], this.bytes)[0].toString();
14
14
  }
15
15
  decodeSignedInt() {
16
- return new AbiCoder().decode(['int'], this.bytes)[0].toString();
16
+ return new AbiCoder().decode(["int"], this.bytes)[0].toString();
17
17
  }
18
18
  decodeBool() {
19
- return new AbiCoder().decode(['bool'], this.bytes)[0] === true;
19
+ return new AbiCoder().decode(["bool"], this.bytes)[0] === true;
20
20
  }
21
21
  }