@airgap/ethereum 0.13.11-beta.1 → 0.13.11-beta.3

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 (159) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +18 -0
  3. package/index.js.map +1 -0
  4. package/package.json +1 -5
  5. package/v0/index.d.ts +12 -0
  6. package/v0/index.js +39 -0
  7. package/v0/index.js.map +1 -0
  8. package/v0/protocol/BaseEthereumProtocol.d.ts +98 -0
  9. package/v0/protocol/BaseEthereumProtocol.js +939 -0
  10. package/v0/protocol/BaseEthereumProtocol.js.map +1 -0
  11. package/v0/protocol/EthereumAddress.d.ts +8 -0
  12. package/v0/protocol/EthereumAddress.js +43 -0
  13. package/v0/protocol/EthereumAddress.js.map +1 -0
  14. package/v0/protocol/EthereumChainIDs.d.ts +1 -0
  15. package/v0/protocol/EthereumChainIDs.js +340 -0
  16. package/v0/protocol/EthereumChainIDs.js.map +1 -0
  17. package/v0/protocol/EthereumClassicProtocol.d.ts +6 -0
  18. package/v0/protocol/EthereumClassicProtocol.js +30 -0
  19. package/v0/protocol/EthereumClassicProtocol.js.map +1 -0
  20. package/v0/protocol/EthereumCryptoClient.d.ts +12 -0
  21. package/v0/protocol/EthereumCryptoClient.js +148 -0
  22. package/v0/protocol/EthereumCryptoClient.js.map +1 -0
  23. package/v0/protocol/EthereumProtocol.d.ts +10 -0
  24. package/v0/protocol/EthereumProtocol.js +34 -0
  25. package/v0/protocol/EthereumProtocol.js.map +1 -0
  26. package/v0/protocol/EthereumProtocolOptions.d.ts +46 -0
  27. package/v0/protocol/EthereumProtocolOptions.js +150 -0
  28. package/v0/protocol/EthereumProtocolOptions.js.map +1 -0
  29. package/v0/protocol/EthereumRopstenProtocol.d.ts +6 -0
  30. package/v0/protocol/EthereumRopstenProtocol.js +30 -0
  31. package/v0/protocol/EthereumRopstenProtocol.js.map +1 -0
  32. package/v0/protocol/EthereumTypes.d.ts +14 -0
  33. package/v0/protocol/EthereumTypes.js +3 -0
  34. package/v0/protocol/EthereumTypes.js.map +1 -0
  35. package/v0/protocol/clients/info-clients/EtherscanInfoClient.d.ts +8 -0
  36. package/v0/protocol/clients/info-clients/EtherscanInfoClient.js +195 -0
  37. package/v0/protocol/clients/info-clients/EtherscanInfoClient.js.map +1 -0
  38. package/v0/protocol/clients/info-clients/InfoClient.d.ts +8 -0
  39. package/v0/protocol/clients/info-clients/InfoClient.js +11 -0
  40. package/v0/protocol/clients/info-clients/InfoClient.js.map +1 -0
  41. package/v0/protocol/clients/node-clients/AirGapNodeClient.d.ts +41 -0
  42. package/v0/protocol/clients/node-clients/AirGapNodeClient.js +353 -0
  43. package/v0/protocol/clients/node-clients/AirGapNodeClient.js.map +1 -0
  44. package/v0/protocol/clients/node-clients/NodeClient.d.ts +17 -0
  45. package/v0/protocol/clients/node-clients/NodeClient.js +11 -0
  46. package/v0/protocol/clients/node-clients/NodeClient.js.map +1 -0
  47. package/v0/protocol/erc20/ERC20.d.ts +3 -0
  48. package/v0/protocol/erc20/ERC20.js +9 -0
  49. package/v0/protocol/erc20/ERC20.js.map +1 -0
  50. package/v0/protocol/erc20/GenericERC20.d.ts +32 -0
  51. package/v0/protocol/erc20/GenericERC20.js +335 -0
  52. package/v0/protocol/erc20/GenericERC20.js.map +1 -0
  53. package/v0/protocol/utils/utils.d.ts +13 -0
  54. package/v0/protocol/utils/utils.js +140 -0
  55. package/v0/protocol/utils/utils.js.map +1 -0
  56. package/v0/serializer/schemas/v2/transaction-sign-request-ethereum.json +50 -0
  57. package/v0/serializer/schemas/v2/transaction-sign-response-ethereum.json +19 -0
  58. package/v0/serializer/schemas/v3/transaction-sign-request-ethereum-typed.json +38 -0
  59. package/v0/serializer/schemas/v3/transaction-sign-request-ethereum.json +50 -0
  60. package/v0/serializer/schemas/v3/transaction-sign-response-ethereum.json +19 -0
  61. package/v0/serializer/validators/transaction-validator.d.ts +15 -0
  62. package/v0/serializer/validators/transaction-validator.js +96 -0
  63. package/v0/serializer/validators/transaction-validator.js.map +1 -0
  64. package/v0/serializer/validators/validators.d.ts +1 -0
  65. package/v0/serializer/validators/validators.js +78 -0
  66. package/v0/serializer/validators/validators.js.map +1 -0
  67. package/v0/types/signed-transaction-ethereum.d.ts +5 -0
  68. package/v0/types/signed-transaction-ethereum.js +3 -0
  69. package/v0/types/signed-transaction-ethereum.js.map +1 -0
  70. package/v0/types/transaction-ethereum.d.ts +14 -0
  71. package/v0/types/transaction-ethereum.js +3 -0
  72. package/v0/types/transaction-ethereum.js.map +1 -0
  73. package/v0/types/unsigned-transaction-ethereum-typed.d.ts +11 -0
  74. package/v0/types/unsigned-transaction-ethereum-typed.js +3 -0
  75. package/v0/types/unsigned-transaction-ethereum-typed.js.map +1 -0
  76. package/v0/types/unsigned-transaction-ethereum.d.ts +15 -0
  77. package/v0/types/unsigned-transaction-ethereum.js +3 -0
  78. package/v0/types/unsigned-transaction-ethereum.js.map +1 -0
  79. package/v1/block-explorer/EtherscanBlockExplorer.d.ts +9 -0
  80. package/v1/block-explorer/EtherscanBlockExplorer.js +74 -0
  81. package/v1/block-explorer/EtherscanBlockExplorer.js.map +1 -0
  82. package/v1/clients/crypto/EthereumCryptoClient.d.ts +7 -0
  83. package/v1/clients/crypto/EthereumCryptoClient.js +147 -0
  84. package/v1/clients/crypto/EthereumCryptoClient.js.map +1 -0
  85. package/v1/clients/info/EthereumInfoClient.d.ts +15 -0
  86. package/v1/clients/info/EthereumInfoClient.js +11 -0
  87. package/v1/clients/info/EthereumInfoClient.js.map +1 -0
  88. package/v1/clients/info/EtherscanInfoClient.d.ts +7 -0
  89. package/v1/clients/info/EtherscanInfoClient.js +165 -0
  90. package/v1/clients/info/EtherscanInfoClient.js.map +1 -0
  91. package/v1/clients/node/AirGapNodeClient.d.ts +41 -0
  92. package/v1/clients/node/AirGapNodeClient.js +351 -0
  93. package/v1/clients/node/AirGapNodeClient.js.map +1 -0
  94. package/v1/clients/node/EthereumNodeClient.d.ts +17 -0
  95. package/v1/clients/node/EthereumNodeClient.js +11 -0
  96. package/v1/clients/node/EthereumNodeClient.js.map +1 -0
  97. package/v1/data/EthereumAddress.d.ts +7 -0
  98. package/v1/data/EthereumAddress.js +46 -0
  99. package/v1/data/EthereumAddress.js.map +1 -0
  100. package/v1/index.d.ts +11 -0
  101. package/v1/index.js +13 -0
  102. package/v1/index.js.map +1 -0
  103. package/v1/module/ERC20Tokens.d.ts +3 -0
  104. package/v1/module/ERC20Tokens.js +815 -0
  105. package/v1/module/ERC20Tokens.js.map +1 -0
  106. package/v1/module/EthereumModule.d.ts +13 -0
  107. package/v1/module/EthereumModule.js +125 -0
  108. package/v1/module/EthereumModule.js.map +1 -0
  109. package/v1/module.d.ts +3 -0
  110. package/v1/module.js +24 -0
  111. package/v1/module.js.map +1 -0
  112. package/v1/protocol/EthereumBaseProtocol.d.ts +84 -0
  113. package/v1/protocol/EthereumBaseProtocol.js +827 -0
  114. package/v1/protocol/EthereumBaseProtocol.js.map +1 -0
  115. package/v1/protocol/EthereumChainIds.d.ts +1 -0
  116. package/v1/protocol/EthereumChainIds.js +340 -0
  117. package/v1/protocol/EthereumChainIds.js.map +1 -0
  118. package/v1/protocol/EthereumProtocol.d.ts +8 -0
  119. package/v1/protocol/EthereumProtocol.js +64 -0
  120. package/v1/protocol/EthereumProtocol.js.map +1 -0
  121. package/v1/protocol/erc20/ERC20Token.d.ts +8 -0
  122. package/v1/protocol/erc20/ERC20Token.js +421 -0
  123. package/v1/protocol/erc20/ERC20Token.js.map +1 -0
  124. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +12 -0
  125. package/v1/serializer/v3/schemas/converter/transaction-converter.js +80 -0
  126. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
  127. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.d.ts +10 -0
  128. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js +3 -0
  129. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js.map +1 -0
  130. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.d.ts +14 -0
  131. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js +3 -0
  132. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js.map +1 -0
  133. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.d.ts +3 -0
  134. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js +3 -0
  135. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js.map +1 -0
  136. package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum-typed.json +41 -0
  137. package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum.json +58 -0
  138. package/v1/serializer/v3/schemas/generated/transaction-sign-response-ethereum.json +19 -0
  139. package/v1/serializer/v3/serializer-companion.d.ts +13 -0
  140. package/v1/serializer/v3/serializer-companion.js +190 -0
  141. package/v1/serializer/v3/serializer-companion.js.map +1 -0
  142. package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
  143. package/v1/serializer/v3/validators/transaction-validator.js +71 -0
  144. package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
  145. package/v1/types/crypto.d.ts +2 -0
  146. package/v1/types/crypto.js +3 -0
  147. package/v1/types/crypto.js.map +1 -0
  148. package/v1/types/protocol.d.ts +32 -0
  149. package/v1/types/protocol.js +3 -0
  150. package/v1/types/protocol.js.map +1 -0
  151. package/v1/types/transaction.d.ts +24 -0
  152. package/v1/types/transaction.js +3 -0
  153. package/v1/types/transaction.js.map +1 -0
  154. package/v1/utils/EthereumUtils.d.ts +13 -0
  155. package/v1/utils/EthereumUtils.js +140 -0
  156. package/v1/utils/EthereumUtils.js.map +1 -0
  157. package/v1/utils/key.d.ts +5 -0
  158. package/v1/utils/key.js +101 -0
  159. package/v1/utils/key.js.map +1 -0
