@wallfree-dev/stellar 0.13.42
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/LICENSE.md +7 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +65 -0
- package/readme.md +121 -0
- package/v1/block-explorer/StellarBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/StellarBlockExplorer.js +72 -0
- package/v1/block-explorer/StellarBlockExplorer.js.map +1 -0
- package/v1/data/StellarAddress.d.ts +8 -0
- package/v1/data/StellarAddress.js +27 -0
- package/v1/data/StellarAddress.js.map +1 -0
- package/v1/index.d.ts +14 -0
- package/v1/index.js +13 -0
- package/v1/index.js.map +1 -0
- package/v1/module/StellarAssets.d.ts +3 -0
- package/v1/module/StellarAssets.js +47 -0
- package/v1/module/StellarAssets.js.map +1 -0
- package/v1/module/StellarModule.d.ts +14 -0
- package/v1/module/StellarModule.js +124 -0
- package/v1/module/StellarModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/protocol/StellarProtocol.d.ts +65 -0
- package/v1/protocol/StellarProtocol.js +956 -0
- package/v1/protocol/StellarProtocol.js.map +1 -0
- package/v1/protocol/stellarAssets/StellarAsset.d.ts +18 -0
- package/v1/protocol/stellarAssets/StellarAsset.js +498 -0
- package/v1/protocol/stellarAssets/StellarAsset.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +42 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-stellar.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-stellar.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-stellar.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-stellar.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-stellar.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-stellar.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-stellar.json +29 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-stellar.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +14 -0
- package/v1/serializer/v3/serializer-companion.js +168 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validator.js +89 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +6 -0
- package/v1/serializer/v3/validators/validators.js +91 -0
- package/v1/serializer/v3/validators/validators.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +42 -0
- package/v1/types/protocol.js +22 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +10 -0
- package/v1/types/transaction.js +6 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/convert.d.ts +3 -0
- package/v1/utils/convert.js +32 -0
- package/v1/utils/convert.js.map +1 -0
- package/v1/utils/key.d.ts +3 -0
- package/v1/utils/key.js +37 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/signature.d.ts +2 -0
- package/v1/utils/signature.js +22 -0
- package/v1/utils/signature.js.map +1 -0
- package/v1/utils/transaction.d.ts +3 -0
- package/v1/utils/transaction.js +22 -0
- package/v1/utils/transaction.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuF;AAMvF,SAAgB,mCAAmC,CACjD,QAAoC,EACpC,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,kFAYC;AAED,SAAgB,kCAAkC,CAChD,MAAgC,EAChC,iBAAyB;IAEzB,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,iBAAiB,mBAAA;KAClB,CAAA;AACH,CAAC;AARD,gFAQC;AAED,SAAgB,uCAAuC,CAAC,OAAsC;IAC5F,OAAO,IAAA,mCAAsB,EAA6B,OAAO,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC;AAFD,0FAEC;AAED,SAAgB,sCAAsC,CAAC,QAAwC;IAC7F,OAAO,IAAA,iCAAoB,EAA2B;QACpD,WAAW,EAAE,QAAQ,CAAC,WAAW;KAClC,CAAC,CAAA;AACJ,CAAC;AAJD,wFAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-request-stellar.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-stellar.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-response-stellar.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-response-stellar.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/StellarTransactionSignRequest",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"StellarTransactionSignRequest": {
|
|
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
|
+
"transaction": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["transaction"],
|
|
22
|
+
"type": "object"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": ["publicKey", "transaction"],
|
|
26
|
+
"type": "object"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/StellarTransactionSignResponse",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"StellarTransactionSignResponse": {
|
|
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,14 @@
|
|
|
1
|
+
import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@wallfree-dev/module-kit';
|
|
2
|
+
import { TransactionSignRequest, TransactionSignResponse } from '@wallfree-dev/serializer';
|
|
3
|
+
import { V3SchemaConfiguration } from '@wallfree-dev/module-kit/types/serializer';
|
|
4
|
+
export declare class StellarV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
+
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
+
private readonly stellarTransactionValidator;
|
|
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
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
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.StellarV3SerializerCompanion = void 0;
|
|
40
|
+
var validate_1 = require("@wallfree-dev/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
41
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
42
|
+
var errors_1 = require("@wallfree-dev/coinlib-core/errors");
|
|
43
|
+
var serializer_1 = require("@wallfree-dev/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
|
+
// import { StellarTransactionSignRequest } from './schemas/definitions/transaction-sign-request-stellar'
|
|
48
|
+
// import { StellarTransactionSignResponse } from './schemas/definitions/transaction-sign-response-stellar'
|
|
49
|
+
var stellarTransactionSignRequestSchema = require('./schemas/generated/transaction-sign-request-stellar.json');
|
|
50
|
+
var stellarTransactionSignResponseSchema = require('./schemas/generated/transaction-sign-response-stellar.json');
|
|
51
|
+
var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
52
|
+
function StellarV3SerializerCompanion() {
|
|
53
|
+
this.schemas = [
|
|
54
|
+
{
|
|
55
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
56
|
+
schema: { schema: stellarTransactionSignRequestSchema },
|
|
57
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.STELLAR
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
61
|
+
schema: { schema: stellarTransactionSignResponseSchema },
|
|
62
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.STELLAR
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
66
|
+
schema: { schema: stellarTransactionSignRequestSchema },
|
|
67
|
+
protocolIdentifier: coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
71
|
+
schema: { schema: stellarTransactionSignResponseSchema },
|
|
72
|
+
protocolIdentifier: coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
this.stellarTransactionValidator = new transaction_validator_1.StellarTransactionValidator();
|
|
76
|
+
// Register custom validators globally
|
|
77
|
+
Object.keys(validators_1.stellarValidators).forEach(function (key) {
|
|
78
|
+
validate_1.validators[key] = validators_1.stellarValidators[key];
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
StellarV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
85
|
+
return [2 /*return*/, (0, transaction_converter_1.stellarUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
86
|
+
}
|
|
87
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
StellarV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
95
|
+
return [2 /*return*/, (0, transaction_converter_1.stellarTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
96
|
+
}
|
|
97
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
StellarV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
var _a;
|
|
104
|
+
return __generator(this, function (_b) {
|
|
105
|
+
switch (_b.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET)) return [3 /*break*/, 4];
|
|
108
|
+
_b.label = 1;
|
|
109
|
+
case 1:
|
|
110
|
+
_b.trys.push([1, 3, , 4]);
|
|
111
|
+
return [4 /*yield*/, this.stellarTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
112
|
+
case 2:
|
|
113
|
+
_b.sent();
|
|
114
|
+
return [2 /*return*/, true];
|
|
115
|
+
case 3:
|
|
116
|
+
_a = _b.sent();
|
|
117
|
+
return [2 /*return*/, false];
|
|
118
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
StellarV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
+
return __generator(this, function (_a) {
|
|
126
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
127
|
+
return [2 /*return*/, (0, transaction_converter_1.stellarSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
128
|
+
}
|
|
129
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
StellarV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
137
|
+
return [2 /*return*/, (0, transaction_converter_1.stellarTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
138
|
+
}
|
|
139
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
StellarV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
+
var _a;
|
|
146
|
+
return __generator(this, function (_b) {
|
|
147
|
+
switch (_b.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET)) return [3 /*break*/, 4];
|
|
150
|
+
_b.label = 1;
|
|
151
|
+
case 1:
|
|
152
|
+
_b.trys.push([1, 3, , 4]);
|
|
153
|
+
return [4 /*yield*/, this.stellarTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
154
|
+
case 2:
|
|
155
|
+
_b.sent();
|
|
156
|
+
return [2 /*return*/, true];
|
|
157
|
+
case 3:
|
|
158
|
+
_a = _b.sent();
|
|
159
|
+
return [2 /*return*/, false];
|
|
160
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
return StellarV3SerializerCompanion;
|
|
166
|
+
}());
|
|
167
|
+
exports.StellarV3SerializerCompanion = StellarV3SerializerCompanion;
|
|
168
|
+
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG,2DAA4F;AAC5F,4DAAoE;AAEpE,uDAA0G;AAG1G,mFAKkD;AAClD,4EAAgF;AAChF,sDAA2D;AAE3D,yGAAyG;AACzG,2GAA2G;AAE3G,IAAM,mCAAmC,GAAQ,OAAO,CAAC,2DAA2D,CAAC,CAAA;AACrH,IAAM,oCAAoC,GAAQ,OAAO,CAAC,4DAA4D,CAAC,CAAA;AAEvH;IA0BE;QAzBgB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;gBACvD,kBAAkB,EAAE,kCAAmB,CAAC,OAAO;aAChD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,oCAAoC,EAAE;gBACxD,kBAAkB,EAAE,kCAAmB,CAAC,OAAO;aAChD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;gBACvD,kBAAkB,EAAE,iCAAkB,CAAC,aAAa;aACrD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,oCAAoC,EAAE;gBACxD,kBAAkB,EAAE,iCAAkB,CAAC,aAAa;aACrD;SACF,CAAA;QAEgB,gCAA2B,GAAG,IAAI,mDAA2B,EAAE,CAAA;QAG9E,sCAAsC;QACtC,MAAM,CAAC,IAAI,CAAC,8BAAiB,CAAC,CAAC,OAAO,CAAC,UAAC,GAAW;YACjD,qBAAU,CAAC,GAAG,CAAC,GAAG,8BAAiB,CAAC,GAAG,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;IACJ,CAAC;IAEY,+DAAwB,GAArC,UACE,UAAkB,EAClB,mBAAwC,EACxC,SAAiB,EACjB,WAAoB;;;gBAEpB,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,EAAE;oBAClF,sBAAO,IAAA,2DAAmC,EAAC,mBAA0B,EAAE,SAAS,EAAE,WAAW,CAAC,EAAA;iBAC/F;gBAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;KACnF;IAEY,iEAA0B,GAAvC,UACE,UAAkB,EAClB,sBAA8C;;;gBAE9C,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,EAAE;oBAClF,sBAAO,IAAA,+DAAuC,EAAC,sBAAsB,CAAC,EAAA;iBACvE;gBAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;KACnF;IAEY,qEAA8B,GAA3C,UAA4C,UAAkB,EAAE,sBAA8C;;;;;;6BACxG,CAAA,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,CAAA,EAA9E,wBAA8E;;;;wBAE9E,qBAAM,IAAI,CAAC,2BAA2B,CAAC,2BAA2B,CAAC,sBAAsB,CAAC,EAAA;;wBAA1F,SAA0F,CAAA;wBAC1F,sBAAO,IAAI,EAAA;;;wBAEX,sBAAO,KAAK,EAAA;4BAIhB,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;;KACnF;IAEY,gEAAyB,GAAtC,UACE,UAAkB,EAClB,iBAAoC,EACpC,iBAAyB;;;gBAEzB,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,EAAE;oBAClF,sBAAO,IAAA,0DAAkC,EAAC,iBAAwB,EAAE,iBAAiB,CAAC,EAAA;iBACvF;gBAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;KACnF;IAEY,kEAA2B,GAAxC,UACE,UAAkB,EAClB,uBAAgD;;;gBAEhD,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,EAAE;oBAClF,sBAAO,IAAA,8DAAsC,EAAC,uBAAuB,CAAC,EAAA;iBACvE;gBAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;KACnF;IAEY,sEAA+B,GAA5C,UAA6C,UAAkB,EAAE,uBAAgD;;;;;;6BAC3G,CAAA,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,CAAA,EAA9E,wBAA8E;;;;wBAE9E,qBAAM,IAAI,CAAC,2BAA2B,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,EAAA;;wBAAzF,SAAyF,CAAA;wBACzF,sBAAO,IAAI,EAAA;;;wBAEX,sBAAO,KAAK,EAAA;4BAIhB,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;;KACnF;IACH,mCAAC;AAAD,CAAC,AAzGD,IAyGC;AAzGY,oEAA4B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TransactionValidator } from '@wallfree-dev/serializer';
|
|
2
|
+
import { StellarTransactionSignRequest } from '../schemas/definitions/transaction-sign-request-stellar';
|
|
3
|
+
import { StellarTransactionSignResponse } from '../schemas/definitions/transaction-sign-response-stellar';
|
|
4
|
+
export declare class StellarTransactionValidator implements TransactionValidator {
|
|
5
|
+
validateUnsignedTransaction(request: StellarTransactionSignRequest): Promise<any>;
|
|
6
|
+
validateSignedTransaction(response: StellarTransactionSignResponse): Promise<any>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.StellarTransactionValidator = void 0;
|
|
40
|
+
var validate_1 = require("@wallfree-dev/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
41
|
+
var serializer_1 = require("@wallfree-dev/serializer");
|
|
42
|
+
var unsignedTransactionConstraints = {
|
|
43
|
+
transaction: {
|
|
44
|
+
presence: { allowEmpty: false },
|
|
45
|
+
type: 'Object',
|
|
46
|
+
isValidStellarTx: true
|
|
47
|
+
},
|
|
48
|
+
networkId: {
|
|
49
|
+
presence: { allowEmpty: false },
|
|
50
|
+
type: 'String',
|
|
51
|
+
isStellarNetworkId: true
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var signedTransactionConstraints = {
|
|
55
|
+
transaction: {
|
|
56
|
+
presence: { allowEmpty: false },
|
|
57
|
+
type: 'String',
|
|
58
|
+
isValidStellarTx: true
|
|
59
|
+
},
|
|
60
|
+
accountIdentifier: {
|
|
61
|
+
presence: { allowEmpty: false },
|
|
62
|
+
type: 'String',
|
|
63
|
+
isStellarAddress: true
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var success = function () { return undefined; };
|
|
67
|
+
var error = function (errors) { return errors; };
|
|
68
|
+
var StellarTransactionValidator = /** @class */ (function () {
|
|
69
|
+
function StellarTransactionValidator() {
|
|
70
|
+
}
|
|
71
|
+
StellarTransactionValidator.prototype.validateUnsignedTransaction = function (request) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
(0, serializer_1.validateSyncScheme)({});
|
|
75
|
+
return [2 /*return*/, (0, validate_1.async)(request, unsignedTransactionConstraints).then(success, error)];
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
StellarTransactionValidator.prototype.validateSignedTransaction = function (response) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
return [2 /*return*/, (0, validate_1.async)(response, signedTransactionConstraints).then(success, error)];
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return StellarTransactionValidator;
|
|
87
|
+
}());
|
|
88
|
+
exports.StellarTransactionValidator = StellarTransactionValidator;
|
|
89
|
+
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oGAA+F;AAC/F,uDAAmF;AAKnF,IAAM,8BAA8B,GAAG;IACrC,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,IAAI,EAAE,QAAQ;QACd,gBAAgB,EAAE,IAAI;KACvB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,IAAI,EAAE,QAAQ;QACd,kBAAkB,EAAE,IAAI;KACzB;CACF,CAAA;AAED,IAAM,4BAA4B,GAAG;IACnC,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,IAAI,EAAE,QAAQ;QACd,gBAAgB,EAAE,IAAI;KACvB;IACD,iBAAiB,EAAE;QACjB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,IAAI,EAAE,QAAQ;QACd,gBAAgB,EAAE,IAAI;KACvB;CACF,CAAA;AAED,IAAM,OAAO,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAA;AAC/B,IAAM,KAAK,GAAG,UAAC,MAAW,IAAK,OAAA,MAAM,EAAN,CAAM,CAAA;AAErC;IAAA;IASA,CAAC;IARc,iEAA2B,GAAxC,UAAyC,OAAsC;;;gBAC7E,IAAA,+BAAkB,EAAC,EAAE,CAAC,CAAA;gBACtB,sBAAO,IAAA,gBAAK,EAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAA;;;KAC3E;IAEY,+DAAyB,GAAtC,UAAuC,QAAwC;;;gBAC7E,sBAAO,IAAA,gBAAK,EAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAA;;;KAC1E;IACH,kCAAC;AAAD,CAAC,AATD,IASC;AATY,kEAA2B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const stellarValidators: {
|
|
2
|
+
isStellarNetworkId: (value: unknown) => "is not a valid Stellar mainnet network ID" | null;
|
|
3
|
+
isValidStellarTx: (transaction: unknown) => "is not a valid Stellar transaction XDR" | null;
|
|
4
|
+
isStellarAddress: (address: unknown) => "is not a valid Stellar address" | null;
|
|
5
|
+
isValidStellarAccount: (address: string) => Promise<"not a valid or reachable Stellar account" | null>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
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.stellarValidators = void 0;
|
|
40
|
+
var stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
41
|
+
var StellarProtocol_1 = require("../../../protocol/StellarProtocol");
|
|
42
|
+
var module_kit_1 = require("@wallfree-dev/module-kit");
|
|
43
|
+
exports.stellarValidators = {
|
|
44
|
+
isStellarNetworkId: function (value) {
|
|
45
|
+
if (value === null || typeof value === 'undefined') {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (value !== stellar_sdk_1.Networks.PUBLIC) {
|
|
49
|
+
return 'is not a valid Stellar mainnet network ID';
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
},
|
|
53
|
+
isValidStellarTx: function (transaction) {
|
|
54
|
+
if (transaction === null || typeof transaction === 'undefined') {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
var xdr = typeof transaction === 'string' ? transaction : transaction.transaction;
|
|
59
|
+
stellar_sdk_1.TransactionBuilder.fromXDR(xdr, stellar_sdk_1.Networks.PUBLIC);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
catch (_a) {
|
|
63
|
+
return 'is not a valid Stellar transaction XDR';
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
isStellarAddress: function (address) {
|
|
67
|
+
if (typeof address !== 'string' || !stellar_sdk_1.StrKey.isValidEd25519PublicKey(address)) {
|
|
68
|
+
return 'is not a valid Stellar address';
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
},
|
|
72
|
+
isValidStellarAccount: function (address) { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var protocol, _a;
|
|
74
|
+
return __generator(this, function (_b) {
|
|
75
|
+
switch (_b.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
_b.trys.push([0, 2, , 3]);
|
|
78
|
+
protocol = (0, StellarProtocol_1.createStellarProtocol)();
|
|
79
|
+
return [4 /*yield*/, protocol.getTransactionsForPublicKey((0, module_kit_1.newPublicKey)(address, 'encoded'), 1)];
|
|
80
|
+
case 1:
|
|
81
|
+
_b.sent();
|
|
82
|
+
return [2 /*return*/, null];
|
|
83
|
+
case 2:
|
|
84
|
+
_a = _b.sent();
|
|
85
|
+
return [2 /*return*/, 'not a valid or reachable Stellar account'];
|
|
86
|
+
case 3: return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}); }
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2E;AAC3E,qEAAyE;AACzE,uDAAuD;AAE1C,QAAA,iBAAiB,GAAG;IAC/B,kBAAkB,EAAE,UAAC,KAAc;QACjC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAClD,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,KAAK,KAAK,sBAAQ,CAAC,MAAM,EAAE;YAC7B,OAAO,2CAA2C,CAAA;SACnD;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gBAAgB,EAAE,UAAC,WAAoB;QACrC,IAAI,WAAW,KAAK,IAAI,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;YAC9D,OAAO,IAAI,CAAA;SACZ;QAED,IAAI;YACF,IAAM,GAAG,GAAG,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAE,WAAuC,CAAC,WAAW,CAAA;YAChH,gCAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,sBAAQ,CAAC,MAAM,CAAC,CAAA;YAChD,OAAO,IAAI,CAAA;SACZ;QAAC,WAAM;YACN,OAAO,wCAAwC,CAAA;SAChD;IACH,CAAC;IAED,gBAAgB,EAAE,UAAC,OAAgB;QACjC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,oBAAM,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE;YAC3E,OAAO,gCAAgC,CAAA;SACxC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,qBAAqB,EAAE,UAAO,OAAe;;;;;;oBAEnC,QAAQ,GAAG,IAAA,uCAAqB,GAAE,CAAA;oBACxC,qBAAM,QAAQ,CAAC,2BAA2B,CAAC,IAAA,yBAAY,EAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAA;;oBAA/E,SAA+E,CAAA;oBAC/E,sBAAO,IAAI,EAAA;;;oBAEX,sBAAO,0CAA0C,EAAA;;;;SAEpD;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/v1/types/crypto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ProtocolNetwork } from '@wallfree-dev/module-kit';
|
|
2
|
+
export declare type StellarUnits = 'XLM';
|
|
3
|
+
export interface StellarProtocolNetwork extends ProtocolNetwork {
|
|
4
|
+
}
|
|
5
|
+
export interface StellarProtocolOptions {
|
|
6
|
+
network: StellarProtocolNetwork;
|
|
7
|
+
}
|
|
8
|
+
export declare type StellarAssetUnit = StellarAssetMetadata['assetCode'];
|
|
9
|
+
export interface StellarAssetMetadata {
|
|
10
|
+
name: string;
|
|
11
|
+
assetCode: string;
|
|
12
|
+
marketSymbol: string;
|
|
13
|
+
issuer: string;
|
|
14
|
+
decimals: number;
|
|
15
|
+
identifier: string;
|
|
16
|
+
}
|
|
17
|
+
export interface StellarSigner {
|
|
18
|
+
weight: number;
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StellarThresholds {
|
|
23
|
+
low_threshold: number;
|
|
24
|
+
med_threshold: number;
|
|
25
|
+
high_threshold: number;
|
|
26
|
+
}
|
|
27
|
+
export declare enum StellarAssetType {
|
|
28
|
+
NATIVE = "native",
|
|
29
|
+
ASSET = "asset",
|
|
30
|
+
XLM = "XLM"
|
|
31
|
+
}
|
|
32
|
+
export declare enum StellarTransactionType {
|
|
33
|
+
PAYMENT = "payment",
|
|
34
|
+
CREATE_ACCOUNT = "createAccount",
|
|
35
|
+
PATH_PAYMENT_RECIEVE = "pathPaymentStrictReceive",
|
|
36
|
+
PATH_PAYMENT_SEND = "pathPaymentStrictSend",
|
|
37
|
+
CHANGE_TRUST = "changeTrust",
|
|
38
|
+
INOKE_HOST_FUNCTION = "invokeHostFunction",
|
|
39
|
+
LIQUIDITY_POOL_DEPOSIT = "liquidityPoolDeposit",
|
|
40
|
+
LIQUIDITY_POOL_WITHDRAW = "liquidityPoolWithdraw",
|
|
41
|
+
SET_OPTIONS = "setOptions"
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StellarTransactionType = exports.StellarAssetType = void 0;
|
|
4
|
+
var StellarAssetType;
|
|
5
|
+
(function (StellarAssetType) {
|
|
6
|
+
StellarAssetType["NATIVE"] = "native";
|
|
7
|
+
StellarAssetType["ASSET"] = "asset";
|
|
8
|
+
StellarAssetType["XLM"] = "XLM";
|
|
9
|
+
})(StellarAssetType = exports.StellarAssetType || (exports.StellarAssetType = {}));
|
|
10
|
+
var StellarTransactionType;
|
|
11
|
+
(function (StellarTransactionType) {
|
|
12
|
+
StellarTransactionType["PAYMENT"] = "payment";
|
|
13
|
+
StellarTransactionType["CREATE_ACCOUNT"] = "createAccount";
|
|
14
|
+
StellarTransactionType["PATH_PAYMENT_RECIEVE"] = "pathPaymentStrictReceive";
|
|
15
|
+
StellarTransactionType["PATH_PAYMENT_SEND"] = "pathPaymentStrictSend";
|
|
16
|
+
StellarTransactionType["CHANGE_TRUST"] = "changeTrust";
|
|
17
|
+
StellarTransactionType["INOKE_HOST_FUNCTION"] = "invokeHostFunction";
|
|
18
|
+
StellarTransactionType["LIQUIDITY_POOL_DEPOSIT"] = "liquidityPoolDeposit";
|
|
19
|
+
StellarTransactionType["LIQUIDITY_POOL_WITHDRAW"] = "liquidityPoolWithdraw";
|
|
20
|
+
StellarTransactionType["SET_OPTIONS"] = "setOptions";
|
|
21
|
+
})(StellarTransactionType = exports.StellarTransactionType || (exports.StellarTransactionType = {}));
|
|
22
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":";;;AAiCA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,mCAAe,CAAA;IACf,+BAAW,CAAA;AACb,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,0DAAgC,CAAA;IAChC,2EAAiD,CAAA;IACjD,qEAA2C,CAAA;IAC3C,sDAA4B,CAAA;IAC5B,oEAA0C,CAAA;IAC1C,yEAA+C,CAAA;IAC/C,2EAAiD,CAAA;IACjD,oDAA0B,CAAA;AAC5B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SignedTransaction, TransactionCursor, UnsignedTransaction } from '@wallfree-dev/module-kit';
|
|
2
|
+
export interface StellarUnsignedTransaction extends UnsignedTransaction {
|
|
3
|
+
transaction: string;
|
|
4
|
+
}
|
|
5
|
+
export interface StellarSignedTransaction extends SignedTransaction {
|
|
6
|
+
transaction: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StellarTransactionCursor extends TransactionCursor {
|
|
9
|
+
next: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/types/transaction.ts"],"names":[],"mappings":";;AAcA,wCAAwC;AACxC,oBAAoB;AACpB,IAAI"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertHexBytesString = exports.convertEncodedBytesString = void 0;
|
|
4
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
5
|
+
var errors_1 = require("@wallfree-dev/coinlib-core/errors");
|
|
6
|
+
var stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
7
|
+
function convertEncodedBytesString(encoded, targetFormat) {
|
|
8
|
+
switch (targetFormat) {
|
|
9
|
+
case 'encoded':
|
|
10
|
+
return encoded;
|
|
11
|
+
case 'hex':
|
|
12
|
+
var rawBytes = stellar_sdk_1.StrKey.decodeEd25519PublicKey(encoded);
|
|
13
|
+
return Buffer.from(rawBytes).toString('hex');
|
|
14
|
+
default:
|
|
15
|
+
(0, coinlib_core_1.assertNever)(targetFormat);
|
|
16
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, 'Unsupported bytes string format.');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.convertEncodedBytesString = convertEncodedBytesString;
|
|
20
|
+
function convertHexBytesString(hex, targetFormat) {
|
|
21
|
+
switch (targetFormat) {
|
|
22
|
+
case 'hex':
|
|
23
|
+
return hex;
|
|
24
|
+
case 'encoded':
|
|
25
|
+
return stellar_sdk_1.StrKey.encodeEd25519PublicKey(Buffer.from(hex, 'hex'));
|
|
26
|
+
default:
|
|
27
|
+
(0, coinlib_core_1.assertNever)(targetFormat);
|
|
28
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, 'Unsupported bytes string format.');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.convertHexBytesString = convertHexBytesString;
|
|
32
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/v1/utils/convert.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAChE,4DAAoE;AAEpE,oDAA6C;AAE7C,SAAgB,yBAAyB,CAAC,OAAe,EAAE,YAA+B;IACxF,QAAQ,YAAY,EAAE;QACpB,KAAK,SAAS;YACZ,OAAO,OAAO,CAAA;QAChB,KAAK,KAAK;YACR,IAAM,QAAQ,GAAG,oBAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAA;YACvD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9C;YACE,IAAA,0BAAW,EAAC,YAAY,CAAC,CAAA;YACzB,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAA;KACjF;AACH,CAAC;AAXD,8DAWC;AAED,SAAgB,qBAAqB,CAAC,GAAW,EAAE,YAA+B;IAChF,QAAQ,YAAY,EAAE;QACpB,KAAK,KAAK;YACR,OAAO,GAAG,CAAA;QACZ,KAAK,SAAS;YACZ,OAAO,oBAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;QAC/D;YACE,IAAA,0BAAW,EAAC,YAAY,CAAC,CAAA;YACzB,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAA;KACjF;AACH,CAAC;AAVD,sDAUC"}
|