@airgap/icp 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.
Files changed (118) hide show
  1. package/package.json +17 -15
  2. package/airgap-coinlib-icp.min.js +0 -91775
  3. package/index.d.ts +0 -1
  4. package/index.js +0 -18
  5. package/index.js.map +0 -1
  6. package/v1/block-explorer/ICPBlockExplorer.d.ts +0 -9
  7. package/v1/block-explorer/ICPBlockExplorer.js +0 -74
  8. package/v1/block-explorer/ICPBlockExplorer.js.map +0 -1
  9. package/v1/index.d.ts +0 -12
  10. package/v1/index.js +0 -11
  11. package/v1/index.js.map +0 -1
  12. package/v1/module/ICPModule.d.ts +0 -15
  13. package/v1/module/ICPModule.js +0 -107
  14. package/v1/module/ICPModule.js.map +0 -1
  15. package/v1/module.d.ts +0 -3
  16. package/v1/module.js +0 -24
  17. package/v1/module.js.map +0 -1
  18. package/v1/protocol/ICPImplementation.d.ts +0 -26
  19. package/v1/protocol/ICPImplementation.js +0 -342
  20. package/v1/protocol/ICPImplementation.js.map +0 -1
  21. package/v1/protocol/ICPProtocol.d.ts +0 -38
  22. package/v1/protocol/ICPProtocol.js +0 -414
  23. package/v1/protocol/ICPProtocol.js.map +0 -1
  24. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +0 -7
  25. package/v1/serializer/v3/schemas/converter/transaction-converter.js +0 -21
  26. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +0 -1
  27. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.d.ts +0 -4
  28. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.js +0 -3
  29. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.js.map +0 -1
  30. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-icp.d.ts +0 -3
  31. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-icp.js +0 -3
  32. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-icp.js.map +0 -1
  33. package/v1/serializer/v3/schemas/generated/transaction-sign-request-icp.json +0 -32
  34. package/v1/serializer/v3/schemas/generated/transaction-sign-response-icp.json +0 -19
  35. package/v1/serializer/v3/serializer-companion.d.ts +0 -14
  36. package/v1/serializer/v3/serializer-companion.js +0 -174
  37. package/v1/serializer/v3/serializer-companion.js.map +0 -1
  38. package/v1/serializer/v3/validators/transaction-validator.d.ts +0 -10
  39. package/v1/serializer/v3/validators/transaction-validator.js +0 -100
  40. package/v1/serializer/v3/validators/transaction-validator.js.map +0 -1
  41. package/v1/serializer/v3/validators/validators.d.ts +0 -5
  42. package/v1/serializer/v3/validators/validators.js +0 -106
  43. package/v1/serializer/v3/validators/validators.js.map +0 -1
  44. package/v1/types/governance.d.ts +0 -580
  45. package/v1/types/governance.js +0 -796
  46. package/v1/types/governance.js.map +0 -1
  47. package/v1/types/ledger.d.ts +0 -143
  48. package/v1/types/ledger.js +0 -146
  49. package/v1/types/ledger.js.map +0 -1
  50. package/v1/types/management_idl.d.ts +0 -7
  51. package/v1/types/management_idl.js +0 -72
  52. package/v1/types/management_idl.js.map +0 -1
  53. package/v1/types/protocol.d.ts +0 -8
  54. package/v1/types/protocol.js +0 -3
  55. package/v1/types/protocol.js.map +0 -1
  56. package/v1/types/transaction.d.ts +0 -11
  57. package/v1/types/transaction.js +0 -3
  58. package/v1/types/transaction.js.map +0 -1
  59. package/v1/utils/account.d.ts +0 -24
  60. package/v1/utils/account.js +0 -112
  61. package/v1/utils/account.js.map +0 -1
  62. package/v1/utils/actor.d.ts +0 -246
  63. package/v1/utils/actor.js +0 -458
  64. package/v1/utils/actor.js.map +0 -1
  65. package/v1/utils/agent.d.ts +0 -156
  66. package/v1/utils/agent.js +0 -16
  67. package/v1/utils/agent.js.map +0 -1
  68. package/v1/utils/auth.d.ts +0 -110
  69. package/v1/utils/auth.js +0 -261
  70. package/v1/utils/auth.js.map +0 -1
  71. package/v1/utils/bls.d.ts +0 -38
  72. package/v1/utils/bls.js +0 -204
  73. package/v1/utils/bls.js.map +0 -1
  74. package/v1/utils/buffer.d.ts +0 -70
  75. package/v1/utils/buffer.js +0 -216
  76. package/v1/utils/buffer.js.map +0 -1
  77. package/v1/utils/cbor.d.ts +0 -9
  78. package/v1/utils/cbor.js +0 -178
  79. package/v1/utils/cbor.js.map +0 -1
  80. package/v1/utils/certificate.d.ts +0 -74
  81. package/v1/utils/certificate.js +0 -396
  82. package/v1/utils/certificate.js.map +0 -1
  83. package/v1/utils/convert.d.ts +0 -8
  84. package/v1/utils/convert.js +0 -80
  85. package/v1/utils/convert.js.map +0 -1
  86. package/v1/utils/crypto.d.ts +0 -0
  87. package/v1/utils/crypto.js +0 -104
  88. package/v1/utils/crypto.js.map +0 -1
  89. package/v1/utils/der.d.ts +0 -35
  90. package/v1/utils/der.js +0 -176
  91. package/v1/utils/der.js.map +0 -1
  92. package/v1/utils/errors.d.ts +0 -7
  93. package/v1/utils/errors.js +0 -38
  94. package/v1/utils/errors.js.map +0 -1
  95. package/v1/utils/hdkey.d.ts +0 -13
  96. package/v1/utils/hdkey.js +0 -242
  97. package/v1/utils/hdkey.js.map +0 -1
  98. package/v1/utils/http.d.ts +0 -284
  99. package/v1/utils/http.js +0 -614
  100. package/v1/utils/http.js.map +0 -1
  101. package/v1/utils/idl.d.ts +0 -515
  102. package/v1/utils/idl.js +0 -2103
  103. package/v1/utils/idl.js.map +0 -1
  104. package/v1/utils/leb128.d.ts +0 -63
  105. package/v1/utils/leb128.js +0 -224
  106. package/v1/utils/leb128.js.map +0 -1
  107. package/v1/utils/polling.d.ts +0 -59
  108. package/v1/utils/polling.js +0 -325
  109. package/v1/utils/polling.js.map +0 -1
  110. package/v1/utils/principal.d.ts +0 -58
  111. package/v1/utils/principal.js +0 -543
  112. package/v1/utils/principal.js.map +0 -1
  113. package/v1/utils/secp256k1.d.ts +0 -79
  114. package/v1/utils/secp256k1.js +0 -254
  115. package/v1/utils/secp256k1.js.map +0 -1
  116. package/v1/utils/transaction.d.ts +0 -3
  117. package/v1/utils/transaction.js +0 -56
  118. package/v1/utils/transaction.js.map +0 -1
