hivesigner 3.3.5 → 4.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/README.md +13 -0
- package/lib/client.d.ts +1 -2
- package/lib/hivesigner.min.js +1 -10
- package/lib/index.js +135 -224
- package/lib/methods/send-operation.method.d.ts +1 -2
- package/lib/methods/send-operations.method.d.ts +1 -2
- package/lib/methods/send-transaction.method.d.ts +1 -2
- package/lib/types/callback-function.type.d.ts +1 -1
- package/lib/types/hive.types.d.ts +13 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/send-response.type.d.ts +1 -1
- package/package.json +8 -18
- package/rollup.config.js +4 -3
- package/src/client.spec.ts +28 -30
- package/src/client.ts +8 -7
- package/src/methods/send-operation.method.spec.ts +1 -1
- package/src/methods/send-operation.method.ts +1 -2
- package/src/methods/send-operations.method.spec.ts +1 -1
- package/src/methods/send-operations.method.ts +1 -2
- package/src/methods/send-transaction.method.spec.ts +1 -1
- package/src/methods/send-transaction.method.ts +1 -2
- package/src/require-import.spec.js +6 -1
- package/src/types/hive.types.ts +12 -0
- package/src/types/index.ts +1 -0
- package/tsconfig.json +3 -1
- package/webpack.config.js +8 -1
- package/.babelrc +0 -8
package/lib/index.js
CHANGED
|
@@ -2,80 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var crossFetch = require('cross-fetch');
|
|
6
5
|
var hiveUri = require('hive-uri');
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
const API_URL = 'https://hivesigner.com';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
const BASE_URL = 'https://hivesigner.com';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
Copyright (c) Microsoft Corporation.
|
|
14
|
-
|
|
15
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
-
purpose with or without fee is hereby granted.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
-
***************************************************************************** */
|
|
26
|
-
|
|
27
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
28
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function __generator(thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
44
|
-
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;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
var API_URL = 'https://hivesigner.com';
|
|
66
|
-
|
|
67
|
-
var BASE_URL = 'https://hivesigner.com';
|
|
68
|
-
|
|
69
|
-
var BETA_URL = 'https://hivesigner.com';
|
|
11
|
+
const BETA_URL = 'https://hivesigner.com';
|
|
70
12
|
|
|
71
13
|
function isBrowser() {
|
|
72
14
|
return typeof window !== 'undefined' && !!window;
|
|
73
15
|
}
|
|
74
16
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var Client = /** @class */ (function () {
|
|
78
|
-
function Client(config) {
|
|
17
|
+
class Client {
|
|
18
|
+
constructor(config) {
|
|
79
19
|
this.apiURL = config.apiURL || API_URL;
|
|
80
20
|
this.app = config.app;
|
|
81
21
|
this.callbackURL = config.callbackURL;
|
|
@@ -83,203 +23,174 @@ var Client = /** @class */ (function () {
|
|
|
83
23
|
this.scope = config.scope;
|
|
84
24
|
this.responseType = config.responseType;
|
|
85
25
|
}
|
|
86
|
-
|
|
26
|
+
setBaseURL() {
|
|
87
27
|
console.warn('The function "setBaseUrl" is deprecated, the base URL is always "https://hivesigner.com", you can only change the API URL with "setApiURL"');
|
|
88
28
|
return this;
|
|
89
|
-
}
|
|
90
|
-
|
|
29
|
+
}
|
|
30
|
+
setApiURL(url) {
|
|
91
31
|
this.apiURL = url;
|
|
92
32
|
return this;
|
|
93
|
-
}
|
|
94
|
-
|
|
33
|
+
}
|
|
34
|
+
setApp(app) {
|
|
95
35
|
this.app = app;
|
|
96
36
|
return this;
|
|
97
|
-
}
|
|
98
|
-
|
|
37
|
+
}
|
|
38
|
+
setCallbackURL(url) {
|
|
99
39
|
this.callbackURL = url;
|
|
100
40
|
return this;
|
|
101
|
-
}
|
|
102
|
-
|
|
41
|
+
}
|
|
42
|
+
setAccessToken(accessToken) {
|
|
103
43
|
this.accessToken = accessToken;
|
|
104
44
|
return this;
|
|
105
|
-
}
|
|
106
|
-
|
|
45
|
+
}
|
|
46
|
+
removeAccessToken() {
|
|
107
47
|
delete this.accessToken;
|
|
108
48
|
return this;
|
|
109
|
-
}
|
|
110
|
-
|
|
49
|
+
}
|
|
50
|
+
setScope(scope) {
|
|
111
51
|
this.scope = scope;
|
|
112
52
|
return this;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
53
|
+
}
|
|
54
|
+
getLoginURL(state, account) {
|
|
55
|
+
const redirectUri = encodeURIComponent(this.callbackURL);
|
|
56
|
+
let loginURL = `${BASE_URL}/oauth2/authorize?client_id=${this.app}&redirect_uri=${redirectUri}`;
|
|
117
57
|
if (this.responseType === 'code') {
|
|
118
|
-
loginURL +=
|
|
58
|
+
loginURL += `&response_type=${this.responseType}`;
|
|
119
59
|
}
|
|
120
60
|
if (this.scope) {
|
|
121
|
-
loginURL +=
|
|
61
|
+
loginURL += `&scope=${this.scope.join(',')}`;
|
|
122
62
|
}
|
|
123
63
|
if (state) {
|
|
124
|
-
loginURL +=
|
|
64
|
+
loginURL += `&state=${encodeURIComponent(state)}`;
|
|
125
65
|
}
|
|
126
66
|
if (account) {
|
|
127
|
-
loginURL +=
|
|
67
|
+
loginURL += `&account=${encodeURIComponent(account)}`;
|
|
128
68
|
}
|
|
129
69
|
return loginURL;
|
|
130
|
-
}
|
|
131
|
-
|
|
70
|
+
}
|
|
71
|
+
login(options) {
|
|
132
72
|
if (isBrowser()) {
|
|
133
73
|
// @ts-ignore
|
|
134
74
|
window.location = this.getLoginURL(options.state);
|
|
135
75
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
76
|
+
}
|
|
77
|
+
me(cb) {
|
|
138
78
|
return this.send('me', 'POST', {}, cb);
|
|
139
|
-
}
|
|
140
|
-
|
|
79
|
+
}
|
|
80
|
+
decode(memo, cb) {
|
|
141
81
|
return this.send('decode', 'POST', { memo: memo }, cb);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
voter
|
|
146
|
-
author
|
|
147
|
-
permlink
|
|
148
|
-
weight
|
|
82
|
+
}
|
|
83
|
+
vote(voter, author, permlink, weight, cb) {
|
|
84
|
+
const params = {
|
|
85
|
+
voter,
|
|
86
|
+
author,
|
|
87
|
+
permlink,
|
|
88
|
+
weight
|
|
149
89
|
};
|
|
150
90
|
return this.broadcast([['vote', params]], cb);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
91
|
+
}
|
|
92
|
+
comment(parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, cb) {
|
|
93
|
+
let json = jsonMetadata;
|
|
154
94
|
if (typeof jsonMetadata !== 'string') {
|
|
155
95
|
json = JSON.stringify(jsonMetadata);
|
|
156
96
|
}
|
|
157
|
-
|
|
97
|
+
const params = {
|
|
158
98
|
parent_author: parentAuthor,
|
|
159
99
|
parent_permlink: parentPermlink,
|
|
160
|
-
author
|
|
161
|
-
permlink
|
|
162
|
-
title
|
|
163
|
-
body
|
|
100
|
+
author,
|
|
101
|
+
permlink,
|
|
102
|
+
title,
|
|
103
|
+
body,
|
|
164
104
|
json_metadata: json
|
|
165
105
|
};
|
|
166
106
|
return this.broadcast([['comment', params]], cb);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
author
|
|
171
|
-
permlink
|
|
107
|
+
}
|
|
108
|
+
deleteComment(author, permlink, cb) {
|
|
109
|
+
const params = {
|
|
110
|
+
author,
|
|
111
|
+
permlink
|
|
172
112
|
};
|
|
173
113
|
return this.broadcast([['delete_comment', params]], cb);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
114
|
+
}
|
|
115
|
+
customJson(requiredAuths, requiredPostingAuths, id, json, cb) {
|
|
116
|
+
const params = {
|
|
177
117
|
required_auths: requiredAuths,
|
|
178
118
|
required_posting_auths: requiredPostingAuths,
|
|
179
|
-
id
|
|
180
|
-
json
|
|
119
|
+
id,
|
|
120
|
+
json
|
|
181
121
|
};
|
|
182
122
|
return this.broadcast([['custom_json', params]], cb);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
123
|
+
}
|
|
124
|
+
reblog(account, author, permlink, cb) {
|
|
125
|
+
const json = ['reblog', { account, author, permlink }];
|
|
186
126
|
return this.customJson([], [account], 'follow', JSON.stringify(json), cb);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
127
|
+
}
|
|
128
|
+
follow(follower, following, cb) {
|
|
129
|
+
const json = ['follow', { follower, following, what: ['blog'] }];
|
|
190
130
|
return this.customJson([], [follower], 'follow', JSON.stringify(json), cb);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
131
|
+
}
|
|
132
|
+
unfollow(unfollower, unfollowing, cb) {
|
|
133
|
+
const json = ['follow', { follower: unfollower, following: unfollowing, what: [] }];
|
|
194
134
|
return this.customJson([], [unfollower], 'follow', JSON.stringify(json), cb);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
135
|
+
}
|
|
136
|
+
ignore(follower, following, cb) {
|
|
137
|
+
const json = ['follow', { follower, following, what: ['ignore'] }];
|
|
198
138
|
return this.customJson([], [follower], 'follow', JSON.stringify(json), cb);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
account
|
|
139
|
+
}
|
|
140
|
+
claimRewardBalance(account, rewardHive, rewardHbd, rewardVests, cb) {
|
|
141
|
+
const params = {
|
|
142
|
+
account,
|
|
203
143
|
reward_hive: rewardHive,
|
|
204
144
|
reward_hbd: rewardHbd,
|
|
205
145
|
reward_vests: rewardVests
|
|
206
146
|
};
|
|
207
147
|
return this.broadcast([['claim_reward_balance', params]], cb);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
case 1:
|
|
215
|
-
_a.sent();
|
|
216
|
-
return [2 /*return*/, this.removeAccessToken()];
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
|
-
Client.prototype.updateUserMetadata = function (metadata, cb) {
|
|
222
|
-
if (metadata === void 0) { metadata = {}; }
|
|
148
|
+
}
|
|
149
|
+
async revokeToken(cb) {
|
|
150
|
+
await this.send('oauth2/token/revoke', 'POST', { token: this.accessToken }, cb);
|
|
151
|
+
return this.removeAccessToken();
|
|
152
|
+
}
|
|
153
|
+
updateUserMetadata(metadata = {}, cb) {
|
|
223
154
|
console.warn('The function "updateUserMetadata" is deprecated.');
|
|
224
155
|
return this.send('me', 'PUT', { user_metadata: metadata }, cb);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return __awaiter(this, void 0, Promise, function () {
|
|
256
|
-
var response, json;
|
|
257
|
-
return __generator(this, function (_a) {
|
|
258
|
-
switch (_a.label) {
|
|
259
|
-
case 0: return [4 /*yield*/, fetch(url, {
|
|
260
|
-
method: method,
|
|
261
|
-
headers: {
|
|
262
|
-
Accept: 'application/json, text/plain, */*',
|
|
263
|
-
'Content-Type': 'application/json',
|
|
264
|
-
Authorization: this.accessToken,
|
|
265
|
-
},
|
|
266
|
-
body: JSON.stringify(body),
|
|
267
|
-
})];
|
|
268
|
-
case 1:
|
|
269
|
-
response = _a.sent();
|
|
270
|
-
return [4 /*yield*/, response.json()];
|
|
271
|
-
case 2:
|
|
272
|
-
json = _a.sent();
|
|
273
|
-
if (response.status !== 200 || json.error) {
|
|
274
|
-
throw json;
|
|
275
|
-
}
|
|
276
|
-
return [2 /*return*/, json];
|
|
277
|
-
}
|
|
278
|
-
});
|
|
156
|
+
}
|
|
157
|
+
async send(route, method, body, cb) {
|
|
158
|
+
const url = `${this.apiURL}/api/${route}`;
|
|
159
|
+
if (!cb) {
|
|
160
|
+
return this.makeRequest(url, method, body);
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const json = await this.makeRequest(url, method, body);
|
|
164
|
+
return cb(null, json);
|
|
165
|
+
}
|
|
166
|
+
catch (failureResponse) {
|
|
167
|
+
return cb(failureResponse, null);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
broadcast(operations, cb) {
|
|
171
|
+
return this.send('broadcast', 'POST', { operations }, cb);
|
|
172
|
+
}
|
|
173
|
+
async makeRequest(url, method, body) {
|
|
174
|
+
if (typeof globalThis.fetch !== 'function') {
|
|
175
|
+
throw new Error('hivesigner: fetch is not available. Node.js 18+ or a modern browser is required. ' +
|
|
176
|
+
'If you are in an older environment, provide a global fetch polyfill.');
|
|
177
|
+
}
|
|
178
|
+
const response = await globalThis.fetch(url, {
|
|
179
|
+
method,
|
|
180
|
+
headers: {
|
|
181
|
+
Accept: 'application/json, text/plain, */*',
|
|
182
|
+
'Content-Type': 'application/json',
|
|
183
|
+
Authorization: this.accessToken,
|
|
184
|
+
},
|
|
185
|
+
body: JSON.stringify(body),
|
|
279
186
|
});
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
187
|
+
const json = await response.json();
|
|
188
|
+
if (response.status !== 200 || json.error) {
|
|
189
|
+
throw json;
|
|
190
|
+
}
|
|
191
|
+
return json;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
283
194
|
|
|
284
195
|
function sign(name, params, redirectUri) {
|
|
285
196
|
console.warn('The function "sign" is deprecated.');
|
|
@@ -289,39 +200,39 @@ function sign(name, params, redirectUri) {
|
|
|
289
200
|
error_description: 'Request has an invalid format'
|
|
290
201
|
};
|
|
291
202
|
}
|
|
292
|
-
|
|
203
|
+
let url = `${BASE_URL}/sign/${name}?`;
|
|
293
204
|
url += Object.keys(params)
|
|
294
|
-
.map(
|
|
205
|
+
.map(key => `${key}=${encodeURIComponent(params[key])}`)
|
|
295
206
|
.join('&');
|
|
296
|
-
url += redirectUri ?
|
|
207
|
+
url += redirectUri ? `&redirect_uri=${encodeURIComponent(redirectUri)}` : '';
|
|
297
208
|
return url;
|
|
298
209
|
}
|
|
299
210
|
|
|
300
211
|
function sendOperation(op, params, cb) {
|
|
301
|
-
|
|
302
|
-
|
|
212
|
+
const uri = hiveUri.encodeOp(op, params);
|
|
213
|
+
const webUrl = uri.replace('hive://', `${BETA_URL}/`);
|
|
303
214
|
if (cb && isBrowser()) {
|
|
304
|
-
|
|
215
|
+
const win = window.open(webUrl, '_blank');
|
|
305
216
|
return win.focus();
|
|
306
217
|
}
|
|
307
218
|
return webUrl;
|
|
308
219
|
}
|
|
309
220
|
|
|
310
221
|
function sendOperations(ops, params, cb) {
|
|
311
|
-
|
|
312
|
-
|
|
222
|
+
const uri = hiveUri.encodeOps(ops, params);
|
|
223
|
+
const webUrl = uri.replace('hive://', `${BETA_URL}/`);
|
|
313
224
|
if (cb && isBrowser()) {
|
|
314
|
-
|
|
225
|
+
const win = window.open(webUrl, '_blank');
|
|
315
226
|
return win.focus();
|
|
316
227
|
}
|
|
317
228
|
return webUrl;
|
|
318
229
|
}
|
|
319
230
|
|
|
320
231
|
function sendTransaction(tx, params, cb) {
|
|
321
|
-
|
|
322
|
-
|
|
232
|
+
const uri = hiveUri.encodeTx(tx, params);
|
|
233
|
+
const webUrl = uri.replace('hive://', `${BETA_URL}/`);
|
|
323
234
|
if (cb && isBrowser()) {
|
|
324
|
-
|
|
235
|
+
const win = window.open(webUrl, '_blank');
|
|
325
236
|
return win.focus();
|
|
326
237
|
}
|
|
327
238
|
return webUrl;
|
|
@@ -333,17 +244,17 @@ function Initialize(config) {
|
|
|
333
244
|
}
|
|
334
245
|
|
|
335
246
|
var index = {
|
|
336
|
-
Client
|
|
337
|
-
Initialize
|
|
338
|
-
sendTransaction
|
|
339
|
-
sendOperations
|
|
340
|
-
sendOperation
|
|
341
|
-
sign
|
|
247
|
+
Client,
|
|
248
|
+
Initialize,
|
|
249
|
+
sendTransaction,
|
|
250
|
+
sendOperations,
|
|
251
|
+
sendOperation,
|
|
252
|
+
sign
|
|
342
253
|
};
|
|
343
254
|
|
|
344
255
|
exports.Client = Client;
|
|
345
256
|
exports.Initialize = Initialize;
|
|
346
|
-
exports
|
|
257
|
+
exports["default"] = index;
|
|
347
258
|
exports.sendOperation = sendOperation;
|
|
348
259
|
exports.sendOperations = sendOperations;
|
|
349
260
|
exports.sendTransaction = sendTransaction;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Parameters } from 'hive-uri';
|
|
2
|
-
import { CallbackFunction } from '../types';
|
|
3
|
-
import { Operation } from '@hiveio/dhive';
|
|
2
|
+
import { CallbackFunction, Operation } from '../types';
|
|
4
3
|
export declare function sendOperation(op: Operation, params: Parameters, cb: CallbackFunction): string | void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Parameters } from 'hive-uri';
|
|
2
|
-
import { CallbackFunction } from '../types';
|
|
3
|
-
import { Operation } from '@hiveio/dhive';
|
|
2
|
+
import { CallbackFunction, Operation } from '../types';
|
|
4
3
|
export declare function sendOperations(ops: Operation[], params: Parameters, cb: CallbackFunction): string | void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Parameters } from 'hive-uri';
|
|
2
|
-
import { CallbackFunction } from '../types';
|
|
3
|
-
import { Transaction } from '@hiveio/dhive';
|
|
2
|
+
import { CallbackFunction, Transaction } from '../types';
|
|
4
3
|
export declare function sendTransaction(tx: Transaction, params: Parameters, cb: CallbackFunction): string | void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type CallbackFunction = (error: any, response: any) => any;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type SendResponse = any;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hivesigner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Hivesigner SDK",
|
|
5
5
|
"main": "./lib/index",
|
|
6
6
|
"types": "./lib/index",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "rimraf lib &&
|
|
8
|
+
"build": "rimraf lib && webpack && rollup -c rollup.config.js && tsc --emitDeclarationOnly",
|
|
9
9
|
"test": "npx jest",
|
|
10
10
|
"lint": "eslint ./src/**/*.ts"
|
|
11
11
|
},
|
|
@@ -15,41 +15,31 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "Ecency <hello@ecency.com>",
|
|
17
17
|
"license": "MIT",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.0.0"
|
|
20
|
+
},
|
|
18
21
|
"bugs": {
|
|
19
22
|
"url": "https://github.com/ecency/hivesigner-sdk/issues"
|
|
20
23
|
},
|
|
21
24
|
"homepage": "https://github.com/ecency/hivesigner-sdk#readme",
|
|
22
25
|
"devDependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
25
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
|
|
26
|
-
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.13.9",
|
|
28
|
-
"@babel/preset-env": "^7.13.9",
|
|
29
|
-
"@babel/preset-typescript": "^7.13.0",
|
|
30
|
-
"@hiveio/dhive": "^1.2.6",
|
|
31
|
-
"@types/bytebuffer": "^5.0.42",
|
|
26
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
32
27
|
"@types/jest": "^26.0.20",
|
|
33
28
|
"@types/node": "^14.14.28",
|
|
34
29
|
"@typescript-eslint/eslint-plugin": "^4.15.1",
|
|
35
30
|
"@typescript-eslint/parser": "^4.15.1",
|
|
36
|
-
"babel-core": "^6.26.3",
|
|
37
|
-
"babel-loader": "^8.2.2",
|
|
38
31
|
"eslint": "^7.20.0",
|
|
39
32
|
"jest": "^26.6.3",
|
|
40
33
|
"rollup": "^2.40.0",
|
|
41
|
-
"rollup-plugin-typescript": "^1.0.1",
|
|
42
34
|
"ts-jest": "^26.5.1",
|
|
43
35
|
"ts-loader": "^8.0.17",
|
|
44
36
|
"ts-node": "^9.1.1",
|
|
45
37
|
"tslib": "^2.1.0",
|
|
46
38
|
"typescript": "^4.1.5",
|
|
47
|
-
"webpack": "^
|
|
48
|
-
"webpack-cli": "^
|
|
39
|
+
"webpack": "^5.105.4",
|
|
40
|
+
"webpack-cli": "^7.0.2"
|
|
49
41
|
},
|
|
50
42
|
"dependencies": {
|
|
51
|
-
"@babel/runtime": "^7.13.9",
|
|
52
|
-
"cross-fetch": "^3.0.6",
|
|
53
43
|
"hive-uri": "^0.2.4"
|
|
54
44
|
}
|
|
55
45
|
}
|
package/rollup.config.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import typescript from 'rollup
|
|
1
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
input: './src/index.ts',
|
|
5
5
|
output: {
|
|
6
|
-
|
|
6
|
+
file: 'lib/index.js',
|
|
7
7
|
format: 'cjs',
|
|
8
|
+
exports: 'named',
|
|
8
9
|
},
|
|
9
10
|
plugins: [
|
|
10
|
-
typescript()
|
|
11
|
+
typescript({ declaration: false, sourceMap: false, module: 'esnext' })
|
|
11
12
|
]
|
|
12
13
|
}
|