@@ -0,0 +1,50 @@
1
+ {
2
+ "$ref": "#/definitions/UnsignedEthereumTransaction",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "HexString": {
6
+ "type": "string"
7
+ },
8
+ "UnsignedEthereumTransaction": {
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "callbackURL": {
12
+ "type": "string"
13
+ },
14
+ "publicKey": {
15
+ "type": "string"
16
+ },
17
+ "transaction": {
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "chainId": {
21
+ "type": "number"
22
+ },
23
+ "data": {
24
+ "$ref": "#/definitions/HexString"
25
+ },
26
+ "gasLimit": {
27
+ "$ref": "#/definitions/HexString"
28
+ },
29
+ "gasPrice": {
30
+ "$ref": "#/definitions/HexString"
31
+ },
32
+ "nonce": {
33
+ "$ref": "#/definitions/HexString"
34
+ },
35
+ "to": {
36
+ "$ref": "#/definitions/HexString"
37
+ },
38
+ "value": {
39
+ "$ref": "#/definitions/HexString"
40
+ }
41
+ },
42
+ "required": ["nonce", "gasPrice", "gasLimit", "to", "value", "chainId", "data"],
43
+ "type": "object"
44
+ }
45
+ },
46
+ "required": ["publicKey", "transaction"],
47
+ "type": "object"
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$ref": "#/definitions/SignedEthereumTransaction",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "SignedEthereumTransaction": {
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "accountIdentifier": {
9
+ "type": "string"
10
+ },
11
+ "transaction": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": ["accountIdentifier", "transaction"],
16
+ "type": "object"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$ref": "#/definitions/UnsignedTypedEthereumTransaction",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "HexString": {
6
+ "type": "string"
7
+ },
8
+ "UnsignedTypedEthereumTransaction": {
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "callbackURL": {
12
+ "type": "string"
13
+ },
14
+ "publicKey": {
15
+ "type": "string"
16
+ },
17
+ "transaction": {
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "derivationPath": {
21
+ "type": "string"
22
+ },
23
+ "masterFingerprint": {
24
+ "type": "string"
25
+ },
26
+ "serialized": {
27
+ "$ref": "#/definitions/HexString"
28
+ }
29
+ },
30
+ "required": ["serialized", "derivationPath", "masterFingerprint"],
31
+ "type": "object"
32
+ }
33
+ },
34
+ "required": ["publicKey", "transaction"],
35
+ "type": "object"
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "$ref": "#/definitions/UnsignedEthereumTransaction",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "HexString": {
6
+ "type": "string"
7
+ },
8
+ "UnsignedEthereumTransaction": {
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "callbackURL": {
12
+ "type": "string"
13
+ },
14
+ "publicKey": {
15
+ "type": "string"
16
+ },
17
+ "transaction": {
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "chainId": {
21
+ "type": "number"
22
+ },
23
+ "data": {
24
+ "$ref": "#/definitions/HexString"
25
+ },
26
+ "gasLimit": {
27
+ "$ref": "#/definitions/HexString"
28
+ },
29
+ "gasPrice": {
30
+ "$ref": "#/definitions/HexString"
31
+ },
32
+ "nonce": {
33
+ "$ref": "#/definitions/HexString"
34
+ },
35
+ "to": {
36
+ "$ref": "#/definitions/HexString"
37
+ },
38
+ "value": {
39
+ "$ref": "#/definitions/HexString"
40
+ }
41
+ },
42
+ "required": ["nonce", "gasPrice", "gasLimit", "to", "value", "chainId", "data"],
43
+ "type": "object"
44
+ }
45
+ },
46
+ "required": ["publicKey", "transaction"],
47
+ "type": "object"
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$ref": "#/definitions/SignedEthereumTransaction",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "SignedEthereumTransaction": {
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "accountIdentifier": {
9
+ "type": "string"
10
+ },
11
+ "transaction": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": ["accountIdentifier", "transaction"],
16
+ "type": "object"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ import { TransactionValidator, TransactionValidatorFactory, TransactionValidatorFactoryV2, TransactionValidatorV2 } from '@airgap/serializer';
2
+ import { SignedEthereumTransaction } from '../../types/signed-transaction-ethereum';
3
+ import { UnsignedEthereumTransaction } from '../../types/unsigned-transaction-ethereum';
4
+ export declare class EthereumTransactionValidator implements TransactionValidator, TransactionValidatorV2 {
5
+ private readonly version;
6
+ constructor(version?: 'v2' | 'v3');
7
+ validateUnsignedTransaction(unsignedTx: UnsignedEthereumTransaction): Promise<any>;
8
+ validateSignedTransaction(signedTx: SignedEthereumTransaction): any;
9
+ }
10
+ export declare class EthereumTransactionValidatorFactory implements TransactionValidatorFactory<EthereumTransactionValidator> {
11
+ create(): EthereumTransactionValidator;
12
+ }
13
+ export declare class EthereumTransactionValidatorFactoryV2 implements TransactionValidatorFactoryV2<EthereumTransactionValidator> {
14
+ create(): EthereumTransactionValidator;
15
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EthereumTransactionValidatorFactoryV2 = exports.EthereumTransactionValidatorFactory = exports.EthereumTransactionValidator = void 0;
4
+ // tslint:disable: max-classes-per-file
5
+ var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
6
+ var serializer_1 = require("@airgap/serializer");
7
+ var unsignedTransactionConstraints = {
8
+ nonce: {
9
+ presence: { allowEmpty: false },
10
+ type: 'String',
11
+ isHexStringWithPrefix: true
12
+ },
13
+ gasPrice: {
14
+ presence: { allowEmpty: false },
15
+ type: 'String',
16
+ isHexStringWithPrefix: true
17
+ },
18
+ gasLimit: {
19
+ presence: { allowEmpty: false },
20
+ type: 'String',
21
+ isHexStringWithPrefix: true
22
+ },
23
+ to: {
24
+ presence: { allowEmpty: false },
25
+ type: 'String',
26
+ isHexStringWithPrefix: true,
27
+ format: {
28
+ pattern: '^0x[a-fA-F0-9]{40}$',
29
+ flags: 'i',
30
+ message: 'is not a valid ethereum address'
31
+ }
32
+ },
33
+ value: {
34
+ presence: { allowEmpty: false },
35
+ type: 'String',
36
+ isHexStringWithPrefix: true
37
+ },
38
+ chainId: {
39
+ presence: { allowEmpty: false },
40
+ numericality: { noStrings: true, onlyInteger: true, greaterThanOrEqualTo: 0 }
41
+ },
42
+ data: {
43
+ presence: { allowEmpty: false },
44
+ type: 'String',
45
+ isHexStringWithPrefix: true
46
+ }
47
+ };
48
+ var signedTransactionConstraints = {
49
+ transaction: {
50
+ presence: { allowEmpty: false },
51
+ type: 'String',
52
+ isValidEthereumTransactionString: true
53
+ }
54
+ };
55
+ var success = function () { return undefined; };
56
+ var error = function (errors) { return errors; };
57
+ var EthereumTransactionValidator = /** @class */ (function () {
58
+ function EthereumTransactionValidator(version) {
59
+ if (version === void 0) { version = 'v3'; }
60
+ this.version = version;
61
+ }
62
+ EthereumTransactionValidator.prototype.validateUnsignedTransaction = function (unsignedTx) {
63
+ var rawTx = unsignedTx.transaction;
64
+ if (this.version === 'v3') {
65
+ (0, serializer_1.validateSyncScheme)({});
66
+ }
67
+ else {
68
+ (0, serializer_1.validateSyncSchemeV2)({});
69
+ }
70
+ return (0, validate_1.async)(rawTx, unsignedTransactionConstraints).then(success, error);
71
+ };
72
+ EthereumTransactionValidator.prototype.validateSignedTransaction = function (signedTx) {
73
+ return (0, validate_1.async)(signedTx, signedTransactionConstraints).then(success, error);
74
+ };
75
+ return EthereumTransactionValidator;
76
+ }());
77
+ exports.EthereumTransactionValidator = EthereumTransactionValidator;
78
+ var EthereumTransactionValidatorFactory = /** @class */ (function () {
79
+ function EthereumTransactionValidatorFactory() {
80
+ }
81
+ EthereumTransactionValidatorFactory.prototype.create = function () {
82
+ return new EthereumTransactionValidator('v3');
83
+ };
84
+ return EthereumTransactionValidatorFactory;
85
+ }());
86
+ exports.EthereumTransactionValidatorFactory = EthereumTransactionValidatorFactory;
87
+ var EthereumTransactionValidatorFactoryV2 = /** @class */ (function () {
88
+ function EthereumTransactionValidatorFactoryV2() {
89
+ }
90
+ EthereumTransactionValidatorFactoryV2.prototype.create = function () {
91
+ return new EthereumTransactionValidator('v2');
92
+ };
93
+ return EthereumTransactionValidatorFactoryV2;
94
+ }());
95
+ exports.EthereumTransactionValidatorFactoryV2 = EthereumTransactionValidatorFactoryV2;
96
+ //# sourceMappingURL=transaction-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../src/v0/serializer/validators/transaction-validator.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
40
+ var EthereumProtocol_1 = require("../../protocol/EthereumProtocol");
41
+ validate_1.validators.isValidEthereumTransactionString = function (transaction) {
42
+ // console.log(binaryTransaction)
43
+ return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
44
+ var signedTx, protocol, error_1;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0:
48
+ if (transaction === null || typeof transaction === 'undefined') {
49
+ reject('not a valid Ethereum transaction');
50
+ }
51
+ signedTx = {
52
+ accountIdentifier: '',
53
+ transaction: transaction
54
+ };
55
+ protocol = new EthereumProtocol_1.EthereumProtocol();
56
+ // allow empty values by default (needs to be checked by "presence" check)
57
+ if (transaction === null || typeof transaction === 'undefined') {
58
+ reject();
59
+ }
60
+ _a.label = 1;
61
+ case 1:
62
+ _a.trys.push([1, 3, , 4]);
63
+ return [4 /*yield*/, protocol.getTransactionDetailsFromSigned(signedTx)];
64
+ case 2:
65
+ _a.sent();
66
+ resolve();
67
+ return [3 /*break*/, 4];
68
+ case 3:
69
+ error_1 = _a.sent();
70
+ // console.log(error)
71
+ reject('not a valid Ethereum transaction');
72
+ return [3 /*break*/, 4];
73
+ case 4: return [2 /*return*/];
74
+ }
75
+ });
76
+ }); });
77
+ };
78
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../src/v0/serializer/validators/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA8F;AAE9F,oEAAkE;AAGlE,qBAAU,CAAC,gCAAgC,GAAG,UAAC,WAAmB;IAChE,iCAAiC;IACjC,OAAO,IAAI,OAAO,CAAO,UAAO,OAAO,EAAE,MAAM;;;;;oBAC7C,IAAI,WAAW,KAAK,IAAI,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;wBAC9D,MAAM,CAAC,kCAAkC,CAAC,CAAA;qBAC3C;oBACK,QAAQ,GAA8B;wBAC1C,iBAAiB,EAAE,EAAE;wBACrB,WAAW,aAAA;qBACZ,CAAA;oBACK,QAAQ,GAAG,IAAI,mCAAgB,EAAE,CAAA;oBACvC,0EAA0E;oBAC1E,IAAI,WAAW,KAAK,IAAI,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;wBAC9D,MAAM,EAAE,CAAA;qBACT;;;;oBAEC,qBAAM,QAAQ,CAAC,+BAA+B,CAAC,QAAQ,CAAC,EAAA;;oBAAxD,SAAwD,CAAA;oBACxD,OAAO,EAAE,CAAA;;;;oBAET,qBAAqB;oBACrB,MAAM,CAAC,kCAAkC,CAAC,CAAA;;;;;SAE7C,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { TransactionSignResponse, TransactionSignResponseV2 } from '@airgap/serializer';
2
+ export interface SignedEthereumTransaction extends TransactionSignResponse, TransactionSignResponseV2 {
3
+ accountIdentifier: string;
4
+ transaction: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=signed-transaction-ethereum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-transaction-ethereum.js","sourceRoot":"","sources":["../../../src/v0/types/signed-transaction-ethereum.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export interface RawEthereumTransaction {
2
+ nonce: string;
3
+ gasPrice: string;
4
+ gasLimit: string;
5
+ to: string;
6
+ value: string;
7
+ chainId: number;
8
+ data: string;
9
+ }
10
+ export interface RawTypedEthereumTransaction {
11
+ serialized: string;
12
+ derivationPath: string;
13
+ masterFingerprint: string;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=transaction-ethereum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-ethereum.js","sourceRoot":"","sources":["../../../src/v0/types/transaction-ethereum.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { TransactionSignRequest, TransactionSignRequestV2 } from '@airgap/serializer';
2
+ import { HexString } from '@airgap/serializer/v3/schemas/definitions/hex-string';
3
+ interface RawTypedEthereumTransaction {
4
+ serialized: HexString;
5
+ derivationPath: string;
6
+ masterFingerprint: string;
7
+ }
8
+ export interface UnsignedTypedEthereumTransaction extends TransactionSignRequest, TransactionSignRequestV2 {
9
+ transaction: RawTypedEthereumTransaction;
10
+ }
11
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unsigned-transaction-ethereum-typed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsigned-transaction-ethereum-typed.js","sourceRoot":"","sources":["../../../src/v0/types/unsigned-transaction-ethereum-typed.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { TransactionSignRequest, TransactionSignRequestV2 } from '@airgap/serializer';
2
+ import { HexString } from '@airgap/serializer/v3/schemas/definitions/hex-string';
3
+ interface RawEthereumTransaction {
4
+ nonce: HexString;
5
+ gasPrice: HexString;
6
+ gasLimit: HexString;
7
+ to: HexString;
8
+ value: HexString;
9
+ chainId: number;
10
+ data: HexString;
11
+ }
12
+ export interface UnsignedEthereumTransaction extends TransactionSignRequest, TransactionSignRequestV2 {
13
+ transaction: RawEthereumTransaction;
14
+ }
15
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unsigned-transaction-ethereum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsigned-transaction-ethereum.js","sourceRoot":"","sources":["../../../src/v0/types/unsigned-transaction-ethereum.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { AirGapBlockExplorer, BlockExplorerMetadata } from '@airgap/module-kit';
2
+ export declare class EtherscanBlockExplorer implements AirGapBlockExplorer {
3
+ private readonly url;
4
+ private readonly metadata;
5
+ constructor(url?: string);
6
+ getMetadata(): Promise<BlockExplorerMetadata>;
7
+ createAddressUrl(address: string): Promise<string>;
8
+ createTransactionUrl(transactionId: string): Promise<string>;
9
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.EtherscanBlockExplorer = void 0;
40
+ var BLOCK_EXPLORER_URL = 'https://etherscan.io';
41
+ var EtherscanBlockExplorer = /** @class */ (function () {
42
+ function EtherscanBlockExplorer(url) {
43
+ if (url === void 0) { url = BLOCK_EXPLORER_URL; }
44
+ this.url = url;
45
+ this.metadata = {
46
+ name: 'Etherscan',
47
+ url: this.url
48
+ };
49
+ }
50
+ EtherscanBlockExplorer.prototype.getMetadata = function () {
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ return __generator(this, function (_a) {
53
+ return [2 /*return*/, this.metadata];
54
+ });
55
+ });
56
+ };
57
+ EtherscanBlockExplorer.prototype.createAddressUrl = function (address) {
58
+ return __awaiter(this, void 0, void 0, function () {
59
+ return __generator(this, function (_a) {
60
+ return [2 /*return*/, "".concat(this.url, "/address/").concat(address)];
61
+ });
62
+ });
63
+ };
64
+ EtherscanBlockExplorer.prototype.createTransactionUrl = function (transactionId) {
65
+ return __awaiter(this, void 0, void 0, function () {
66
+ return __generator(this, function (_a) {
67
+ return [2 /*return*/, "".concat(this.url, "/tx/").concat(transactionId)];
68
+ });
69
+ });
70
+ };
71
+ return EtherscanBlockExplorer;
72
+ }());
73
+ exports.EtherscanBlockExplorer = EtherscanBlockExplorer;
74
+ //# sourceMappingURL=EtherscanBlockExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EtherscanBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/EtherscanBlockExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,kBAAkB,GAAW,sBAAsB,CAAA;AAEzD;IAME,gCAAoC,GAAgC;QAAhC,oBAAA,EAAA,wBAAgC;QAAhC,QAAG,GAAH,GAAG,CAA6B;QALnD,aAAQ,GAA0B;YACjD,IAAI,EAAE,WAAW;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IAEsE,CAAC;IAE3D,4CAAW,GAAxB;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,EAAA;;;KACrB;IAEY,iDAAgB,GAA7B,UAA8B,OAAe;;;gBAC3C,sBAAO,UAAG,IAAI,CAAC,GAAG,sBAAY,OAAO,CAAE,EAAA;;;KACxC;IAEY,qDAAoB,GAAjC,UAAkC,aAAqB;;;gBACrD,sBAAO,UAAG,IAAI,CAAC,GAAG,iBAAO,aAAa,CAAE,EAAA;;;KACzC;IACH,6BAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,wDAAsB"}
@@ -0,0 +1,7 @@
1
+ import { Secp256k1CryptoClient } from '@airgap/coinlib-core/protocols/Secp256k1CryptoClient';
2
+ export declare class EthereumCryptoClient extends Secp256k1CryptoClient {
3
+ signMessage(message: string, keypair: {
4
+ privateKey: string;
5
+ }): Promise<string>;
6
+ verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
7
+ }