@airgap/groestlcoin 0.13.11-beta.1 → 0.13.11-beta.2
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/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +1 -5
- package/v0/index.d.ts +4 -0
- package/v0/index.js +21 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/GroestlcoinProtocol.d.ts +23 -0
- package/v0/protocol/GroestlcoinProtocol.js +89 -0
- package/v0/protocol/GroestlcoinProtocol.js.map +1 -0
- package/v0/protocol/GroestlcoinProtocolOptions.d.ts +26 -0
- package/v0/protocol/GroestlcoinProtocolOptions.js +149 -0
- package/v0/protocol/GroestlcoinProtocolOptions.js.map +1 -0
- package/v0/protocol/GroestlcoinTestnetProtocol.d.ts +4 -0
- package/v0/protocol/GroestlcoinTestnetProtocol.js +56 -0
- package/v0/protocol/GroestlcoinTestnetProtocol.js.map +1 -0
- package/v1/block-explorer/CryptoIDBlockExplorer.d.ts +11 -0
- package/v1/block-explorer/CryptoIDBlockExplorer.js +75 -0
- package/v1/block-explorer/CryptoIDBlockExplorer.js.map +1 -0
- package/v1/index.d.ts +10 -0
- package/v1/index.js +10 -0
- package/v1/index.js.map +1 -0
- package/v1/module/GroestlcoinModule.d.ts +17 -0
- package/v1/module/GroestlcoinModule.js +113 -0
- package/v1/module/GroestlcoinModule.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/GroestlcoinProtocol.d.ts +63 -0
- package/v1/protocol/GroestlcoinProtocol.js +518 -0
- package/v1/protocol/GroestlcoinProtocol.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 +21 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-groestlcoin.d.ts +5 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-groestlcoin.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-groestlcoin.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-groestlcoin.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-groestlcoin.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-groestlcoin.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-groestlcoin.json +109 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-groestlcoin.json +37 -0
- package/v1/serializer/v3/serializer-companion.d.ts +14 -0
- package/v1/serializer/v3/serializer-companion.js +173 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +4 -0
- package/v1/serializer/v3/validators/transaction-validator.js +29 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +7 -0
- package/v1/serializer/v3/validators/validators.js +6 -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 +18 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +7 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (_) try {
|
|
52
|
+
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;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
+
exports.createGroestlcoinProtocolOptions = exports.GROESTLCOIN_TESTNET_PROTOCOL_NETWORK = exports.GROESTLCOIN_MAINNET_PROTOCOL_NETWORK = exports.createGroestlcoinProtocol = exports.GroestlcoinProtocolImpl = void 0;
|
|
74
|
+
var BitcoinProtocol_1 = require("@airgap/bitcoin/v1/protocol/BitcoinProtocol");
|
|
75
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
var bitGoUTXO = __importStar(require("@airgap/coinlib-core/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/index"));
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
var groestlcoinJSMessage = __importStar(require("@airgap/coinlib-core/dependencies/src/groestlcoinjs-message-2.1.0/index"));
|
|
80
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
81
|
+
// Implementation
|
|
82
|
+
var BITCOINJS_MAINNET_NETWORK = 'groestlcoin';
|
|
83
|
+
var GroestlcoinProtocolImpl = /** @class */ (function () {
|
|
84
|
+
function GroestlcoinProtocolImpl(options) {
|
|
85
|
+
// Common
|
|
86
|
+
this.units = {
|
|
87
|
+
GRS: {
|
|
88
|
+
symbol: { value: 'GRS', market: 'grs' },
|
|
89
|
+
decimals: 8
|
|
90
|
+
},
|
|
91
|
+
mGRS: {
|
|
92
|
+
symbol: { value: 'mGRS' },
|
|
93
|
+
decimals: 4
|
|
94
|
+
},
|
|
95
|
+
Satoshi: {
|
|
96
|
+
symbol: { value: 'Satoshi' },
|
|
97
|
+
decimals: 0
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
this.feeDefaults = {
|
|
101
|
+
low: (0, module_kit_1.newAmount)(0.00002, 'GRS').blockchain(this.units),
|
|
102
|
+
medium: (0, module_kit_1.newAmount)(0.00004, 'GRS').blockchain(this.units),
|
|
103
|
+
high: (0, module_kit_1.newAmount)(0.00005, 'GRS').blockchain(this.units)
|
|
104
|
+
};
|
|
105
|
+
this.metadata = {
|
|
106
|
+
identifier: coinlib_core_1.MainProtocolSymbols.GRS,
|
|
107
|
+
name: 'Groestlcoin',
|
|
108
|
+
units: this.units,
|
|
109
|
+
mainUnit: 'GRS',
|
|
110
|
+
fee: {
|
|
111
|
+
defaults: this.feeDefaults
|
|
112
|
+
},
|
|
113
|
+
account: {
|
|
114
|
+
standardDerivationPath: "m/44'/17'/0'",
|
|
115
|
+
address: {
|
|
116
|
+
isCaseSensitive: true,
|
|
117
|
+
placeholder: 'Fdb...',
|
|
118
|
+
regex: '^([F3][a-km-zA-HJ-NP-Z1-9]{33}|grs1[a-zA-HJ-NP-Z0-9]{39})$'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
this.bitcoinUnits = undefined;
|
|
123
|
+
this.options = createGroestlcoinProtocolOptions(options.network);
|
|
124
|
+
this.bitcoinProtocol = new BitcoinProtocol_1.BitcoinProtocolImpl(__assign(__assign({}, this.options), { network: __assign(__assign({}, this.options.network), { type: 'custom', bitcoinjsNetworkName: BITCOINJS_MAINNET_NETWORK }) }), bitGoUTXO, groestlcoinJSMessage);
|
|
125
|
+
}
|
|
126
|
+
GroestlcoinProtocolImpl.prototype.getMetadata = function () {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
return [2 /*return*/, this.metadata];
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
GroestlcoinProtocolImpl.prototype.getAddressFromPublicKey = function (publicKey) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
return [2 /*return*/, this.bitcoinProtocol.getAddressFromPublicKey(publicKey)];
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
GroestlcoinProtocolImpl.prototype.deriveFromExtendedPublicKey = function (extendedPublicKey, visibilityIndex, addressIndex) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
return [2 /*return*/, this.bitcoinProtocol.deriveFromExtendedPublicKey(extendedPublicKey, visibilityIndex, addressIndex)];
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
GroestlcoinProtocolImpl.prototype.getDetailsFromTransaction = function (transaction, publicKey) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
149
|
+
var bitcoinTransactions;
|
|
150
|
+
var _this = this;
|
|
151
|
+
return __generator(this, function (_a) {
|
|
152
|
+
switch (_a.label) {
|
|
153
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getDetailsFromTransaction(transaction, publicKey)];
|
|
154
|
+
case 1:
|
|
155
|
+
bitcoinTransactions = _a.sent();
|
|
156
|
+
return [2 /*return*/, Promise.all(bitcoinTransactions.map(function (transaction) { return _this.fromBitcoinAirGapTransaction(transaction); }))];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
GroestlcoinProtocolImpl.prototype.verifyMessageWithPublicKey = function (message, signature, publicKey) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
return [2 /*return*/, this.bitcoinProtocol.verifyMessageWithPublicKey(message, signature, publicKey)];
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
GroestlcoinProtocolImpl.prototype.encryptAsymmetricWithPublicKey = function (payload, publicKey) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
return [2 /*return*/, this.bitcoinProtocol.encryptAsymmetricWithPublicKey(payload, publicKey)];
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
// Offline
|
|
176
|
+
GroestlcoinProtocolImpl.prototype.getCryptoConfiguration = function () {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
+
return __generator(this, function (_a) {
|
|
179
|
+
return [2 /*return*/, this.bitcoinProtocol.getCryptoConfiguration()];
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
GroestlcoinProtocolImpl.prototype.getKeyPairFromDerivative = function (derivative) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
return [2 /*return*/, this.bitcoinProtocol.getKeyPairFromDerivative(derivative)];
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
GroestlcoinProtocolImpl.prototype.getExtendedKeyPairFromDerivative = function (derivative) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
192
|
+
return __generator(this, function (_a) {
|
|
193
|
+
return [2 /*return*/, this.bitcoinProtocol.getExtendedKeyPairFromDerivative(derivative)];
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
GroestlcoinProtocolImpl.prototype.deriveFromExtendedSecretKey = function (extendedSecretKey, visibilityIndex, addressIndex) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
return __generator(this, function (_a) {
|
|
200
|
+
return [2 /*return*/, this.bitcoinProtocol.deriveFromExtendedSecretKey(extendedSecretKey, visibilityIndex, addressIndex)];
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
GroestlcoinProtocolImpl.prototype.signTransactionWithSecretKey = function (transaction, secretKey) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
206
|
+
return __generator(this, function (_a) {
|
|
207
|
+
return [2 /*return*/, this.bitcoinProtocol.signTransactionWithSecretKey(transaction, secretKey)];
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
GroestlcoinProtocolImpl.prototype.signMessageWithKeyPair = function (message, keyPair) {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
return [2 /*return*/, this.bitcoinProtocol.signMessageWithKeyPair(message, keyPair)];
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
GroestlcoinProtocolImpl.prototype.decryptAsymmetricWithKeyPair = function (payload, keyPair) {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
return [2 /*return*/, this.bitcoinProtocol.decryptAsymmetricWithKeyPair(payload, keyPair)];
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
GroestlcoinProtocolImpl.prototype.encryptAESWithSecretKey = function (payload, secretKey) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
return [2 /*return*/, this.bitcoinProtocol.encryptAESWithSecretKey(payload, secretKey)];
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
GroestlcoinProtocolImpl.prototype.decryptAESWithSecretKey = function (payload, secretKey) {
|
|
233
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
234
|
+
return __generator(this, function (_a) {
|
|
235
|
+
return [2 /*return*/, this.bitcoinProtocol.decryptAESWithSecretKey(payload, secretKey)];
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
// Online
|
|
240
|
+
GroestlcoinProtocolImpl.prototype.getNetwork = function () {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
return [2 /*return*/, this.options.network];
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
GroestlcoinProtocolImpl.prototype.getTransactionsForPublicKey = function (publicKey, limit, cursor) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
249
|
+
var bitcoinTransactions;
|
|
250
|
+
return __generator(this, function (_a) {
|
|
251
|
+
switch (_a.label) {
|
|
252
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getTransactionsForPublicKey(publicKey, limit, cursor)];
|
|
253
|
+
case 1:
|
|
254
|
+
bitcoinTransactions = _a.sent();
|
|
255
|
+
return [2 /*return*/, this.fromBitcoinAirGapTransactionWithCursor(bitcoinTransactions)];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
GroestlcoinProtocolImpl.prototype.getTransactionsForAddress = function (address, limit, cursor) {
|
|
261
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
262
|
+
var bitcoinTransactions;
|
|
263
|
+
return __generator(this, function (_a) {
|
|
264
|
+
switch (_a.label) {
|
|
265
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getTransactionsForAddress(address, limit, cursor)];
|
|
266
|
+
case 1:
|
|
267
|
+
bitcoinTransactions = _a.sent();
|
|
268
|
+
return [2 /*return*/, this.fromBitcoinAirGapTransactionWithCursor(bitcoinTransactions)];
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
GroestlcoinProtocolImpl.prototype.getTransactionsForAddresses = function (addresses, limit, cursor) {
|
|
274
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
275
|
+
var bitcoinTransactions;
|
|
276
|
+
return __generator(this, function (_a) {
|
|
277
|
+
switch (_a.label) {
|
|
278
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getTransactionsForAddresses(addresses, limit, cursor)];
|
|
279
|
+
case 1:
|
|
280
|
+
bitcoinTransactions = _a.sent();
|
|
281
|
+
return [2 /*return*/, this.fromBitcoinAirGapTransactionWithCursor(bitcoinTransactions)];
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
GroestlcoinProtocolImpl.prototype.getBalanceOfPublicKey = function (publicKey) {
|
|
287
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
288
|
+
var bitcoinBalance;
|
|
289
|
+
return __generator(this, function (_a) {
|
|
290
|
+
switch (_a.label) {
|
|
291
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getBalanceOfPublicKey(publicKey)];
|
|
292
|
+
case 1:
|
|
293
|
+
bitcoinBalance = _a.sent();
|
|
294
|
+
return [2 /*return*/, this.fromBitcoinBalance(bitcoinBalance)];
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
GroestlcoinProtocolImpl.prototype.getBalanceOfAddress = function (address) {
|
|
300
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
301
|
+
var bitcoinBalance;
|
|
302
|
+
return __generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
304
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getBalanceOfAddress(address)];
|
|
305
|
+
case 1:
|
|
306
|
+
bitcoinBalance = _a.sent();
|
|
307
|
+
return [2 /*return*/, this.fromBitcoinBalance(bitcoinBalance)];
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
GroestlcoinProtocolImpl.prototype.getBalanceOfAddresses = function (addresses) {
|
|
313
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
+
var bitcoinBalance;
|
|
315
|
+
return __generator(this, function (_a) {
|
|
316
|
+
switch (_a.label) {
|
|
317
|
+
case 0: return [4 /*yield*/, this.bitcoinProtocol.getBalanceOfAddresses(addresses)];
|
|
318
|
+
case 1:
|
|
319
|
+
bitcoinBalance = _a.sent();
|
|
320
|
+
return [2 /*return*/, this.fromBitcoinBalance(bitcoinBalance)];
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
GroestlcoinProtocolImpl.prototype.getTransactionMaxAmountWithPublicKey = function (publicKey, to, configuration) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
327
|
+
var bitcoinFee, bitcoinMax;
|
|
328
|
+
return __generator(this, function (_a) {
|
|
329
|
+
switch (_a.label) {
|
|
330
|
+
case 0:
|
|
331
|
+
bitcoinFee = (configuration === null || configuration === void 0 ? void 0 : configuration.fee) ? this.toBitcoinAmount(configuration.fee) : undefined;
|
|
332
|
+
return [4 /*yield*/, this.bitcoinProtocol.getTransactionMaxAmountWithPublicKey(publicKey, to, __assign(__assign({}, configuration), { fee: bitcoinFee }))];
|
|
333
|
+
case 1:
|
|
334
|
+
bitcoinMax = _a.sent();
|
|
335
|
+
return [2 /*return*/, this.fromBitcoinAmount(bitcoinMax)];
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
GroestlcoinProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (publicKey, details) {
|
|
341
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
342
|
+
var bitcoinDetails, bitcoinFeeEstimation;
|
|
343
|
+
var _this = this;
|
|
344
|
+
return __generator(this, function (_a) {
|
|
345
|
+
switch (_a.label) {
|
|
346
|
+
case 0:
|
|
347
|
+
bitcoinDetails = details.map(function (details) {
|
|
348
|
+
return _this.toBitcoinTransactionDetails(details);
|
|
349
|
+
});
|
|
350
|
+
return [4 /*yield*/, this.bitcoinProtocol.getTransactionFeeWithPublicKey(publicKey, bitcoinDetails)];
|
|
351
|
+
case 1:
|
|
352
|
+
bitcoinFeeEstimation = _a.sent();
|
|
353
|
+
return [2 /*return*/, this.fromBitcoinFeeEstimation(bitcoinFeeEstimation)];
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
GroestlcoinProtocolImpl.prototype.prepareTransactionWithPublicKey = function (publicKey, details, configuration) {
|
|
359
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
360
|
+
var bitcoinDetails, bitcoinFee;
|
|
361
|
+
var _this = this;
|
|
362
|
+
return __generator(this, function (_a) {
|
|
363
|
+
bitcoinDetails = details.map(function (details) {
|
|
364
|
+
return _this.toBitcoinTransactionDetails(details);
|
|
365
|
+
});
|
|
366
|
+
bitcoinFee = (configuration === null || configuration === void 0 ? void 0 : configuration.fee) ? this.toBitcoinAmount(configuration.fee) : undefined;
|
|
367
|
+
return [2 /*return*/, this.bitcoinProtocol.prepareTransactionWithPublicKey(publicKey, bitcoinDetails, __assign(__assign({}, configuration), { fee: bitcoinFee }))];
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
};
|
|
371
|
+
GroestlcoinProtocolImpl.prototype.broadcastTransaction = function (transaction) {
|
|
372
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
373
|
+
return __generator(this, function (_a) {
|
|
374
|
+
return [2 /*return*/, this.bitcoinProtocol.broadcastTransaction(transaction)];
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
// Custom
|
|
379
|
+
GroestlcoinProtocolImpl.prototype.fromBitcoinAirGapTransaction = function (transaction) {
|
|
380
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
381
|
+
var _a, amount, fee;
|
|
382
|
+
return __generator(this, function (_b) {
|
|
383
|
+
switch (_b.label) {
|
|
384
|
+
case 0: return [4 /*yield*/, Promise.all([
|
|
385
|
+
this.fromBitcoinAmount(transaction.amount),
|
|
386
|
+
this.fromBitcoinAmount(transaction.fee)
|
|
387
|
+
])];
|
|
388
|
+
case 1:
|
|
389
|
+
_a = _b.sent(), amount = _a[0], fee = _a[1];
|
|
390
|
+
return [2 /*return*/, __assign(__assign({}, transaction), { amount: amount, fee: fee })];
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
GroestlcoinProtocolImpl.prototype.fromBitcoinAirGapTransactionWithCursor = function (transactionsWithCursor) {
|
|
396
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
397
|
+
var _a;
|
|
398
|
+
var _this = this;
|
|
399
|
+
return __generator(this, function (_b) {
|
|
400
|
+
switch (_b.label) {
|
|
401
|
+
case 0:
|
|
402
|
+
_a = {};
|
|
403
|
+
return [4 /*yield*/, Promise.all(transactionsWithCursor.transactions.map(function (transaction) {
|
|
404
|
+
return _this.fromBitcoinAirGapTransaction(transaction);
|
|
405
|
+
}))];
|
|
406
|
+
case 1: return [2 /*return*/, (_a.transactions = _b.sent(),
|
|
407
|
+
_a.cursor = {
|
|
408
|
+
hasNext: transactionsWithCursor.cursor.hasNext,
|
|
409
|
+
page: transactionsWithCursor.cursor.page
|
|
410
|
+
},
|
|
411
|
+
_a)];
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
GroestlcoinProtocolImpl.prototype.fromBitcoinBalance = function (balance) {
|
|
417
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
418
|
+
var _a, total, transferable;
|
|
419
|
+
return __generator(this, function (_b) {
|
|
420
|
+
switch (_b.label) {
|
|
421
|
+
case 0: return [4 /*yield*/, Promise.all([
|
|
422
|
+
this.fromBitcoinAmount(balance.total),
|
|
423
|
+
balance.transferable ? this.fromBitcoinAmount(balance.transferable) : Promise.resolve(undefined)
|
|
424
|
+
])];
|
|
425
|
+
case 1:
|
|
426
|
+
_a = _b.sent(), total = _a[0], transferable = _a[1];
|
|
427
|
+
return [2 /*return*/, { total: total, transferable: transferable }];
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
GroestlcoinProtocolImpl.prototype.fromBitcoinFeeEstimation = function (feeEstimation) {
|
|
433
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
434
|
+
var _a, low, medium, high;
|
|
435
|
+
return __generator(this, function (_b) {
|
|
436
|
+
switch (_b.label) {
|
|
437
|
+
case 0: return [4 /*yield*/, Promise.all([
|
|
438
|
+
this.fromBitcoinAmount(feeEstimation.low),
|
|
439
|
+
this.fromBitcoinAmount(feeEstimation.medium),
|
|
440
|
+
this.fromBitcoinAmount(feeEstimation.high)
|
|
441
|
+
])];
|
|
442
|
+
case 1:
|
|
443
|
+
_a = _b.sent(), low = _a[0], medium = _a[1], high = _a[2];
|
|
444
|
+
return [2 /*return*/, { low: low, medium: medium, high: high }];
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
GroestlcoinProtocolImpl.prototype.fromBitcoinAmount = function (amount) {
|
|
450
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
451
|
+
var bitcoinUnits;
|
|
452
|
+
return __generator(this, function (_a) {
|
|
453
|
+
switch (_a.label) {
|
|
454
|
+
case 0: return [4 /*yield*/, this.getBitcoinUnits()];
|
|
455
|
+
case 1:
|
|
456
|
+
bitcoinUnits = _a.sent();
|
|
457
|
+
return [2 /*return*/, this.convertAmount(amount, bitcoinUnits)];
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
GroestlcoinProtocolImpl.prototype.toBitcoinTransactionDetails = function (details) {
|
|
463
|
+
return __assign(__assign({}, details), { amount: this.toBitcoinAmount(details.amount) });
|
|
464
|
+
};
|
|
465
|
+
GroestlcoinProtocolImpl.prototype.toBitcoinAmount = function (amount) {
|
|
466
|
+
return this.convertAmount(amount, this.units);
|
|
467
|
+
};
|
|
468
|
+
GroestlcoinProtocolImpl.prototype.getBitcoinUnits = function () {
|
|
469
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
470
|
+
var metadata;
|
|
471
|
+
return __generator(this, function (_a) {
|
|
472
|
+
switch (_a.label) {
|
|
473
|
+
case 0:
|
|
474
|
+
if (!(this.bitcoinUnits === undefined)) return [3 /*break*/, 2];
|
|
475
|
+
return [4 /*yield*/, this.bitcoinProtocol.getMetadata()];
|
|
476
|
+
case 1:
|
|
477
|
+
metadata = _a.sent();
|
|
478
|
+
this.bitcoinUnits = metadata.units;
|
|
479
|
+
_a.label = 2;
|
|
480
|
+
case 2: return [2 /*return*/, this.bitcoinUnits];
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
GroestlcoinProtocolImpl.prototype.convertAmount = function (amount, fromUnits) {
|
|
486
|
+
return (0, module_kit_1.newAmount)((0, module_kit_1.newAmount)(amount).blockchain(fromUnits).value, 'blockchain');
|
|
487
|
+
};
|
|
488
|
+
return GroestlcoinProtocolImpl;
|
|
489
|
+
}());
|
|
490
|
+
exports.GroestlcoinProtocolImpl = GroestlcoinProtocolImpl;
|
|
491
|
+
// Factory
|
|
492
|
+
function createGroestlcoinProtocol(options) {
|
|
493
|
+
if (options === void 0) { options = {}; }
|
|
494
|
+
return new GroestlcoinProtocolImpl(options);
|
|
495
|
+
}
|
|
496
|
+
exports.createGroestlcoinProtocol = createGroestlcoinProtocol;
|
|
497
|
+
exports.GROESTLCOIN_MAINNET_PROTOCOL_NETWORK = {
|
|
498
|
+
name: 'Mainnet',
|
|
499
|
+
type: 'mainnet',
|
|
500
|
+
rpcUrl: '',
|
|
501
|
+
indexerApi: "https://cors-proxy.airgap.prod.gke.papers.tech/proxy?url='https://blockbook.groestlcoin.org'"
|
|
502
|
+
};
|
|
503
|
+
exports.GROESTLCOIN_TESTNET_PROTOCOL_NETWORK = {
|
|
504
|
+
name: 'Testnet',
|
|
505
|
+
type: 'testnet',
|
|
506
|
+
rpcUrl: '',
|
|
507
|
+
indexerApi: 'https://blockbook-test.groestlcoin.org/'
|
|
508
|
+
};
|
|
509
|
+
var DEFAULT_GROESTLCOIN_PROTOCOL_NETWORK = exports.GROESTLCOIN_MAINNET_PROTOCOL_NETWORK;
|
|
510
|
+
function createGroestlcoinProtocolOptions(network) {
|
|
511
|
+
if (network === void 0) { network = {}; }
|
|
512
|
+
return {
|
|
513
|
+
network: network.type === 'custom'
|
|
514
|
+
? __assign(__assign(__assign({}, DEFAULT_GROESTLCOIN_PROTOCOL_NETWORK), { bitcoinjsNetworkName: BITCOINJS_MAINNET_NETWORK }), network) : __assign(__assign({}, DEFAULT_GROESTLCOIN_PROTOCOL_NETWORK), network)
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
exports.createGroestlcoinProtocolOptions = createGroestlcoinProtocolOptions;
|
|
518
|
+
//# sourceMappingURL=GroestlcoinProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroestlcoinProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/GroestlcoinProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+EAAiF;AACjF,qDAA0D;AAC1D,aAAa;AACb,iJAAoI;AACpI,aAAa;AACb,4HAA+G;AAC/G,iDAsB2B;AA+B3B,iBAAiB;AAEjB,IAAM,yBAAyB,GAAW,aAAa,CAAA;AAEvD;IAIE,iCAAY,OAAqD;QAgBjE,SAAS;QAEQ,UAAK,GAA4C;YAChE,GAAG,EAAE;gBACH,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;gBACvC,QAAQ,EAAE,CAAC;aACZ;YACD,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;gBACzB,QAAQ,EAAE,CAAC;aACZ;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;gBAC5B,QAAQ,EAAE,CAAC;aACZ;SACF,CAAA;QAEgB,gBAAW,GAAkC;YAC5D,GAAG,EAAE,IAAA,sBAAS,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;YACrD,MAAM,EAAE,IAAA,sBAAS,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;YACxD,IAAI,EAAE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AAEV,SAAgB,yBAAyB,CAAC,OAA0D;IAA1D,wBAAA,EAAA,YAA0D;IAClG,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAA;AAC7C,CAAC;AAFD,8DAEC;AAEY,QAAA,oCAAoC,GAAuC;IACtF,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,8FAA8F;CAC3G,CAAA;AAEY,QAAA,oCAAoC,GAAuC;IACtF,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,yCAAyC;CACtD,CAAA;AAED,IAAM,oCAAoC,GAAuC,4CAAoC,CAAA;AAErH,SAAgB,gCAAgC,CAAC,OAAiD;IAAjD,wBAAA,EAAA,YAAiD;IAChG,OAAO;QACL,OAAO,EACL,OAAO,CAAC,IAAI,KAAK,QAAQ;YACvB,CAAC,gCAAM,oCAAoC,KAAE,oBAAoB,EAAE,yBAAyB,KAAK,OAAO,EACxG,CAAC,CAAE,sBAAK,oCAAoC,GAAK,OAAO,CAAyC;KACtG,CAAA;AACH,CAAC;AAPD,4EAOC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GroestlcoinSignedTransaction, GroestlcoinUnsignedTransaction } from '../../../../types/transaction';
|
|
2
|
+
import { GroestlcoinTransactionSignRequest } from '../definitions/transaction-sign-request-groestlcoin';
|
|
3
|
+
import { GroestlcoinTransactionSignResponse } from '../definitions/transaction-sign-response-groestlcoin';
|
|
4
|
+
export declare function groestlcoinUnsignedTransactionToRequest(unsigned: GroestlcoinUnsignedTransaction, publicKey: string, callbackUrl?: string): GroestlcoinTransactionSignRequest;
|
|
5
|
+
export declare function groestlcoinSignedTransactionToResponse(signed: GroestlcoinSignedTransaction, accountIdentifier: string): GroestlcoinTransactionSignResponse;
|
|
6
|
+
export declare function groestlcoinTransactionSignRequestToUnsigned(request: GroestlcoinTransactionSignRequest): GroestlcoinUnsignedTransaction;
|
|
7
|
+
export declare function groestlcoinTransactionSignResponseToSigned(response: GroestlcoinTransactionSignResponse): GroestlcoinSignedTransaction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.groestlcoinTransactionSignResponseToSigned = exports.groestlcoinTransactionSignRequestToUnsigned = exports.groestlcoinSignedTransactionToResponse = exports.groestlcoinUnsignedTransactionToRequest = void 0;
|
|
4
|
+
var v1_1 = require("@airgap/bitcoin/v1");
|
|
5
|
+
function groestlcoinUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
6
|
+
return (0, v1_1.bitcoinUnsignedTransactionToRequest)(unsigned, publicKey, callbackUrl);
|
|
7
|
+
}
|
|
8
|
+
exports.groestlcoinUnsignedTransactionToRequest = groestlcoinUnsignedTransactionToRequest;
|
|
9
|
+
function groestlcoinSignedTransactionToResponse(signed, accountIdentifier) {
|
|
10
|
+
return (0, v1_1.bitcoinSignedTransactionToResponse)(signed, accountIdentifier);
|
|
11
|
+
}
|
|
12
|
+
exports.groestlcoinSignedTransactionToResponse = groestlcoinSignedTransactionToResponse;
|
|
13
|
+
function groestlcoinTransactionSignRequestToUnsigned(request) {
|
|
14
|
+
return (0, v1_1.bitcoinTransactionSignRequestToUnsigned)(request);
|
|
15
|
+
}
|
|
16
|
+
exports.groestlcoinTransactionSignRequestToUnsigned = groestlcoinTransactionSignRequestToUnsigned;
|
|
17
|
+
function groestlcoinTransactionSignResponseToSigned(response) {
|
|
18
|
+
return (0, v1_1.bitcoinTransactionSignResponseToSigned)(response);
|
|
19
|
+
}
|
|
20
|
+
exports.groestlcoinTransactionSignResponseToSigned = groestlcoinTransactionSignResponseToSigned;
|
|
21
|
+
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;AAAA,yCAK2B;AAM3B,SAAgB,uCAAuC,CACrD,QAAwC,EACxC,SAAiB,EACjB,WAAoB;IAEpB,OAAO,IAAA,wCAAmC,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;AAC9E,CAAC;AAND,0FAMC;AAED,SAAgB,sCAAsC,CACpD,MAAoC,EACpC,iBAAyB;IAEzB,OAAO,IAAA,uCAAkC,EAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AACtE,CAAC;AALD,wFAKC;AAED,SAAgB,2CAA2C,CAAC,OAA0C;IACpG,OAAO,IAAA,4CAAuC,EAAC,OAAO,CAAC,CAAA;AACzD,CAAC;AAFD,kGAEC;AAED,SAAgB,0CAA0C,CAAC,QAA4C;IACrG,OAAO,IAAA,2CAAsC,EAAC,QAAQ,CAAC,CAAA;AACzD,CAAC;AAFD,gGAEC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BitcoinTransactionSignRequest } from '@airgap/bitcoin/v1';
|
|
2
|
+
import { GroestlcoinUnsignedTransaction } from '../../../../types/transaction';
|
|
3
|
+
export interface GroestlcoinTransactionSignRequest extends BitcoinTransactionSignRequest {
|
|
4
|
+
transaction: Omit<GroestlcoinUnsignedTransaction, 'type'>;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-request-groestlcoin.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-groestlcoin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-response-groestlcoin.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-response-groestlcoin.ts"],"names":[],"mappings":""}
|