@@ -1,254 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __read = (this && this.__read) || function (o, n) {
54
- var m = typeof Symbol === "function" && o[Symbol.iterator];
55
- if (!m) return o;
56
- var i = m.call(o), r, ar = [], e;
57
- try {
58
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
59
- }
60
- catch (error) { e = { error: error }; }
61
- finally {
62
- try {
63
- if (r && !r.done && (m = i["return"])) m.call(i);
64
- }
65
- finally { if (e) throw e.error; }
66
- }
67
- return ar;
68
- };
69
- var __importDefault = (this && this.__importDefault) || function (mod) {
70
- return (mod && mod.__esModule) ? mod : { "default": mod };
71
- };
72
- Object.defineProperty(exports, "__esModule", { value: true });
73
- exports.Secp256k1KeyIdentity = exports.Secp256k1PublicKey = void 0;
74
- /* eslint-disable no-underscore-dangle */
75
- var secp256k1_1 = __importDefault(require("secp256k1"));
76
- var js_sha256_1 = require("js-sha256");
77
- var tweetnacl_1 = require("tweetnacl");
78
- var hdkey_1 = __importDefault(require("./hdkey"));
79
- var bip39_1 = require("bip39");
80
- var buffer_1 = require("./buffer");
81
- var der_1 = require("./der");
82
- var auth_1 = require("./auth");
83
- var Secp256k1PublicKey = /** @class */ (function () {
84
- // `fromRaw` and `fromDer` should be used for instantiation, not this constructor.
85
- function Secp256k1PublicKey(key) {
86
- key.byteLength;
87
- this.rawKey = key;
88
- this.derKey = Secp256k1PublicKey.derEncode(key);
89
- }
90
- /**
91
- * Construct Secp256k1PublicKey from an existing PublicKey
92
- * @param {PublicKey} key
93
- * @returns {Secp256k1PublicKey} Instance of Secp256k1PublicKey
94
- */
95
- Secp256k1PublicKey.from = function (key) {
96
- return this.fromDer(key.toDer());
97
- };
98
- Secp256k1PublicKey.fromRaw = function (rawKey) {
99
- return new Secp256k1PublicKey(rawKey);
100
- };
101
- Secp256k1PublicKey.fromDer = function (derKey) {
102
- return new Secp256k1PublicKey(this.derDecode(derKey));
103
- };
104
- Secp256k1PublicKey.derEncode = function (publicKey) {
105
- return (0, der_1.wrapDER)(publicKey, der_1.SECP256K1_OID).buffer;
106
- };
107
- Secp256k1PublicKey.derDecode = function (key) {
108
- return (0, der_1.unwrapDER)(key, der_1.SECP256K1_OID);
109
- };
110
- Secp256k1PublicKey.prototype.toDer = function () {
111
- return this.derKey;
112
- };
113
- Secp256k1PublicKey.prototype.toRaw = function () {
114
- return this.rawKey;
115
- };
116
- return Secp256k1PublicKey;
117
- }());
118
- exports.Secp256k1PublicKey = Secp256k1PublicKey;
119
- var Secp256k1KeyIdentity = /** @class */ (function (_super) {
120
- __extends(Secp256k1KeyIdentity, _super);
121
- function Secp256k1KeyIdentity(publicKey, _privateKey) {
122
- var _this = _super.call(this) || this;
123
- _this._privateKey = _privateKey;
124
- _this._publicKey = publicKey;
125
- return _this;
126
- }
127
- /**
128
- * Generates an identity. If a seed is provided, the keys are generated from the
129
- * seed according to BIP 0032. Otherwise, the key pair is randomly generated.
130
- * This method throws an error in case the seed is not 32 bytes long or invalid
131
- * for use as a private key.
132
- * @param {Uint8Array} seed the optional seed
133
- * @returns {Secp256k1KeyIdentity}
134
- */
135
- Secp256k1KeyIdentity.generate = function (seed) {
136
- if (seed && seed.byteLength !== 32) {
137
- throw new Error('Secp256k1 Seed needs to be 32 bytes long.');
138
- }
139
- var privateKey;
140
- if (seed) {
141
- // private key from seed according to https://en.bitcoin.it/wiki/BIP_0032
142
- // master key generation:
143
- privateKey = seed;
144
- if (!secp256k1_1.default.privateKeyVerify(privateKey)) {
145
- throw new Error('The seed is invalid.');
146
- }
147
- }
148
- else {
149
- privateKey = new Uint8Array((0, tweetnacl_1.randomBytes)(32));
150
- while (!secp256k1_1.default.privateKeyVerify(privateKey)) {
151
- privateKey = new Uint8Array((0, tweetnacl_1.randomBytes)(32));
152
- }
153
- }
154
- var publicKeyRaw = secp256k1_1.default.publicKeyCreate(privateKey, false);
155
- var publicKey = Secp256k1PublicKey.fromRaw(publicKeyRaw);
156
- return new this(publicKey, privateKey);
157
- };
158
- Secp256k1KeyIdentity.fromParsedJson = function (obj) {
159
- var _a = __read(obj, 2), publicKeyRaw = _a[0], privateKeyRaw = _a[1];
160
- return new Secp256k1KeyIdentity(Secp256k1PublicKey.fromRaw((0, buffer_1.fromHexString)(publicKeyRaw)), (0, buffer_1.fromHexString)(privateKeyRaw));
161
- };
162
- Secp256k1KeyIdentity.fromJSON = function (json) {
163
- var parsed = JSON.parse(json);
164
- if (Array.isArray(parsed)) {
165
- if (typeof parsed[0] === 'string' && typeof parsed[1] === 'string') {
166
- return this.fromParsedJson([parsed[0], parsed[1]]);
167
- }
168
- throw new Error('Deserialization error: JSON must have at least 2 items.');
169
- }
170
- throw new Error("Deserialization error: Invalid JSON type for string: ".concat(JSON.stringify(json)));
171
- };
172
- /**
173
- * generates an identity from a public and private key. Please ensure that you are generating these keys securely and protect the user's private key
174
- * @param {ArrayBuffer} publicKey
175
- * @param {ArrayBuffer} privateKey
176
- * @returns {Secp256k1KeyIdentity}
177
- */
178
- Secp256k1KeyIdentity.fromKeyPair = function (publicKey, privateKey) {
179
- return new Secp256k1KeyIdentity(Secp256k1PublicKey.fromRaw(publicKey), privateKey);
180
- };
181
- /**
182
- * generates an identity from an existing secret key, and is the correct method to generate an identity from a seed phrase. Please ensure you protect the user's private key.
183
- * @param {ArrayBuffer} secretKey
184
- * @returns {Secp256k1KeyIdentity}
185
- */
186
- Secp256k1KeyIdentity.fromSecretKey = function (secretKey) {
187
- var publicKey = secp256k1_1.default.publicKeyCreate(new Uint8Array(secretKey), false);
188
- var identity = Secp256k1KeyIdentity.fromKeyPair(publicKey, new Uint8Array(secretKey));
189
- return identity;
190
- };
191
- /**
192
- * Generates an identity from a seed phrase. Use carefully - seed phrases should only be used in secure contexts, and you should avoid having users copying and pasting seed phrases as much as possible.
193
- * @param {string | string[]} seedPhrase - either an array of words or a string of words separated by spaces.
194
- * @param password - optional password to be used by bip39
195
- * @returns Secp256k1KeyIdentity
196
- */
197
- Secp256k1KeyIdentity.fromSeedPhrase = function (seedPhrase, password, derivationPath) {
198
- if (derivationPath === void 0) { derivationPath = "m/44'/223'/0'/0/0"; }
199
- // Convert to string for convenience
200
- var phrase = Array.isArray(seedPhrase) ? seedPhrase.join(' ') : seedPhrase;
201
- // Warn if provided phrase is not conventional
202
- if (phrase.split(' ').length < 12 || phrase.split(' ').length > 24) {
203
- console.warn('Warning - an unusually formatted seed phrase has been provided. Decoding may not work as expected');
204
- }
205
- var seed = (0, bip39_1.mnemonicToSeedSync)(phrase, password);
206
- var root = hdkey_1.default.fromMasterSeed(seed);
207
- var addrnode = root.derive(derivationPath);
208
- return Secp256k1KeyIdentity.fromSecretKey(addrnode.privateKey);
209
- };
210
- /**
211
- * Serialize this key to JSON-serializable object.
212
- * @returns {JsonableSecp256k1Identity}
213
- */
214
- Secp256k1KeyIdentity.prototype.toJSON = function () {
215
- return [(0, buffer_1.toHexString)(this._publicKey.toRaw()), (0, buffer_1.toHexString)(this._privateKey)];
216
- };
217
- /**
218
- * Return a copy of the key pair.
219
- * @returns {KeyPair}
220
- */
221
- Secp256k1KeyIdentity.prototype.getKeyPair = function () {
222
- return {
223
- secretKey: this._privateKey,
224
- publicKey: this._publicKey
225
- };
226
- };
227
- /**
228
- * Return the public key.
229
- * @returns {Secp256k1PublicKey}
230
- */
231
- Secp256k1KeyIdentity.prototype.getPublicKey = function () {
232
- return this._publicKey;
233
- };
234
- /**
235
- * Signs a blob of data, with this identity's private key.
236
- * @param {ArrayBuffer} challenge - challenge to sign with this identity's secretKey, producing a signature
237
- * @returns {Promise<Signature>} signature
238
- */
239
- Secp256k1KeyIdentity.prototype.sign = function (challenge) {
240
- return __awaiter(this, void 0, void 0, function () {
241
- var hash, signature;
242
- return __generator(this, function (_a) {
243
- hash = js_sha256_1.sha256.create();
244
- hash.update(challenge);
245
- signature = secp256k1_1.default.ecdsaSign(new Uint8Array(hash.digest()), new Uint8Array(this._privateKey)).signature.buffer;
246
- return [2 /*return*/, signature];
247
- });
248
- });
249
- };
250
- return Secp256k1KeyIdentity;
251
- }(auth_1.SignIdentity));
252
- exports.Secp256k1KeyIdentity = Secp256k1KeyIdentity;
253
- exports.default = Secp256k1KeyIdentity;
254
- //# sourceMappingURL=secp256k1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"secp256k1.js","sourceRoot":"","sources":["../../../src/v1/utils/secp256k1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,wDAAiC;AACjC,uCAAkC;AAClC,uCAAuC;AACvC,kDAA2B;AAC3B,+BAA0C;AAC1C,mCAAqD;AACrD,6BAAyD;AACzD,+BAAyF;AAMzF;IA8BE,kFAAkF;IAClF,4BAAoB,GAAgB;QAClC,GAAG,CAAC,UAAU,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACjD,CAAC;IAlCD;;;;OAIG;IACW,uBAAI,GAAlB,UAAmB,GAAc;QAC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AQ,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;QAE5C,OAAO,oBAAoB,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAChE,CAAC;IASD;;;OAGG;IACI,qCAAM,GAAb;QACE,OAAO,CAAC,IAAA,oBAAW,EAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,IAAA,oBAAW,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED;;;OAGG;IACI,yCAAU,GAAjB;QACE,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,WAAW;YAC3B,SAAS,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAA;IACH,CAAC;IAED;;;OAGG;IACI,2CAAY,GAAnB;QACE,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED;;;;OAIG;IACU,mCAAI,GAAjB,UAAkB,SAAsB;;;;gBAChC,IAAI,GAAG,kBAAM,CAAC,MAAM,EAAE,CAAA;gBAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;gBAChB,SAAS,GAAG,mBAAS,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAA;gBACvH,sBAAO,SAAsB,EAAA;;;KAC9B;IACH,2BAAC;AAAD,CAAC,AA9ID,CAA0C,mBAAY,GA8IrD;AA9IY,oDAAoB;AAgJjC,kBAAe,oBAAoB,CAAA"}
@@ -1,3 +0,0 @@
1
- /// <reference types="node" />
2
- export declare function encodeTx(transaction: any): string;
3
- export declare function decodeTx(transaction: string): Buffer;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.decodeTx = exports.encodeTx = void 0;
30
- var coinlib_core_1 = require("@airgap/coinlib-core");
31
- var bs58check = __importStar(require("@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index"));
32
- var errors_1 = require("@airgap/coinlib-core/errors");
33
- var base64Check_1 = __importDefault(require("@airgap/coinlib-core/utils/base64Check"));
34
- var TRANSACTION_PREFIX = 'tx_';
35
- function encodeTx(transaction) {
36
- return "".concat(TRANSACTION_PREFIX).concat(base64Check_1.default.encode(transaction));
37
- }
38
- exports.encodeTx = encodeTx;
39
- function decodeTx(transaction) {
40
- var encoded = transaction.replace(TRANSACTION_PREFIX, '');
41
- try {
42
- return base64Check_1.default.decode(encoded);
43
- }
44
- catch (error) {
45
- //
46
- }
47
- try {
48
- return bs58check.decode(encoded);
49
- }
50
- catch (error) {
51
- //
52
- }
53
- throw new errors_1.InvalidValueError(coinlib_core_1.Domain.AETERNITY, 'invalid TX-encoding');
54
- }
55
- exports.decodeTx = decodeTx;
56
- //# sourceMappingURL=transaction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/utils/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6C;AAC7C,qGAAwF;AACxF,sDAA+D;AAC/D,uFAA8D;AAE9D,IAAM,kBAAkB,GAAW,KAAK,CAAA;AAExC,SAAgB,QAAQ,CAAC,WAAgB;IACvC,OAAO,UAAG,kBAAkB,SAAG,qBAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAE,CAAA;AAChE,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,WAAmB;IAC1C,IAAM,OAAO,GAAW,WAAW,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAEnE,IAAI;QACF,OAAO,qBAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;KACjC;IAAC,OAAO,KAAK,EAAE;QACd,EAAE;KACH;IAED,IAAI;QACF,OAAO,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;KACjC;IAAC,OAAO,KAAK,EAAE;QACd,EAAE;KACH;IAED,MAAM,IAAI,0BAAiB,CAAC,qBAAM,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAA;AACtE,CAAC;AAhBD,4BAgBC"}