@aeternity/aepp-sdk 8.2.1 → 10.0.0
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/CHANGELOG.md +216 -337
- package/README.md +16 -9
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -9
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/account/base.js +36 -120
- package/es/account/base.js.map +1 -1
- package/es/account/memory.js +17 -19
- package/es/account/memory.js.map +1 -1
- package/es/account/multiple.js +79 -156
- package/es/account/multiple.js.map +1 -1
- package/es/ae/aens.js +205 -626
- package/es/ae/aens.js.map +1 -1
- package/es/ae/contract.js +114 -918
- package/es/ae/contract.js.map +1 -1
- package/es/ae/index.js +90 -250
- package/es/ae/index.js.map +1 -1
- package/es/ae/oracle.js +136 -504
- package/es/ae/oracle.js.map +1 -1
- package/es/ae/universal.js.map +1 -1
- package/es/chain/index.js +12 -27
- package/es/chain/index.js.map +1 -1
- package/es/chain/node.js +289 -1020
- package/es/chain/node.js.map +1 -1
- package/es/channel/handlers.js +597 -1086
- package/es/channel/handlers.js.map +1 -1
- package/es/channel/index.js +238 -465
- package/es/channel/index.js.map +1 -1
- package/es/channel/internal.js +129 -301
- package/es/channel/internal.js.map +1 -1
- package/es/contract/aci/index.js +328 -495
- package/es/contract/aci/index.js.map +1 -1
- package/es/contract/aci/transformation.js +35 -711
- package/es/contract/aci/transformation.js.map +1 -1
- package/es/contract/compiler.js +131 -203
- package/es/contract/compiler.js.map +1 -1
- package/es/contract/ga/helpers.js +17 -122
- package/es/contract/ga/helpers.js.map +1 -1
- package/es/contract/ga/index.js +108 -249
- package/es/contract/ga/index.js.map +1 -1
- package/es/contract/index.js +7 -3
- package/es/contract/index.js.map +1 -1
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/node-pool/index.js +57 -74
- package/es/node-pool/index.js.map +1 -1
- package/es/node.js +65 -161
- package/es/node.js.map +1 -1
- package/es/other.d.ts +1 -1
- package/es/tx/builder/helpers.js +62 -115
- package/es/tx/builder/helpers.js.map +1 -1
- package/es/tx/builder/index.js +218 -309
- package/es/tx/builder/index.js.map +1 -1
- package/es/tx/builder/schema.js +586 -573
- package/es/tx/builder/schema.js.map +1 -1
- package/es/tx/index.js +102 -13
- package/es/tx/index.js.map +1 -1
- package/es/tx/tx-object.js +114 -138
- package/es/tx/tx-object.js.map +1 -1
- package/es/tx/tx.js +810 -1586
- package/es/tx/tx.js.map +1 -1
- package/es/tx/validator.js +191 -426
- package/es/tx/validator.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +20 -23
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +53 -80
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +1 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js +24 -19
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +1 -1
- package/es/utils/aepp-wallet-communication/helpers.js +60 -105
- package/es/utils/aepp-wallet-communication/helpers.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +191 -514
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +78 -93
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +381 -613
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/schema.js +43 -39
- package/es/utils/aepp-wallet-communication/schema.js.map +1 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +32 -58
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +1 -1
- package/es/utils/amount-formatter.js +41 -61
- package/es/utils/amount-formatter.js.map +1 -1
- package/es/utils/async-init.js +28 -64
- package/es/utils/async-init.js.map +1 -1
- package/es/utils/bignumber.js +3 -11
- package/es/utils/bignumber.js.map +1 -1
- package/es/utils/bytes.js +5 -9
- package/es/utils/bytes.js.map +1 -1
- package/es/utils/crypto.js +41 -106
- package/es/utils/crypto.js.map +1 -1
- package/es/utils/hd-wallet.js +45 -81
- package/es/utils/hd-wallet.js.map +1 -1
- package/es/utils/json-big.js +16 -49
- package/es/utils/json-big.js.map +1 -1
- package/es/utils/keystore.js +81 -246
- package/es/utils/keystore.js.map +1 -1
- package/es/utils/mptree.js +88 -134
- package/es/utils/mptree.js.map +1 -1
- package/es/utils/other.js +10 -60
- package/es/utils/other.js.map +1 -1
- package/es/utils/semver-satisfies.js +9 -28
- package/es/utils/semver-satisfies.js.map +1 -1
- package/es/utils/string.js +4 -13
- package/es/utils/string.js.map +1 -1
- package/es/utils/swagger.js +87 -224
- package/es/utils/swagger.js.map +1 -1
- package/package.json +51 -44
- package/src/account/base.js +11 -10
- package/src/account/multiple.js +24 -18
- package/src/ae/aens.js +64 -61
- package/src/ae/contract.js +71 -248
- package/src/ae/index.js +34 -9
- package/src/ae/oracle.js +30 -22
- package/src/ae/universal.js +3 -1
- package/src/chain/index.js +10 -16
- package/src/chain/node.js +38 -38
- package/src/channel/handlers.js +10 -4
- package/src/channel/index.js +44 -20
- package/src/contract/aci/index.js +234 -112
- package/src/contract/aci/transformation.js +30 -422
- package/src/contract/compiler.js +50 -5
- package/src/contract/ga/helpers.js +6 -14
- package/src/contract/ga/index.js +28 -28
- package/src/contract/index.js +6 -2
- package/src/index.js +4 -4
- package/src/node-pool/index.js +24 -13
- package/src/node.js +29 -30
- package/src/tx/builder/helpers.js +31 -56
- package/src/tx/builder/index.js +67 -28
- package/src/tx/builder/schema.js +79 -121
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +25 -8
- package/src/tx/tx.js +229 -150
- package/src/tx/validator.js +134 -202
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +3 -2
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +25 -7
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +10 -4
- package/src/utils/aepp-wallet-communication/helpers.js +4 -2
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +33 -12
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +9 -5
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +59 -29
- package/src/utils/aepp-wallet-communication/schema.js +1 -3
- package/src/utils/aepp-wallet-communication/wallet-detector.js +4 -1
- package/src/utils/amount-formatter.ts +1 -1
- package/src/utils/bignumber.ts +2 -1
- package/src/utils/crypto.js +4 -68
- package/src/utils/keystore.js +10 -2
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +22 -10
- package/src/contract/aci/helpers.js +0 -140
package/es/utils/swagger.js
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
2
|
-
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
3
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
4
|
-
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
5
|
-
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
6
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
7
|
-
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
8
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
9
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
10
|
-
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
11
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
12
|
-
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
13
|
-
var _excluded = ["__requestBody"];
|
|
14
|
-
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context12; _forEachInstanceProperty(_context12 = ownKeys(Object(source), true)).call(_context12, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context13; _forEachInstanceProperty(_context13 = ownKeys(Object(source))).call(_context13, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
-
|
|
20
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
21
|
-
import _URL from "@babel/runtime-corejs3/core-js-stable/url";
|
|
22
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
23
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
24
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
25
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
26
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
27
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
28
|
-
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
29
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
30
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
31
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
32
|
-
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
33
|
-
|
|
34
1
|
/*
|
|
35
2
|
* ISC License (ISC)
|
|
36
3
|
* Copyright (c) 2021 aeternity developers
|
|
@@ -57,7 +24,7 @@ import SwaggerClient from 'swagger-client';
|
|
|
57
24
|
import fetch from 'cross-fetch';
|
|
58
25
|
import JsonBig from './json-big';
|
|
59
26
|
import { snakizeKeys, pascalizeKeys, mapObject, filterObject } from './other';
|
|
60
|
-
|
|
27
|
+
let warnedAboutInternalApiUsage = false;
|
|
61
28
|
/**
|
|
62
29
|
* Generator of Swagger client
|
|
63
30
|
* @function
|
|
@@ -69,201 +36,97 @@ var warnedAboutInternalApiUsage = false;
|
|
|
69
36
|
* @param {String} [options.internalUrl] - Node internal URL
|
|
70
37
|
* @param {Boolean} [options.disableBigNumbers]
|
|
71
38
|
* @param {Boolean} [options.disableCaseConversion]
|
|
39
|
+
* @param {Function} [options.responseInterceptor]
|
|
72
40
|
* @return {Object} Swagger client
|
|
73
41
|
* @example (await genSwaggerClient('https://mainnet.aeternity.io/api')).getAccountByPubkey('ak_jupBUgZNbcC4krDLR3tAkw1iBZoBbkNeShAq4atBtpFWmz36r')
|
|
74
42
|
*/
|
|
75
43
|
|
|
76
|
-
export default
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
_context11.next = 5;
|
|
108
|
-
return fetch(specUrl);
|
|
109
|
-
|
|
110
|
-
case 5:
|
|
111
|
-
_context11.next = 7;
|
|
112
|
-
return _context11.sent.json();
|
|
113
|
-
|
|
114
|
-
case 7:
|
|
115
|
-
_context11.t0 = _context11.sent;
|
|
116
|
-
|
|
117
|
-
case 8:
|
|
118
|
-
spec = _context11.t0;
|
|
119
|
-
jsonImp = disableBigNumbers ? JSON : JsonBig;
|
|
120
|
-
|
|
121
|
-
if (_includesInstanceProperty(_context = ['https://compiler.aepps.com', 'https://latest.compiler.aepps.com']).call(_context, new _URL(specUrl).origin)) {
|
|
122
|
-
spec.schemes = ['https'];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
_context11.next = 13;
|
|
126
|
-
return _Promise.all(_mapInstanceProperty(_context2 = [specUrl, internalUrl]).call(_context2, function (url) {
|
|
127
|
-
if (!url) return null;
|
|
128
|
-
return SwaggerClient({
|
|
129
|
-
url: url,
|
|
130
|
-
spec: spec,
|
|
131
|
-
responseInterceptor: function responseInterceptor(response) {
|
|
132
|
-
if (!response.text) return response;
|
|
133
|
-
var body = jsonImp.parse(response.text);
|
|
134
|
-
return _Object$assign(response, {
|
|
135
|
-
body: disableCaseConversion ? body : pascalizeKeys(body)
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}));
|
|
140
|
-
|
|
141
|
-
case 13:
|
|
142
|
-
_yield$Promise$all = _context11.sent;
|
|
143
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
144
|
-
external = _yield$Promise$all2[0];
|
|
145
|
-
internal = _yield$Promise$all2[1];
|
|
146
|
-
combinedApi = _reduceInstanceProperty(_context3 = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(_Object$values(external.apis)), [mapObject((internal === null || internal === void 0 ? void 0 : internal.apis.internal) || {}, function (_ref3) {
|
|
147
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
148
|
-
key = _ref4[0],
|
|
149
|
-
handler = _ref4[1];
|
|
150
|
-
|
|
151
|
-
return [key, function () {
|
|
152
|
-
if (!warnedAboutInternalApiUsage) {
|
|
153
|
-
console.warn('SDK\'s wrapper of aeternity node internal API is deprecated, please use external ' + 'equivalent (for example, "sdk.api.protectedDryRunTxs" instead of "sdk.api.dryRunTxs") ' + 'or create a wrapper of internal API by yourself (using "genSwaggerClient")');
|
|
154
|
-
warnedAboutInternalApiUsage = true;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return handler.apply(void 0, arguments);
|
|
158
|
-
}];
|
|
159
|
-
})])).call(_context3, function (acc, n) {
|
|
160
|
-
return _objectSpread(_objectSpread({}, acc), n);
|
|
161
|
-
});
|
|
162
|
-
opSpecs = _reduceInstanceProperty(_context5 = _flatInstanceProperty(_context6 = _mapInstanceProperty(_context7 = _Object$values(spec.paths)).call(_context7, function (paths) {
|
|
163
|
-
return _Object$values(paths);
|
|
164
|
-
})).call(_context6)).call(_context5, function (acc, n) {
|
|
165
|
-
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, n.operationId, n));
|
|
166
|
-
}, {});
|
|
167
|
-
api = mapObject(combinedApi, function (_ref5) {
|
|
168
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
169
|
-
opId = _ref6[0],
|
|
170
|
-
handler = _ref6[1];
|
|
171
|
-
|
|
172
|
-
return [_sliceInstanceProperty(opId).call(opId, 0, 1).toLowerCase() + _sliceInstanceProperty(opId).call(opId, 1), /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
173
|
-
var _context8, _context9;
|
|
174
|
-
|
|
175
|
-
var _len,
|
|
176
|
-
args,
|
|
177
|
-
_key,
|
|
178
|
-
opSpec,
|
|
179
|
-
parameters,
|
|
180
|
-
required,
|
|
181
|
-
values,
|
|
182
|
-
_mapObject,
|
|
183
|
-
__requestBody,
|
|
184
|
-
stringified,
|
|
185
|
-
_args = arguments;
|
|
186
|
-
|
|
187
|
-
return _regeneratorRuntime.wrap(function _callee$(_context10) {
|
|
188
|
-
while (1) {
|
|
189
|
-
switch (_context10.prev = _context10.next) {
|
|
190
|
-
case 0:
|
|
191
|
-
for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
192
|
-
args[_key] = _args[_key];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
opSpec = opSpecs[opId];
|
|
196
|
-
parameters = _concatInstanceProperty(_context8 = []).call(_context8, _toConsumableArray(opSpec.parameters), _toConsumableArray(opSpec.requestBody ? [{
|
|
197
|
-
required: opSpec.requestBody.required,
|
|
198
|
-
schema: _Object$values(opSpec.requestBody.content)[0].schema,
|
|
199
|
-
name: '__requestBody'
|
|
200
|
-
}] : []));
|
|
201
|
-
required = _mapInstanceProperty(_context9 = _filterInstanceProperty(parameters).call(parameters, function (param) {
|
|
202
|
-
return param.required;
|
|
203
|
-
})).call(_context9, function (p) {
|
|
204
|
-
return p.name;
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
if (!(args.length < required.length)) {
|
|
208
|
-
_context10.next = 6;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
throw new Error('swagger: Not enough arguments');
|
|
213
|
-
|
|
214
|
-
case 6:
|
|
215
|
-
values = _reduceInstanceProperty(required).call(required, function (acc, req, idx) {
|
|
216
|
-
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, req, args[idx]));
|
|
217
|
-
}, args[required.length] || {});
|
|
218
|
-
_mapObject = mapObject(values, function (_ref8) {
|
|
219
|
-
var _ref9 = _slicedToArray(_ref8, 2),
|
|
220
|
-
param = _ref9[0],
|
|
221
|
-
value = _ref9[1];
|
|
222
|
-
|
|
223
|
-
if (_typeof(value) !== 'object') return [param, value];
|
|
224
|
-
|
|
225
|
-
var rootKeys = _Object$keys(_findInstanceProperty(parameters).call(parameters, function (p) {
|
|
226
|
-
return p.name === param;
|
|
227
|
-
}).schema.properties);
|
|
228
|
-
|
|
229
|
-
var filteredValue = filterObject(disableCaseConversion ? value : snakizeKeys(value), function (_ref10) {
|
|
230
|
-
var _ref11 = _slicedToArray(_ref10, 1),
|
|
231
|
-
key = _ref11[0];
|
|
232
|
-
|
|
233
|
-
return _includesInstanceProperty(rootKeys).call(rootKeys, key);
|
|
234
|
-
});
|
|
235
|
-
return [param, jsonImp.stringify(filteredValue)];
|
|
236
|
-
}), __requestBody = _mapObject.__requestBody, stringified = _objectWithoutProperties(_mapObject, _excluded);
|
|
237
|
-
_context10.next = 10;
|
|
238
|
-
return handler(stringified, {
|
|
239
|
-
requestBody: __requestBody
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
case 10:
|
|
243
|
-
return _context10.abrupt("return", _context10.sent.body);
|
|
244
|
-
|
|
245
|
-
case 11:
|
|
246
|
-
case "end":
|
|
247
|
-
return _context10.stop();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}, _callee);
|
|
251
|
-
}))];
|
|
252
|
-
});
|
|
253
|
-
return _context11.abrupt("return", _Object$assign(external, {
|
|
254
|
-
api: api
|
|
255
|
-
}));
|
|
256
|
-
|
|
257
|
-
case 21:
|
|
258
|
-
case "end":
|
|
259
|
-
return _context11.stop();
|
|
260
|
-
}
|
|
44
|
+
export default (async function (specUrl) {
|
|
45
|
+
let {
|
|
46
|
+
spec,
|
|
47
|
+
internalUrl,
|
|
48
|
+
disableBigNumbers,
|
|
49
|
+
disableCaseConversion,
|
|
50
|
+
responseInterceptor
|
|
51
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52
|
+
spec = spec || (await (await fetch(specUrl)).json());
|
|
53
|
+
const jsonImp = disableBigNumbers ? JSON : JsonBig;
|
|
54
|
+
|
|
55
|
+
if (['https://compiler.aepps.com', 'https://latest.compiler.aepps.com'].includes(new URL(specUrl).origin) || new URL(specUrl).origin.includes('https://')) {
|
|
56
|
+
spec.schemes = ['https'];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const [external, internal] = await Promise.all([specUrl, internalUrl].map(url => {
|
|
60
|
+
if (!url) return null;
|
|
61
|
+
return SwaggerClient({
|
|
62
|
+
url,
|
|
63
|
+
spec,
|
|
64
|
+
responseInterceptor: response => {
|
|
65
|
+
var _response$text;
|
|
66
|
+
|
|
67
|
+
if (response.text === '' || ((_response$text = response.text) === null || _response$text === void 0 ? void 0 : _response$text.size) === 0) return response;
|
|
68
|
+
const body = jsonImp.parse(response.text);
|
|
69
|
+
Object.assign(response, {
|
|
70
|
+
body: disableCaseConversion ? body : pascalizeKeys(body)
|
|
71
|
+
});
|
|
72
|
+
return responseInterceptor && responseInterceptor(response) || response;
|
|
261
73
|
}
|
|
262
|
-
}
|
|
74
|
+
});
|
|
263
75
|
}));
|
|
76
|
+
const combinedApi = [...Object.values(external.apis), mapObject((internal === null || internal === void 0 ? void 0 : internal.apis.internal) || {}, _ref => {
|
|
77
|
+
let [key, handler] = _ref;
|
|
78
|
+
return [key, function () {
|
|
79
|
+
if (!warnedAboutInternalApiUsage) {
|
|
80
|
+
console.warn('SDK\'s wrapper of aeternity node internal API is deprecated, please use external ' + 'equivalent (for example, "sdk.api.protectedDryRunTxs" instead of "sdk.api.dryRunTxs") ' + 'or create a wrapper of internal API by yourself (using "genSwaggerClient")');
|
|
81
|
+
warnedAboutInternalApiUsage = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return handler(...arguments);
|
|
85
|
+
}];
|
|
86
|
+
})].reduce((acc, n) => ({ ...acc,
|
|
87
|
+
...n
|
|
88
|
+
}));
|
|
89
|
+
const opSpecs = Object.values(spec.paths).map(paths => Object.values(paths)).flat().reduce((acc, n) => ({ ...acc,
|
|
90
|
+
[n.operationId]: n
|
|
91
|
+
}), {});
|
|
92
|
+
const api = mapObject(combinedApi, _ref2 => {
|
|
93
|
+
let [opId, handler] = _ref2;
|
|
94
|
+
return [opId.slice(0, 1).toLowerCase() + opId.slice(1), async function () {
|
|
95
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
96
|
+
args[_key] = arguments[_key];
|
|
97
|
+
}
|
|
264
98
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
99
|
+
const opSpec = opSpecs[opId];
|
|
100
|
+
const parameters = [...opSpec.parameters, ...(opSpec.requestBody ? [{
|
|
101
|
+
required: opSpec.requestBody.required,
|
|
102
|
+
schema: Object.values(opSpec.requestBody.content)[0].schema,
|
|
103
|
+
name: '__requestBody'
|
|
104
|
+
}] : [])];
|
|
105
|
+
const required = parameters.filter(param => param.required).map(p => p.name);
|
|
106
|
+
if (args.length < required.length) throw new Error('swagger: Not enough arguments');
|
|
107
|
+
const values = required.reduce((acc, req, idx) => ({ ...acc,
|
|
108
|
+
[req]: args[idx]
|
|
109
|
+
}), args[required.length] || {});
|
|
110
|
+
const {
|
|
111
|
+
__requestBody,
|
|
112
|
+
...stringified
|
|
113
|
+
} = mapObject(values, _ref3 => {
|
|
114
|
+
let [param, value] = _ref3;
|
|
115
|
+
if (typeof value !== 'object') return [param, value];
|
|
116
|
+
const rootKeys = Object.keys(parameters.find(p => p.name === param).schema.properties);
|
|
117
|
+
const filteredValue = filterObject(disableCaseConversion ? value : snakizeKeys(value), _ref4 => {
|
|
118
|
+
let [key] = _ref4;
|
|
119
|
+
return rootKeys.includes(key);
|
|
120
|
+
});
|
|
121
|
+
return [param, jsonImp.stringify(filteredValue)];
|
|
122
|
+
});
|
|
123
|
+
return (await handler(stringified, {
|
|
124
|
+
requestBody: __requestBody
|
|
125
|
+
})).body;
|
|
126
|
+
}];
|
|
127
|
+
});
|
|
128
|
+
return Object.assign(external, {
|
|
129
|
+
api
|
|
130
|
+
});
|
|
131
|
+
});
|
|
269
132
|
//# sourceMappingURL=swagger.js.map
|
package/es/utils/swagger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/swagger.js"],"names":["SwaggerClient","fetch","JsonBig","snakizeKeys","pascalizeKeys","mapObject","filterObject","warnedAboutInternalApiUsage","specUrl","spec","internalUrl","disableBigNumbers","disableCaseConversion","json","jsonImp","JSON","origin","schemes","all","url","responseInterceptor","response","text","body","parse","external","internal","combinedApi","apis","key","handler","console","warn","acc","n","opSpecs","paths","operationId","api","opId","toLowerCase","args","opSpec","parameters","requestBody","required","schema","content","name","param","p","length","Error","values","req","idx","value","rootKeys","properties","filteredValue","stringify","__requestBody","stringified"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA,OAAOA,aAAP,MAA0B,gBAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,WAAT,EAAsBC,aAAtB,EAAqCC,SAArC,EAAgDC,YAAhD,QAAoE,SAApE;AAEA,IAAIC,2BAA2B,GAAG,KAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAAA,sEAAe,kBAAOC,OAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;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V,CAAAA,UAAU,EAAM,UAAAO,CAAC;AAAA,mCAAIA,CAAC,CAACF,IAAF,KAAWC,KAAf;AAAA,2BAAP,CAAV,CAAuCH,MAAvC,CAA8CY,UAA1D,CAAjB;;AACA,8BAAMC,aAAa,GAAGrD,YAAY,CAChCM,qBAAqB,GAAG4C,KAAH,GAAWrD,WAAW,CAACqD,KAAD,CADX,EAEhC;AAAA;AAAA,gCAAE3B,GAAF;;AAAA,mCAAW,0BAAA4B,QAAQ,MAAR,CAAAA,QAAQ,EAAU5B,GAAV,CAAnB;AAAA,2BAFgC,CAAlC;AAIA,iCAAO,CAACoB,KAAD,EAAQnC,OAAO,CAAC8C,SAAR,CAAkBD,aAAlB,CAAR,CAAP;AACD,yBARkD,CAhBrD,EAgBUE,aAhBV,cAgBUA,aAhBV,EAgB4BC,WAhB5B;AAAA;AAAA,+BAyBgBhC,OAAO,CAACgC,WAAD,EAAc;AAAElB,0BAAAA,WAAW,EAAEiB;AAAf,yBAAd,CAzBvB;;AAAA;AAAA,2EAyBsEtC,IAzBtE;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAFsD,GAArB;AAAA,aAAd,CA5CR;AAAA,+CA2EN,eAAcE,QAAd,EAAwB;AAAEa,cAAAA,GAAG,EAAHA;AAAF,aAAxB,CA3EM;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAf;;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2021 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Generator of Swagger client module\n * @module @aeternity/aepp-sdk/es/utils/swagger\n * @export genSwaggerClient\n */\n\nimport SwaggerClient from 'swagger-client'\nimport fetch from 'cross-fetch'\nimport JsonBig from './json-big'\nimport { snakizeKeys, pascalizeKeys, mapObject, filterObject } from './other'\n\nlet warnedAboutInternalApiUsage = false\n\n/**\n * Generator of Swagger client\n * @function\n * @alias module:@aeternity/aepp-sdk/es/utils/swagger\n * @rtype Object\n * @param {String} specUrl - Swagger specification URL on external node host\n * @param {Object} options\n * @param {String} [options.spec] - Override OpenAPI definition\n * @param {String} [options.internalUrl] - Node internal URL\n * @param {Boolean} [options.disableBigNumbers]\n * @param {Boolean} [options.disableCaseConversion]\n * @return {Object} Swagger client\n * @example (await genSwaggerClient('https://mainnet.aeternity.io/api')).getAccountByPubkey('ak_jupBUgZNbcC4krDLR3tAkw1iBZoBbkNeShAq4atBtpFWmz36r')\n */\nexport default async (specUrl, { spec, internalUrl, disableBigNumbers, disableCaseConversion } = {}) => {\n spec = spec || await (await fetch(specUrl)).json()\n const jsonImp = disableBigNumbers ? JSON : JsonBig\n\n if (['https://compiler.aepps.com', 'https://latest.compiler.aepps.com']\n .includes(new URL(specUrl).origin)) {\n spec.schemes = ['https']\n }\n\n const [external, internal] = await Promise.all([specUrl, internalUrl].map((url) => {\n if (!url) return null\n return SwaggerClient({\n url,\n spec,\n responseInterceptor: response => {\n if (!response.text) return response\n const body = jsonImp.parse(response.text)\n return Object.assign(response, {\n body: disableCaseConversion ? body : pascalizeKeys(body)\n })\n }\n })\n }))\n\n const combinedApi = [\n ...Object.values(external.apis),\n mapObject(internal?.apis.internal || {}, ([key, handler]) => [key, (...args) => {\n if (!warnedAboutInternalApiUsage) {\n console.warn(\n 'SDK\\'s wrapper of aeternity node internal API is deprecated, please use external ' +\n 'equivalent (for example, \"sdk.api.protectedDryRunTxs\" instead of \"sdk.api.dryRunTxs\") ' +\n 'or create a wrapper of internal API by yourself (using \"genSwaggerClient\")'\n )\n warnedAboutInternalApiUsage = true\n }\n return handler(...args)\n }])\n ].reduce((acc, n) => ({ ...acc, ...n }))\n\n const opSpecs = Object.values(spec.paths)\n .map(paths => Object.values(paths))\n .flat()\n .reduce((acc, n) => ({ ...acc, [n.operationId]: n }), {})\n\n const api = mapObject(combinedApi, ([opId, handler]) => [\n opId.slice(0, 1).toLowerCase() + opId.slice(1),\n async (...args) => {\n const opSpec = opSpecs[opId]\n const parameters = [\n ...opSpec.parameters,\n ...opSpec.requestBody ? [{\n required: opSpec.requestBody.required,\n schema: Object.values(opSpec.requestBody.content)[0].schema,\n name: '__requestBody'\n }] : []\n ]\n const required = parameters.filter(param => param.required).map(p => p.name)\n if (args.length < required.length) throw new Error('swagger: Not enough arguments')\n const values = required.reduce(\n (acc, req, idx) => ({ ...acc, [req]: args[idx] }),\n args[required.length] || {}\n )\n const { __requestBody, ...stringified } = mapObject(values, ([param, value]) => {\n if (typeof value !== 'object') return [param, value]\n const rootKeys = Object.keys(parameters.find(p => p.name === param).schema.properties)\n const filteredValue = filterObject(\n disableCaseConversion ? value : snakizeKeys(value),\n ([key]) => rootKeys.includes(key)\n )\n return [param, jsonImp.stringify(filteredValue)]\n })\n return (await handler(stringified, { requestBody: __requestBody })).body\n }\n ])\n\n return Object.assign(external, { api })\n}\n"],"file":"swagger.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/swagger.js"],"names":["SwaggerClient","fetch","JsonBig","snakizeKeys","pascalizeKeys","mapObject","filterObject","warnedAboutInternalApiUsage","specUrl","spec","internalUrl","disableBigNumbers","disableCaseConversion","responseInterceptor","json","jsonImp","JSON","includes","URL","origin","schemes","external","internal","Promise","all","map","url","response","text","size","body","parse","Object","assign","combinedApi","values","apis","key","handler","console","warn","reduce","acc","n","opSpecs","paths","flat","operationId","api","opId","slice","toLowerCase","args","opSpec","parameters","requestBody","required","schema","content","name","filter","param","p","length","Error","req","idx","__requestBody","stringified","value","rootKeys","keys","find","properties","filteredValue","stringify"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA,OAAOA,aAAP,MAA0B,gBAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,WAAT,EAAsBC,aAAtB,EAAqCC,SAArC,EAAgDC,YAAhD,QAAoE,SAApE;AAEA,IAAIC,2BAA2B,GAAG,KAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,gBAAe,gBACbC,OADa,EAGV;AAAA,MADH;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,WAAR;AAAqBC,IAAAA,iBAArB;AAAwCC,IAAAA,qBAAxC;AAA+DC,IAAAA;AAA/D,GACG,uEADoF,EACpF;AACHJ,EAAAA,IAAI,GAAGA,IAAI,KAAI,MAAM,CAAC,MAAMR,KAAK,CAACO,OAAD,CAAZ,EAAuBM,IAAvB,EAAV,CAAX;AACA,QAAMC,OAAO,GAAGJ,iBAAiB,GAAGK,IAAH,GAAUd,OAA3C;;AAEA,MACE,CACE,4BADF,EAEE,mCAFF,EAGEe,QAHF,CAGW,IAAIC,GAAJ,CAAQV,OAAR,EAAiBW,MAH5B,KAIA,IAAID,GAAJ,CAAQV,OAAR,EAAiBW,MAAjB,CAAwBF,QAAxB,CAAiC,UAAjC,CALF,EAME;AACAR,IAAAA,IAAI,CAACW,OAAL,GAAe,CAAC,OAAD,CAAf;AACD;;AAED,QAAM,CAACC,QAAD,EAAWC,QAA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KA9BqD,CAArB;AAAA,GAAd,CAArB;AAiCA,SAAOE,MAAM,CAACC,MAAP,CAAcZ,QAAd,EAAwB;AAAE2B,IAAAA;AAAF,GAAxB,CAAP;AACD,CAvFD","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2021 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Generator of Swagger client module\n * @module @aeternity/aepp-sdk/es/utils/swagger\n * @export genSwaggerClient\n */\n\nimport SwaggerClient from 'swagger-client'\nimport fetch from 'cross-fetch'\nimport JsonBig from './json-big'\nimport { snakizeKeys, pascalizeKeys, mapObject, filterObject } from './other'\n\nlet warnedAboutInternalApiUsage = false\n\n/**\n * Generator of Swagger client\n * @function\n * @alias module:@aeternity/aepp-sdk/es/utils/swagger\n * @rtype Object\n * @param {String} specUrl - Swagger specification URL on external node host\n * @param {Object} options\n * @param {String} [options.spec] - Override OpenAPI definition\n * @param {String} [options.internalUrl] - Node internal URL\n * @param {Boolean} [options.disableBigNumbers]\n * @param {Boolean} [options.disableCaseConversion]\n * @param {Function} [options.responseInterceptor]\n * @return {Object} Swagger client\n * @example (await genSwaggerClient('https://mainnet.aeternity.io/api')).getAccountByPubkey('ak_jupBUgZNbcC4krDLR3tAkw1iBZoBbkNeShAq4atBtpFWmz36r')\n */\nexport default async (\n specUrl,\n { spec, internalUrl, disableBigNumbers, disableCaseConversion, responseInterceptor } = {}\n) => {\n spec = spec || await (await fetch(specUrl)).json()\n const jsonImp = disableBigNumbers ? JSON : JsonBig\n\n if (\n [\n 'https://compiler.aepps.com',\n 'https://latest.compiler.aepps.com'\n ].includes(new URL(specUrl).origin) ||\n new URL(specUrl).origin.includes('https://')\n ) {\n spec.schemes = ['https']\n }\n\n const [external, internal] = await Promise.all([specUrl, internalUrl].map((url) => {\n if (!url) return null\n return SwaggerClient({\n url,\n spec,\n responseInterceptor: response => {\n if (response.text === '' || response.text?.size === 0) return response\n const body = jsonImp.parse(response.text)\n Object.assign(response, {\n body: disableCaseConversion ? body : pascalizeKeys(body)\n })\n return (responseInterceptor && responseInterceptor(response)) || response\n }\n })\n }))\n\n const combinedApi = [\n ...Object.values(external.apis),\n mapObject(internal?.apis.internal || {}, ([key, handler]) => [key, (...args) => {\n if (!warnedAboutInternalApiUsage) {\n console.warn(\n 'SDK\\'s wrapper of aeternity node internal API is deprecated, please use external ' +\n 'equivalent (for example, \"sdk.api.protectedDryRunTxs\" instead of \"sdk.api.dryRunTxs\") ' +\n 'or create a wrapper of internal API by yourself (using \"genSwaggerClient\")'\n )\n warnedAboutInternalApiUsage = true\n }\n return handler(...args)\n }])\n ].reduce((acc, n) => ({ ...acc, ...n }))\n\n const opSpecs = Object.values(spec.paths)\n .map(paths => Object.values(paths))\n .flat()\n .reduce((acc, n) => ({ ...acc, [n.operationId]: n }), {})\n\n const api = mapObject(combinedApi, ([opId, handler]) => [\n opId.slice(0, 1).toLowerCase() + opId.slice(1),\n async (...args) => {\n const opSpec = opSpecs[opId]\n const parameters = [\n ...opSpec.parameters,\n ...opSpec.requestBody\n ? [{\n required: opSpec.requestBody.required,\n schema: Object.values(opSpec.requestBody.content)[0].schema,\n name: '__requestBody'\n }]\n : []\n ]\n const required = parameters.filter(param => param.required).map(p => p.name)\n if (args.length < required.length) throw new Error('swagger: Not enough arguments')\n const values = required.reduce(\n (acc, req, idx) => ({ ...acc, [req]: args[idx] }),\n args[required.length] || {}\n )\n const { __requestBody, ...stringified } = mapObject(values, ([param, value]) => {\n if (typeof value !== 'object') return [param, value]\n const rootKeys = Object.keys(parameters.find(p => p.name === param).schema.properties)\n const filteredValue = filterObject(\n disableCaseConversion ? value : snakizeKeys(value),\n ([key]) => rootKeys.includes(key)\n )\n return [param, jsonImp.stringify(filteredValue)]\n })\n return (await handler(stringified, { requestBody: __requestBody })).body\n }\n ])\n\n return Object.assign(external, { api })\n}\n"],"file":"swagger.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeternity/aepp-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "SDK for the æternity blockchain",
|
|
5
5
|
"main": "dist/aepp-sdk.js",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -13,18 +13,17 @@
|
|
|
13
13
|
"build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions '.js,.ts' --source-maps true",
|
|
14
14
|
"build": "webpack --mode=production && npm run build:es",
|
|
15
15
|
"build:dev": "webpack --mode=development && npm run build:es",
|
|
16
|
-
"docs:
|
|
16
|
+
"docs:examples": "node tooling/docs/examples-to-md.js examples/node/*.js",
|
|
17
17
|
"docs:api": "node apidoc.js",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"docs:changelog": "cp CHANGELOG.md docs/CHANGELOG.md",
|
|
19
|
+
"lint": "commitlint --from 635f1aa --verbose && eslint .",
|
|
20
|
+
"test": "nyc --require @babel/register --require ts-node/register mocha './test/unit/' './test/integration/' --recursive --exit --timeout 40s",
|
|
20
21
|
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
|
21
|
-
"test:integration
|
|
22
|
-
"test:integration:contract,chain": "nyc --require @babel/register --require ts-node/register mocha './test/integration/@(contract|chain).js' --timeout 10m",
|
|
23
|
-
"test:integration:else": "nyc --require @babel/register --require ts-node/register mocha './test/integration/!(channel|accounts|contract|chain).js' --timeout 10m",
|
|
22
|
+
"test:integration": "nyc --require @babel/register --require ts-node/register mocha './test/integration/*' --timeout 40s",
|
|
24
23
|
"test:unit": "nyc --require @babel/register --require ts-node/register mocha './test/unit/*'",
|
|
25
|
-
"test:watch": "mocha --recursive --require @babel/register --require ts-node/register --watch --timeout
|
|
24
|
+
"test:watch": "mocha --recursive --require @babel/register --require ts-node/register --watch --timeout 40s",
|
|
26
25
|
"prepare": "npm run build",
|
|
27
|
-
"prepublishOnly": "npm run docs:
|
|
26
|
+
"prepublishOnly": "npm run docs:examples && npm run docs:changelog",
|
|
28
27
|
"release": "standard-version --skip.tag"
|
|
29
28
|
},
|
|
30
29
|
"license": "ISC",
|
|
@@ -35,29 +34,29 @@
|
|
|
35
34
|
"SDK"
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
37
|
+
"@aeternity/aepp-calldata": "^1.0.0",
|
|
38
38
|
"@aeternity/bip39": "^0.1.0",
|
|
39
39
|
"@aeternity/json-bigint": "^0.3.1",
|
|
40
|
-
"@babel/runtime-corejs3": "^7.
|
|
40
|
+
"@babel/runtime-corejs3": "^7.16.3",
|
|
41
41
|
"@stamp/it": "^1.1.0",
|
|
42
42
|
"@stamp/required": "^1.0.1",
|
|
43
43
|
"aes-js": "^3.1.2",
|
|
44
44
|
"bignumber.js": "^9.0.1",
|
|
45
45
|
"bip32-path": "^0.4.2",
|
|
46
|
-
"blakejs": "^1.1.
|
|
46
|
+
"blakejs": "^1.1.1",
|
|
47
47
|
"bs58check": "^2.1.2",
|
|
48
48
|
"buffer": "^6.0.3",
|
|
49
49
|
"cross-fetch": "^3.1.4",
|
|
50
50
|
"crypto-browserify": "^3.12.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"libsodium-wrappers-sumo": "0.7.9",
|
|
51
|
+
"events": "^3.3.0",
|
|
52
|
+
"libsodium-wrappers-sumo": "^0.7.9",
|
|
54
53
|
"path-browserify": "^1.0.1",
|
|
55
54
|
"process": "^0.11.10",
|
|
56
55
|
"ramda": "^0.27.1",
|
|
57
|
-
"rlp": "2.2.
|
|
56
|
+
"rlp": "^2.2.7",
|
|
58
57
|
"sha.js": "^2.4.11",
|
|
59
58
|
"stream-browserify": "^3.0.0",
|
|
60
|
-
"swagger-client": "^3.
|
|
59
|
+
"swagger-client": "^3.17.0",
|
|
61
60
|
"tweetnacl": "^1.0.3",
|
|
62
61
|
"tweetnacl-auth": "^1.0.1",
|
|
63
62
|
"uuid": "^8.3.2",
|
|
@@ -68,44 +67,52 @@
|
|
|
68
67
|
"url": "https://github.com/aeternity/aepp-sdk-js"
|
|
69
68
|
},
|
|
70
69
|
"devDependencies": {
|
|
71
|
-
"@babel/cli": "7.
|
|
72
|
-
"@babel/core": "7.
|
|
73
|
-
"@babel/node": "7.
|
|
74
|
-
"@babel/plugin-
|
|
75
|
-
"@babel/
|
|
76
|
-
"@babel/
|
|
77
|
-
"@babel/
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@commitlint/cli": "^12.1.4",
|
|
81
|
-
"@commitlint/config-conventional": "^12.1.4",
|
|
70
|
+
"@babel/cli": "^7.16.0",
|
|
71
|
+
"@babel/core": "^7.16.0",
|
|
72
|
+
"@babel/node": "^7.16.0",
|
|
73
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
74
|
+
"@babel/preset-env": "^7.16.4",
|
|
75
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
76
|
+
"@babel/register": "^7.16.0",
|
|
77
|
+
"@commitlint/cli": "^15.0.0",
|
|
78
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
82
79
|
"@types/bn.js": "^5.1.0",
|
|
83
|
-
"@types/chai": "^4.2.
|
|
84
|
-
"@types/mocha": "^
|
|
85
|
-
"@types/node": "^
|
|
86
|
-
"
|
|
80
|
+
"@types/chai": "^4.2.22",
|
|
81
|
+
"@types/mocha": "^9.0.0",
|
|
82
|
+
"@types/node": "^16.11.9",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
84
|
+
"@typescript-eslint/parser": "^5.3.1",
|
|
85
|
+
"babel-loader": "^8.2.3",
|
|
87
86
|
"babel-plugin-ramda": "^2.0.0",
|
|
88
87
|
"chai": "^4.3.4",
|
|
89
88
|
"chai-as-promised": "^7.1.1",
|
|
90
|
-
"codecov": "^3.8.
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
89
|
+
"codecov": "^3.8.3",
|
|
90
|
+
"eslint": "^7.32.0",
|
|
91
|
+
"eslint-config-standard": "^16.0.3",
|
|
92
|
+
"eslint-plugin-import": "^2.25.3",
|
|
93
|
+
"eslint-plugin-node": "^11.1.0",
|
|
94
|
+
"eslint-plugin-promise": "^5.1.1",
|
|
95
|
+
"jsdoc-to-markdown": "^7.1.0",
|
|
96
|
+
"mocha": "^9.1.3",
|
|
94
97
|
"nyc": "^15.1.0",
|
|
95
|
-
"
|
|
96
|
-
"sinon": "^11.1.1",
|
|
98
|
+
"sinon": "^12.0.1",
|
|
97
99
|
"source-map": "^0.7.3",
|
|
98
|
-
"standard-version": "^9.3.
|
|
99
|
-
"ts-node": "^10.
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"webpack": "^5.
|
|
103
|
-
"webpack-
|
|
104
|
-
"webpack-cli": "4.7.0"
|
|
100
|
+
"standard-version": "^9.3.2",
|
|
101
|
+
"ts-node": "^10.4.0",
|
|
102
|
+
"typescript": "^4.5.2",
|
|
103
|
+
"webpack": "^5.64.1",
|
|
104
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
105
|
+
"webpack-cli": "^4.9.1"
|
|
105
106
|
},
|
|
106
107
|
"files": [
|
|
107
108
|
"dist",
|
|
108
109
|
"src",
|
|
109
110
|
"es"
|
|
111
|
+
],
|
|
112
|
+
"browserslist": [
|
|
113
|
+
"> 1%",
|
|
114
|
+
"last 2 versions",
|
|
115
|
+
"not dead",
|
|
116
|
+
"not ie 11"
|
|
110
117
|
]
|
|
111
118
|
}
|
package/src/account/base.js
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
import stampit from '@stamp/it'
|
|
26
26
|
import { required } from '@stamp/required'
|
|
27
|
-
import { messageToHash,
|
|
28
|
-
import { buildTx
|
|
27
|
+
import { messageToHash, verifyMessage as verifyMessageCrypto, hash } from '../utils/crypto'
|
|
28
|
+
import { buildTx } from '../tx/builder'
|
|
29
29
|
import { decode } from '../tx/builder/helpers'
|
|
30
30
|
import { TX_TYPE } from '../tx/builder/schema'
|
|
31
31
|
import { getNetworkId } from '../node'
|
|
@@ -45,15 +45,14 @@ export const isAccountBase = (acc) => !['sign', 'address'].find(f => typeof acc[
|
|
|
45
45
|
* @rtype (tx: String) => tx: Promise[String], throws: Error
|
|
46
46
|
* @param {String} tx - Transaction to sign
|
|
47
47
|
* @param {Object} opt - Options
|
|
48
|
+
* @param {Object} [opt.innerTx] - Sign as inner transaction for PayingFor
|
|
48
49
|
* @return {String} Signed transaction
|
|
49
50
|
*/
|
|
50
|
-
async function signTransaction (tx, opt) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
buildTxHash(rlpBinaryTx, { raw: true })
|
|
56
|
-
])
|
|
51
|
+
async function signTransaction (tx, opt = {}) {
|
|
52
|
+
const prefixes = [this.getNetworkId(opt)]
|
|
53
|
+
if (opt.innerTx) prefixes.push('inner_tx')
|
|
54
|
+
const rlpBinaryTx = decode(tx, 'tx')
|
|
55
|
+
const txWithNetworkId = Buffer.concat([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)])
|
|
57
56
|
|
|
58
57
|
const signatures = [await this.sign(txWithNetworkId, opt)]
|
|
59
58
|
return buildTx({ encodedTx: rlpBinaryTx, signatures }, TX_TYPE.signed).tx
|
|
@@ -86,7 +85,9 @@ async function signMessage (message, opt = { returnHex: false }) {
|
|
|
86
85
|
* Verify message
|
|
87
86
|
* @instance
|
|
88
87
|
* @category async
|
|
89
|
-
* @rtype (
|
|
88
|
+
* @rtype (
|
|
89
|
+
* msg: String, signature: String, publicKey: String
|
|
90
|
+
* ) => signature: Promise[String], throws: Error
|
|
90
91
|
* @param {String} message - Message to verify
|
|
91
92
|
* @param {String} signature - Signature
|
|
92
93
|
* @param {Object} opt - Options
|