@airgap/aeternity 0.13.11-beta.0 → 0.13.11-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -9
- package/airgap-coinlib-aeternity.min.js +0 -73688
- package/index.d.ts +0 -1
- package/index.js +0 -18
- package/index.js.map +0 -1
- package/v0/index.d.ts +0 -8
- package/v0/index.js +0 -24
- package/v0/index.js.map +0 -1
- package/v0/protocol/AeternityAddress.d.ts +0 -7
- package/v0/protocol/AeternityAddress.js +0 -42
- package/v0/protocol/AeternityAddress.js.map +0 -1
- package/v0/protocol/AeternityCryptoClient.d.ts +0 -8
- package/v0/protocol/AeternityCryptoClient.js +0 -95
- package/v0/protocol/AeternityCryptoClient.js.map +0 -1
- package/v0/protocol/AeternityProtocol.d.ts +0 -102
- package/v0/protocol/AeternityProtocol.js +0 -725
- package/v0/protocol/AeternityProtocol.js.map +0 -1
- package/v0/protocol/AeternityProtocolOptions.d.ts +0 -17
- package/v0/protocol/AeternityProtocolOptions.js +0 -109
- package/v0/protocol/AeternityProtocolOptions.js.map +0 -1
- package/v0/protocol/AeternityTypes.d.ts +0 -16
- package/v0/protocol/AeternityTypes.js +0 -3
- package/v0/protocol/AeternityTypes.js.map +0 -1
- package/v0/serializer/schemas/v2/transaction-sign-request-aeternity.json +0 -32
- package/v0/serializer/schemas/v2/transaction-sign-response-aeternity.json +0 -19
- package/v0/serializer/schemas/v3/transaction-sign-request-aeternity.json +0 -32
- package/v0/serializer/schemas/v3/transaction-sign-response-aeternity.json +0 -19
- package/v0/serializer/validators/transaction-validator.d.ts +0 -15
- package/v0/serializer/validators/transaction-validator.js +0 -116
- package/v0/serializer/validators/transaction-validator.js.map +0 -1
- package/v0/serializer/validators/validators.d.ts +0 -1
- package/v0/serializer/validators/validators.js +0 -103
- package/v0/serializer/validators/validators.js.map +0 -1
- package/v0/types/signed-transaction-aeternity.d.ts +0 -5
- package/v0/types/signed-transaction-aeternity.js +0 -3
- package/v0/types/signed-transaction-aeternity.js.map +0 -1
- package/v0/types/transaction-aeternity.d.ts +0 -4
- package/v0/types/transaction-aeternity.js +0 -3
- package/v0/types/transaction-aeternity.js.map +0 -1
- package/v0/types/unsigned-transaction-aeternity.d.ts +0 -9
- package/v0/types/unsigned-transaction-aeternity.js +0 -3
- package/v0/types/unsigned-transaction-aeternity.js.map +0 -1
- package/v1/block-explorer/AeternityBlockExplorer.d.ts +0 -9
- package/v1/block-explorer/AeternityBlockExplorer.js +0 -74
- package/v1/block-explorer/AeternityBlockExplorer.js.map +0 -1
- package/v1/data/AeternityAddress.d.ts +0 -8
- package/v1/data/AeternityAddress.js +0 -23
- package/v1/data/AeternityAddress.js.map +0 -1
- package/v1/index.d.ts +0 -12
- package/v1/index.js +0 -11
- package/v1/index.js.map +0 -1
- package/v1/module/AeternityModule.d.ts +0 -15
- package/v1/module/AeternityModule.js +0 -107
- package/v1/module/AeternityModule.js.map +0 -1
- package/v1/module.d.ts +0 -3
- package/v1/module.js +0 -24
- package/v1/module.js.map +0 -1
- package/v1/protocol/AeternityCryptoClient.d.ts +0 -8
- package/v1/protocol/AeternityCryptoClient.js +0 -95
- package/v1/protocol/AeternityCryptoClient.js.map +0 -1
- package/v1/protocol/AeternityProtocol.d.ts +0 -50
- package/v1/protocol/AeternityProtocol.js +0 -603
- package/v1/protocol/AeternityProtocol.js.map +0 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +0 -7
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +0 -37
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-aeternity.d.ts +0 -4
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-aeternity.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-aeternity.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-aeternity.d.ts +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-aeternity.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-aeternity.js.map +0 -1
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-aeternity.json +0 -32
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-aeternity.json +0 -19
- package/v1/serializer/v3/serializer-companion.d.ts +0 -14
- package/v1/serializer/v3/serializer-companion.js +0 -173
- package/v1/serializer/v3/serializer-companion.js.map +0 -1
- package/v1/serializer/v3/validators/transaction-validator.d.ts +0 -7
- package/v1/serializer/v3/validators/transaction-validator.js +0 -91
- package/v1/serializer/v3/validators/transaction-validator.js.map +0 -1
- package/v1/serializer/v3/validators/validators.d.ts +0 -5
- package/v1/serializer/v3/validators/validators.js +0 -106
- package/v1/serializer/v3/validators/validators.js.map +0 -1
- package/v1/types/protocol.d.ts +0 -8
- package/v1/types/protocol.js +0 -3
- package/v1/types/protocol.js.map +0 -1
- package/v1/types/transaction.d.ts +0 -11
- package/v1/types/transaction.js +0 -3
- package/v1/types/transaction.js.map +0 -1
- package/v1/utils/convert.d.ts +0 -3
- package/v1/utils/convert.js +0 -57
- package/v1/utils/convert.js.map +0 -1
- package/v1/utils/key.d.ts +0 -3
- package/v1/utils/key.js +0 -33
- package/v1/utils/key.js.map +0 -1
- package/v1/utils/signature.d.ts +0 -2
- package/v1/utils/signature.js +0 -24
- package/v1/utils/signature.js.map +0 -1
- package/v1/utils/transaction.d.ts +0 -3
- package/v1/utils/transaction.js +0 -56
- package/v1/utils/transaction.js.map +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.aeternityTransactionSignResponseToSigned = exports.aeternityTransactionSignRequestToUnsigned = exports.aeternitySignedTransactionToResponse = exports.aeternityUnsignedTransactionToRequest = void 0;
|
|
15
|
-
var module_kit_1 = require("@airgap/module-kit");
|
|
16
|
-
function aeternityUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
17
|
-
var _ = unsigned.type, rest = __rest(unsigned, ["type"]);
|
|
18
|
-
return {
|
|
19
|
-
transaction: rest,
|
|
20
|
-
publicKey: publicKey,
|
|
21
|
-
callbackURL: callbackUrl
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.aeternityUnsignedTransactionToRequest = aeternityUnsignedTransactionToRequest;
|
|
25
|
-
function aeternitySignedTransactionToResponse(signed, accountIdentifier) {
|
|
26
|
-
return { transaction: signed.transaction, accountIdentifier: accountIdentifier };
|
|
27
|
-
}
|
|
28
|
-
exports.aeternitySignedTransactionToResponse = aeternitySignedTransactionToResponse;
|
|
29
|
-
function aeternityTransactionSignRequestToUnsigned(request) {
|
|
30
|
-
return (0, module_kit_1.newUnsignedTransaction)(request.transaction);
|
|
31
|
-
}
|
|
32
|
-
exports.aeternityTransactionSignRequestToUnsigned = aeternityTransactionSignRequestToUnsigned;
|
|
33
|
-
function aeternityTransactionSignResponseToSigned(response) {
|
|
34
|
-
return (0, module_kit_1.newSignedTransaction)({ transaction: response.transaction });
|
|
35
|
-
}
|
|
36
|
-
exports.aeternityTransactionSignResponseToSigned = aeternityTransactionSignResponseToSigned;
|
|
37
|
-
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAAiF;AAKjF,SAAgB,qCAAqC,CACnD,QAAsC,EACtC,SAAiB,EACjB,WAAoB;IAEZ,IAAM,CAAC,GAAc,QAAQ,KAAtB,EAAK,IAAI,UAAK,QAAQ,EAA/B,QAAoB,CAAF,CAAa;IAErC,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,SAAS,WAAA;QACT,WAAW,EAAE,WAAW;KACzB,CAAA;AACH,CAAC;AAZD,sFAYC;AAED,SAAgB,oCAAoC,CAClD,MAAkC,EAClC,iBAAyB;IAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,iBAAiB,mBAAA,EAAE,CAAA;AAC/D,CAAC;AALD,oFAKC;AAED,SAAgB,yCAAyC,CAAC,OAAwC;IAChG,OAAO,IAAA,mCAAsB,EAA+B,OAAO,CAAC,WAAW,CAAC,CAAA;AAClF,CAAC;AAFD,8FAEC;AAED,SAAgB,wCAAwC,CAAC,QAA0C;IACjG,OAAO,IAAA,iCAAoB,EAA6B,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;AAChG,CAAC;AAFD,4FAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-sign-request-aeternity.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-aeternity.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-sign-response-aeternity.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-response-aeternity.ts"],"names":[],"mappings":""}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$ref": "#/definitions/AeternityTransactionSignRequest",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"definitions": {
|
|
5
|
-
"AeternityTransactionSignRequest": {
|
|
6
|
-
"additionalProperties": false,
|
|
7
|
-
"properties": {
|
|
8
|
-
"callbackURL": {
|
|
9
|
-
"type": "string"
|
|
10
|
-
},
|
|
11
|
-
"publicKey": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
"transaction": {
|
|
15
|
-
"additionalProperties": false,
|
|
16
|
-
"properties": {
|
|
17
|
-
"networkId": {
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"transaction": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"required": ["networkId", "transaction"],
|
|
25
|
-
"type": "object"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"required": ["publicKey", "transaction"],
|
|
29
|
-
"type": "object"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$ref": "#/definitions/AeternityTransactionSignResponse",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"definitions": {
|
|
5
|
-
"AeternityTransactionSignResponse": {
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@airgap/module-kit';
|
|
2
|
-
import { V3SchemaConfiguration } from '@airgap/module-kit/types/serializer';
|
|
3
|
-
import { TransactionSignRequest, TransactionSignResponse } from '@airgap/serializer';
|
|
4
|
-
export declare class AeternityV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
-
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
-
private readonly aeternityTransactionValidator;
|
|
7
|
-
constructor();
|
|
8
|
-
toTransactionSignRequest(identifier: string, unsignedTransaction: UnsignedTransaction, publicKey: string, callbackUrl?: string): Promise<TransactionSignRequest>;
|
|
9
|
-
fromTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<UnsignedTransaction>;
|
|
10
|
-
validateTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<boolean>;
|
|
11
|
-
toTransactionSignResponse(identifier: string, signedTransaction: SignedTransaction, accountIdentifier: string): Promise<TransactionSignResponse>;
|
|
12
|
-
fromTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<SignedTransaction>;
|
|
13
|
-
validateTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<boolean>;
|
|
14
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
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.AeternityV3SerializerCompanion = void 0;
|
|
40
|
-
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
-
var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
42
|
-
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
43
|
-
var serializer_1 = require("@airgap/serializer");
|
|
44
|
-
var transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
45
|
-
var transaction_validator_1 = require("./validators/transaction-validator");
|
|
46
|
-
var validators_1 = require("./validators/validators");
|
|
47
|
-
var aeternityTransactionSignRequest = require('./schemas/generated/transaction-sign-request-aeternity.json');
|
|
48
|
-
var aeternityTransactionSignResponse = require('./schemas/generated/transaction-sign-response-aeternity.json');
|
|
49
|
-
var AeternityV3SerializerCompanion = /** @class */ (function () {
|
|
50
|
-
function AeternityV3SerializerCompanion() {
|
|
51
|
-
this.schemas = [
|
|
52
|
-
{
|
|
53
|
-
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
54
|
-
schema: { schema: aeternityTransactionSignRequest },
|
|
55
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.AE
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
59
|
-
schema: { schema: aeternityTransactionSignResponse },
|
|
60
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.AE
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
this.aeternityTransactionValidator = new transaction_validator_1.AeternityTransactionValidator();
|
|
64
|
-
Object.keys(validators_1.aeternityValidators).forEach(function (key) {
|
|
65
|
-
validate_1.validators[key] = validators_1.aeternityValidators[key];
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
AeternityV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
switch (identifier) {
|
|
72
|
-
case coinlib_core_1.MainProtocolSymbols.AE:
|
|
73
|
-
return [2 /*return*/, (0, transaction_converter_1.aeternityUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
74
|
-
default:
|
|
75
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported"));
|
|
76
|
-
}
|
|
77
|
-
return [2 /*return*/];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
AeternityV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
return __generator(this, function (_a) {
|
|
84
|
-
switch (identifier) {
|
|
85
|
-
case coinlib_core_1.MainProtocolSymbols.AE:
|
|
86
|
-
return [2 /*return*/, (0, transaction_converter_1.aeternityTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
87
|
-
default:
|
|
88
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported"));
|
|
89
|
-
}
|
|
90
|
-
return [2 /*return*/];
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
AeternityV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
95
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
return __generator(this, function (_c) {
|
|
98
|
-
switch (_c.label) {
|
|
99
|
-
case 0:
|
|
100
|
-
_a = identifier;
|
|
101
|
-
switch (_a) {
|
|
102
|
-
case coinlib_core_1.MainProtocolSymbols.AE: return [3 /*break*/, 1];
|
|
103
|
-
}
|
|
104
|
-
return [3 /*break*/, 4];
|
|
105
|
-
case 1:
|
|
106
|
-
_c.trys.push([1, 3, , 4]);
|
|
107
|
-
return [4 /*yield*/, this.aeternityTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
108
|
-
case 2:
|
|
109
|
-
_c.sent();
|
|
110
|
-
return [2 /*return*/, true];
|
|
111
|
-
case 3:
|
|
112
|
-
_b = _c.sent();
|
|
113
|
-
return [2 /*return*/, false];
|
|
114
|
-
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported"));
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
AeternityV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
return __generator(this, function (_a) {
|
|
122
|
-
switch (identifier) {
|
|
123
|
-
case coinlib_core_1.MainProtocolSymbols.AE:
|
|
124
|
-
return [2 /*return*/, (0, transaction_converter_1.aeternitySignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
125
|
-
default:
|
|
126
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported"));
|
|
127
|
-
}
|
|
128
|
-
return [2 /*return*/];
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
AeternityV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
133
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
return __generator(this, function (_a) {
|
|
135
|
-
switch (identifier) {
|
|
136
|
-
case coinlib_core_1.MainProtocolSymbols.AE:
|
|
137
|
-
return [2 /*return*/, (0, transaction_converter_1.aeternityTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
138
|
-
default:
|
|
139
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported"));
|
|
140
|
-
}
|
|
141
|
-
return [2 /*return*/];
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
AeternityV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
147
|
-
var _a, _b;
|
|
148
|
-
return __generator(this, function (_c) {
|
|
149
|
-
switch (_c.label) {
|
|
150
|
-
case 0:
|
|
151
|
-
_a = identifier;
|
|
152
|
-
switch (_a) {
|
|
153
|
-
case coinlib_core_1.MainProtocolSymbols.AE: return [3 /*break*/, 1];
|
|
154
|
-
}
|
|
155
|
-
return [3 /*break*/, 4];
|
|
156
|
-
case 1:
|
|
157
|
-
_c.trys.push([1, 3, , 4]);
|
|
158
|
-
return [4 /*yield*/, this.aeternityTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
159
|
-
case 2:
|
|
160
|
-
_c.sent();
|
|
161
|
-
return [2 /*return*/, true];
|
|
162
|
-
case 3:
|
|
163
|
-
_b = _c.sent();
|
|
164
|
-
return [2 /*return*/, false];
|
|
165
|
-
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported"));
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
return AeternityV3SerializerCompanion;
|
|
171
|
-
}());
|
|
172
|
-
exports.AeternityV3SerializerCompanion = AeternityV3SerializerCompanion;
|
|
173
|
-
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,8FAA8F;AAC9F,sDAA8D;AAG9D,iDAAgH;AAIhH,mFAKkD;AAClD,4EAAkF;AAClF,sDAA6D;AAE7D,IAAM,+BAA+B,GAAe,OAAO,CAAC,6DAA6D,CAAC,CAAA;AAC1H,IAAM,gCAAgC,GAAe,OAAO,CAAC,8DAA8D,CAAC,CAAA;AAE5H;IAgBE;QAfgB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EA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;;;KAEzF;IACH,qCAAC;AAAD,CAAC,AAtGD,IAsGC;AAtGY,wEAA8B"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TransactionValidator } from '@airgap/serializer';
|
|
2
|
-
import { AeternityTransactionSignRequest } from '../schemas/definitions/transaction-sign-request-aeternity';
|
|
3
|
-
import { AeternityTransactionSignResponse } from '../schemas/definitions/transaction-sign-response-aeternity';
|
|
4
|
-
export declare class AeternityTransactionValidator implements TransactionValidator {
|
|
5
|
-
validateUnsignedTransaction(request: AeternityTransactionSignRequest): Promise<any>;
|
|
6
|
-
validateSignedTransaction(response: AeternityTransactionSignResponse): Promise<any>;
|
|
7
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
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.AeternityTransactionValidator = void 0;
|
|
40
|
-
// tslint:disable: max-classes-per-file
|
|
41
|
-
var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
42
|
-
var serializer_1 = require("@airgap/serializer");
|
|
43
|
-
var unsignedTransactionConstraints = {
|
|
44
|
-
transaction: {
|
|
45
|
-
presence: { allowEmpty: false },
|
|
46
|
-
type: 'String',
|
|
47
|
-
isValidAeternityTx: true
|
|
48
|
-
},
|
|
49
|
-
networkId: {
|
|
50
|
-
presence: { allowEmpty: false },
|
|
51
|
-
type: 'String',
|
|
52
|
-
isMainNet: true
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var signedTransactionConstraints = {
|
|
56
|
-
transaction: {
|
|
57
|
-
presence: { allowEmpty: false },
|
|
58
|
-
type: 'String',
|
|
59
|
-
isValidAeternityTx: true
|
|
60
|
-
},
|
|
61
|
-
accountIdentifier: {
|
|
62
|
-
presence: { allowEmpty: false },
|
|
63
|
-
type: 'String'
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var success = function () { return undefined; };
|
|
67
|
-
var error = function (errors) { return errors; };
|
|
68
|
-
var AeternityTransactionValidator = /** @class */ (function () {
|
|
69
|
-
function AeternityTransactionValidator() {
|
|
70
|
-
}
|
|
71
|
-
AeternityTransactionValidator.prototype.validateUnsignedTransaction = function (request) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var transaction;
|
|
74
|
-
return __generator(this, function (_a) {
|
|
75
|
-
transaction = request.transaction;
|
|
76
|
-
(0, serializer_1.validateSyncScheme)({});
|
|
77
|
-
return [2 /*return*/, (0, validate_1.async)(transaction, unsignedTransactionConstraints).then(success, error)];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
AeternityTransactionValidator.prototype.validateSignedTransaction = function (response) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
return __generator(this, function (_a) {
|
|
84
|
-
return [2 /*return*/, (0, validate_1.async)(response, signedTransactionConstraints).then(success, error)];
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
return AeternityTransactionValidator;
|
|
89
|
-
}());
|
|
90
|
-
exports.AeternityTransactionValidator = AeternityTransactionValidator;
|
|
91
|
-
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1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;IACH,oCAAC;AAAD,CAAC,AAVD,IAUC;AAVY,sEAA6B"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const aeternityValidators: {
|
|
2
|
-
isMainNet: (value: unknown) => "is not on mainnet" | null;
|
|
3
|
-
isValidAeternityTx: (transaction: unknown) => "invalid tx format" | "isn't base64 encoded" | "isn't a string" | null;
|
|
4
|
-
isValidAeternityAccount: (accountIdentifier: string) => Promise<void>;
|
|
5
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.aeternityValidators = void 0;
|
|
43
|
-
var base64Check_1 = __importDefault(require("@airgap/coinlib-core/utils/base64Check"));
|
|
44
|
-
var module_kit_1 = require("@airgap/module-kit");
|
|
45
|
-
var AeternityProtocol_1 = require("../../../protocol/AeternityProtocol");
|
|
46
|
-
exports.aeternityValidators = {
|
|
47
|
-
isMainNet: function (value) {
|
|
48
|
-
// allow empty values by default (needs to be checked by "presence" check)
|
|
49
|
-
if (value === null || typeof value === 'undefined') {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
if (value !== 'ae_mainnet') {
|
|
53
|
-
return 'is not on mainnet';
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
},
|
|
57
|
-
isValidAeternityTx: function (transaction) {
|
|
58
|
-
// allow empty values by default (needs to be checked by "presence" check)
|
|
59
|
-
if (transaction === null || typeof transaction === 'undefined') {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
if (typeof transaction === 'string' && !transaction.startsWith('tx_')) {
|
|
63
|
-
return 'invalid tx format';
|
|
64
|
-
}
|
|
65
|
-
else if (typeof transaction === 'string') {
|
|
66
|
-
try {
|
|
67
|
-
base64Check_1.default.decode(transaction.replace('tx_', ''));
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return "isn't base64 encoded";
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return "isn't a string";
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
isValidAeternityAccount: function (accountIdentifier) {
|
|
79
|
-
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var protocol, error_1;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
if (accountIdentifier === null || typeof accountIdentifier === 'undefined') {
|
|
85
|
-
reject();
|
|
86
|
-
}
|
|
87
|
-
_a.label = 1;
|
|
88
|
-
case 1:
|
|
89
|
-
_a.trys.push([1, 3, , 4]);
|
|
90
|
-
protocol = (0, AeternityProtocol_1.createAeternityProtocol)();
|
|
91
|
-
return [4 /*yield*/, protocol.getTransactionsForPublicKey((0, module_kit_1.newPublicKey)(accountIdentifier, 'hex'), 1)];
|
|
92
|
-
case 2:
|
|
93
|
-
_a.sent();
|
|
94
|
-
resolve();
|
|
95
|
-
return [3 /*break*/, 4];
|
|
96
|
-
case 3:
|
|
97
|
-
error_1 = _a.sent();
|
|
98
|
-
reject('not a valid Aeternity account');
|
|
99
|
-
return [3 /*break*/, 4];
|
|
100
|
-
case 4: return [2 /*return*/];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); });
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uFAA8D;AAC9D,iDAAiD;AAEjD,yEAA6E;AAEhE,QAAA,mBAAmB,GAAG;IACjC,SAAS,EAAE,UAAC,KAAc;QACxB,0EAA0E;QAC1E,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAClD,OAAO,IAAI,CAAA;SACZ;QACD,IAAI,KAAK,KAAK,YAAY,EAAE;YAC1B,OAAO,mBAAmB,CAAA;SAC3B;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kBAAkB,EAAE,UAAC,WAAoB;QACvC,0EAA0E;QAC1E,IAAI,WAAW,KAAK,IAAI,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;YAC9D,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;YACrE,OAAO,mBAAmB,CAAA;SAC3B;aAAM,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YAC1C,IAAI;gBACF,qBAAS,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAA;gBAEhD,OAAO,IAAI,CAAA;aACZ;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,sBAAsB,CAAA;aAC9B;SACF;aAAM;YACL,OAAO,gBAAgB,CAAA;SACxB;IACH,CAAC;IAED,uBAAuB,EAAE,UAAC,iBAAyB;QACjD,OAAO,IAAI,OAAO,CAAO,UAAO,OAAO,EAAE,MAAM;;;;;wBAC7C,IAAI,iBAAiB,KAAK,IAAI,IAAI,OAAO,iBAAiB,KAAK,WAAW,EAAE;4BAC1E,MAAM,EAAE,CAAA;yBACT;;;;wBAEO,QAAQ,GAAG,IAAA,2CAAuB,GAAE,CAAA;wBAC1C,qBAAM,QAAQ,CAAC,2BAA2B,CAAC,IAAA,yBAAY,EAAC,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,EAAA;;wBAArF,SAAqF,CAAA;wBACrF,OAAO,EAAE,CAAA;;;;wBAET,MAAM,CAAC,+BAA+B,CAAC,CAAA;;;;;aAE1C,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
package/v1/types/protocol.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
-
export declare type AeternityUnits = 'AE';
|
|
3
|
-
export interface AeternityProtocolNetwork extends ProtocolNetwork {
|
|
4
|
-
feesUrl: string;
|
|
5
|
-
}
|
|
6
|
-
export interface AeternityProtocolOptions {
|
|
7
|
-
network: AeternityProtocolNetwork;
|
|
8
|
-
}
|
package/v1/types/protocol.js
DELETED
package/v1/types/protocol.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SignedTransaction, TransactionCursor, UnsignedTransaction } from '@airgap/module-kit';
|
|
2
|
-
export interface AeternityUnsignedTransaction extends UnsignedTransaction {
|
|
3
|
-
networkId: string;
|
|
4
|
-
transaction: string;
|
|
5
|
-
}
|
|
6
|
-
export interface AeternitySignedTransaction extends SignedTransaction {
|
|
7
|
-
transaction: string;
|
|
8
|
-
}
|
|
9
|
-
export interface AeternityTransactionCursor extends TransactionCursor {
|
|
10
|
-
next: string;
|
|
11
|
-
}
|
package/v1/types/transaction.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/types/transaction.ts"],"names":[],"mappings":""}
|
package/v1/utils/convert.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { BytesStringFormat } from '@airgap/module-kit';
|
|
2
|
-
export declare function convertEncodedBytesString(prefix: string, encoded: string, targetFormat: BytesStringFormat): string;
|
|
3
|
-
export declare function convertHexBytesString(prefix: string, hex: string, targetFormat: BytesStringFormat): string;
|