@locuschain/lib 0.0.10 → 0.0.11

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.
@@ -1,4 +1,4 @@
1
- define(['exports', '../index-Byqx0KIO', '../index.esm-BKiWMQOK', 'lodash', '../address-class-Dp7aNQb2'], (function (exports, utils$2, index_esm, _, addressClass) { 'use strict';
1
+ define(['exports', '../index-Byqx0KIO', 'lodash', '../address-class-Dp7aNQb2'], (function (exports, utils$2, _, addressClass) { 'use strict';
2
2
 
3
3
  function _interopNamespaceDefault(e) {
4
4
  var n = Object.create(null);
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var utils$2 = require('../index-Cg0xnkC2.js');
4
- require('../index.esm-BRidcUfn.js');
5
4
  var _ = require('lodash');
6
5
  require('../address-class-Cjy48Uqk.js');
7
6
 
@@ -1,5 +1,4 @@
1
1
  import { c as convertDataToHex, a as convertHexToAddress, b as convertAddressToHex, d as convertHexToData, _ as __awaiter } from '../index-BQ0aTXY5.js';
2
- import '../index.esm-DDuzXjei.js';
3
2
  import * as _ from 'lodash';
4
3
  import '../address-class-CHAZYhdZ.js';
5
4
 
@@ -1,4 +1,4 @@
1
- define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKiWMQOK', '../address-class-Dp7aNQb2', 'lodash'], (function (exports, utils, txType, index_esm, addressClass, _) { 'use strict';
1
+ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class-Dp7aNQb2', 'lodash'], (function (exports, utils, txType, addressClass, _) { 'use strict';
2
2
 
3
3
  class Account {
4
4
  constructor({ address, nsk }) {
@@ -80,6 +80,31 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKi
80
80
  }
81
81
  }
82
82
 
83
+ const LocusErrorCode = Object.freeze({
84
+ // RPC
85
+ RPC_ERROR: -32e3,
86
+ // LIB
87
+ ABORTED: 'ABORTED',
88
+ NET_ERROR: 'NET_ERROR',
89
+ REQUIRE_ACCOUNT: 'REQUIRE_ACCOUNT',
90
+ RUNTIME_ERROR: 'RUNTIME_ERROR',
91
+ // WALLET
92
+ ERROR: 4000,
93
+ BY_USER: 4001,
94
+ REQUIRE_OPENACCOUNT: 4002,
95
+ DUPLICATED: 4003,
96
+ NOTFOUND: 4004,
97
+ INVALID_PARAM: 4005,
98
+ TIMEOUT: 4006,
99
+ });
100
+ class LocusError extends Error {
101
+ constructor(code, message) {
102
+ super(message);
103
+ this.code = code;
104
+ this.message = message;
105
+ }
106
+ }
107
+
83
108
  class RpcProvider extends utils.Rpc {
84
109
  constructor() {
85
110
  super(...arguments);
@@ -108,7 +133,7 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKi
108
133
  request(cmd, params, rpcOption) {
109
134
  return utils.__awaiter(this, void 0, void 0, function* () {
110
135
  if (this.getSignal().aborted) {
111
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
136
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
112
137
  }
113
138
  if (this.id === Number.MAX_SAFE_INTEGER) {
114
139
  this.id = 0;
@@ -124,18 +149,18 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKi
124
149
  const callRpc1Signal = this.getSignal();
125
150
  const rpc1Result = yield this.callRpc(data, { signal: callRpc1Signal, headersInit: options.headersInit });
126
151
  if (callRpc1Signal.aborted) {
127
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
152
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
128
153
  }
129
154
  if (!utils.TX_CREATION_RPC_LIST.some(str => str === cmd)) {
130
155
  return rpc1Result;
131
156
  }
132
157
  if (!this.accountProvider)
133
- throw new index_esm.RpcError(index_esm.RpcErrorCode.REQUIRE_ACCOUNT, 'No accounts found. Please add an account before tx creation.');
158
+ throw new LocusError(LocusErrorCode.REQUIRE_ACCOUNT, 'No accounts found. Please add an account before tx creation.');
134
159
  // rpc1Result가 T(제네릭)이므로 'in' 연산자 사용을 위해 any로 캐스팅하여 체크합니다.
135
160
  const txResult = rpc1Result;
136
161
  if (!txResult || typeof txResult !== 'object' || !('hash' in txResult) || !('tx' in txResult)) {
137
162
  // console.warn('rpcResul1>>', txResult)
138
- throw new index_esm.RpcError(index_esm.RpcErrorCode.REQUIRE_ACCOUNT, 'Invalid transaction creation result.');
163
+ throw new LocusError(LocusErrorCode.REQUIRE_ACCOUNT, 'Invalid transaction creation result.');
139
164
  }
140
165
  // console.debug('rpcResul1>>', txResult)
141
166
  const additionalParams = yield this.accountProvider.signTx(txResult, params, options.address);
@@ -143,15 +168,15 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKi
143
168
  const callRpc2Signal = this.getSignal();
144
169
  const rpcResul2 = yield this.callRpc(newData, { signal: callRpc2Signal, headersInit: options.headersInit });
145
170
  if (callRpc2Signal.aborted) {
146
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
171
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
147
172
  }
148
173
  return rpcResul2;
149
174
  // console.debug('rpcResul2', rpcResult2)
150
175
  }
151
176
  catch (err) {
152
- if (err.code === index_esm.RpcErrorCode.ABORTED)
177
+ if (err.code === LocusErrorCode.ABORTED)
153
178
  throw err;
154
- throw new index_esm.RpcError(index_esm.RpcErrorCode.RUNTIME_ERROR, err.message);
179
+ throw new LocusError(LocusErrorCode.RUNTIME_ERROR, err.message);
155
180
  // console.trace(err)
156
181
  // console.log(err.stack);
157
182
  }
@@ -171,7 +196,7 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKi
171
196
  // console.debug('params', data)
172
197
  var _a;
173
198
  if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
174
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
199
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
175
200
  }
176
201
  try {
177
202
  const res = yield fetch(this.rpcUrl, {
@@ -181,16 +206,16 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../index.esm-BKi
181
206
  signal: options === null || options === void 0 ? void 0 : options.signal
182
207
  });
183
208
  if (!res.ok)
184
- throw new index_esm.RpcError(index_esm.RpcErrorCode.NET_ERROR, `node response http status : ${res.status}`);
209
+ throw new LocusError(LocusErrorCode.NET_ERROR, `node response http status : ${res.status}`);
185
210
  const response = yield res.json();
186
211
  if (response.error) {
187
212
  const { code, message } = response.error;
188
- throw new index_esm.RpcError(message === 'timeout error' ? index_esm.RpcErrorCode.TIMEOUT : code, message);
213
+ throw new LocusError(message === 'timeout error' ? LocusErrorCode.TIMEOUT : code, message);
189
214
  }
190
215
  return response.result;
191
216
  }
192
217
  catch (err) {
193
- throw new index_esm.RpcError(err.name === 'TimeoutError' ? index_esm.RpcErrorCode.TIMEOUT : index_esm.RpcErrorCode.RUNTIME_ERROR, err.message);
218
+ throw new LocusError(err.name === 'TimeoutError' ? LocusErrorCode.TIMEOUT : LocusErrorCode.RUNTIME_ERROR, err.message);
194
219
  }
195
220
  });
196
221
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  var utils = require('../index-Cg0xnkC2.js');
4
4
  var txType = require('../tx-type-jR5Owltc.js');
5
- var index_esm = require('../index.esm-BRidcUfn.js');
6
5
  require('../address-class-Cjy48Uqk.js');
7
6
  require('lodash');
8
7
 
@@ -86,6 +85,31 @@ class AccountProvider {
86
85
  }
87
86
  }
88
87
 
88
+ const LocusErrorCode = Object.freeze({
89
+ // RPC
90
+ RPC_ERROR: -32e3,
91
+ // LIB
92
+ ABORTED: 'ABORTED',
93
+ NET_ERROR: 'NET_ERROR',
94
+ REQUIRE_ACCOUNT: 'REQUIRE_ACCOUNT',
95
+ RUNTIME_ERROR: 'RUNTIME_ERROR',
96
+ // WALLET
97
+ ERROR: 4000,
98
+ BY_USER: 4001,
99
+ REQUIRE_OPENACCOUNT: 4002,
100
+ DUPLICATED: 4003,
101
+ NOTFOUND: 4004,
102
+ INVALID_PARAM: 4005,
103
+ TIMEOUT: 4006,
104
+ });
105
+ class LocusError extends Error {
106
+ constructor(code, message) {
107
+ super(message);
108
+ this.code = code;
109
+ this.message = message;
110
+ }
111
+ }
112
+
89
113
  class RpcProvider extends utils.Rpc {
90
114
  constructor() {
91
115
  super(...arguments);
@@ -114,7 +138,7 @@ class RpcProvider extends utils.Rpc {
114
138
  request(cmd, params, rpcOption) {
115
139
  return utils.__awaiter(this, void 0, void 0, function* () {
116
140
  if (this.getSignal().aborted) {
117
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
141
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
118
142
  }
119
143
  if (this.id === Number.MAX_SAFE_INTEGER) {
120
144
  this.id = 0;
@@ -130,18 +154,18 @@ class RpcProvider extends utils.Rpc {
130
154
  const callRpc1Signal = this.getSignal();
131
155
  const rpc1Result = yield this.callRpc(data, { signal: callRpc1Signal, headersInit: options.headersInit });
132
156
  if (callRpc1Signal.aborted) {
133
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
157
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
134
158
  }
135
159
  if (!utils.TX_CREATION_RPC_LIST.some(str => str === cmd)) {
136
160
  return rpc1Result;
137
161
  }
138
162
  if (!this.accountProvider)
139
- throw new index_esm.RpcError(index_esm.RpcErrorCode.REQUIRE_ACCOUNT, 'No accounts found. Please add an account before tx creation.');
163
+ throw new LocusError(LocusErrorCode.REQUIRE_ACCOUNT, 'No accounts found. Please add an account before tx creation.');
140
164
  // rpc1Result가 T(제네릭)이므로 'in' 연산자 사용을 위해 any로 캐스팅하여 체크합니다.
141
165
  const txResult = rpc1Result;
142
166
  if (!txResult || typeof txResult !== 'object' || !('hash' in txResult) || !('tx' in txResult)) {
143
167
  // console.warn('rpcResul1>>', txResult)
144
- throw new index_esm.RpcError(index_esm.RpcErrorCode.REQUIRE_ACCOUNT, 'Invalid transaction creation result.');
168
+ throw new LocusError(LocusErrorCode.REQUIRE_ACCOUNT, 'Invalid transaction creation result.');
145
169
  }
146
170
  // console.debug('rpcResul1>>', txResult)
147
171
  const additionalParams = yield this.accountProvider.signTx(txResult, params, options.address);
@@ -149,15 +173,15 @@ class RpcProvider extends utils.Rpc {
149
173
  const callRpc2Signal = this.getSignal();
150
174
  const rpcResul2 = yield this.callRpc(newData, { signal: callRpc2Signal, headersInit: options.headersInit });
151
175
  if (callRpc2Signal.aborted) {
152
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
176
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
153
177
  }
154
178
  return rpcResul2;
155
179
  // console.debug('rpcResul2', rpcResult2)
156
180
  }
157
181
  catch (err) {
158
- if (err.code === index_esm.RpcErrorCode.ABORTED)
182
+ if (err.code === LocusErrorCode.ABORTED)
159
183
  throw err;
160
- throw new index_esm.RpcError(index_esm.RpcErrorCode.RUNTIME_ERROR, err.message);
184
+ throw new LocusError(LocusErrorCode.RUNTIME_ERROR, err.message);
161
185
  // console.trace(err)
162
186
  // console.log(err.stack);
163
187
  }
@@ -177,7 +201,7 @@ class HttpRpcProvider extends RpcProvider {
177
201
  // console.debug('params', data)
178
202
  var _a;
179
203
  if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
180
- throw new index_esm.RpcError(index_esm.RpcErrorCode.ABORTED, `rpc aborted by user`);
204
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
181
205
  }
182
206
  try {
183
207
  const res = yield fetch(this.rpcUrl, {
@@ -187,16 +211,16 @@ class HttpRpcProvider extends RpcProvider {
187
211
  signal: options === null || options === void 0 ? void 0 : options.signal
188
212
  });
189
213
  if (!res.ok)
190
- throw new index_esm.RpcError(index_esm.RpcErrorCode.NET_ERROR, `node response http status : ${res.status}`);
214
+ throw new LocusError(LocusErrorCode.NET_ERROR, `node response http status : ${res.status}`);
191
215
  const response = yield res.json();
192
216
  if (response.error) {
193
217
  const { code, message } = response.error;
194
- throw new index_esm.RpcError(message === 'timeout error' ? index_esm.RpcErrorCode.TIMEOUT : code, message);
218
+ throw new LocusError(message === 'timeout error' ? LocusErrorCode.TIMEOUT : code, message);
195
219
  }
196
220
  return response.result;
197
221
  }
198
222
  catch (err) {
199
- throw new index_esm.RpcError(err.name === 'TimeoutError' ? index_esm.RpcErrorCode.TIMEOUT : index_esm.RpcErrorCode.RUNTIME_ERROR, err.message);
223
+ throw new LocusError(err.name === 'TimeoutError' ? LocusErrorCode.TIMEOUT : LocusErrorCode.RUNTIME_ERROR, err.message);
200
224
  }
201
225
  });
202
226
  }
@@ -1,6 +1,5 @@
1
1
  import { s as sign, _ as __awaiter, v as verifyTxParams, R as Rpc, T as TX_CREATION_RPC_LIST } from '../index-BQ0aTXY5.js';
2
2
  import { T as TxType } from '../tx-type-nyLU5xv5.js';
3
- import { R as RpcError, a as RpcErrorCode } from '../index.esm-DDuzXjei.js';
4
3
  import '../address-class-CHAZYhdZ.js';
5
4
  import 'lodash';
6
5
 
@@ -84,6 +83,31 @@ class AccountProvider {
84
83
  }
85
84
  }
86
85
 
86
+ const LocusErrorCode = Object.freeze({
87
+ // RPC
88
+ RPC_ERROR: -32e3,
89
+ // LIB
90
+ ABORTED: 'ABORTED',
91
+ NET_ERROR: 'NET_ERROR',
92
+ REQUIRE_ACCOUNT: 'REQUIRE_ACCOUNT',
93
+ RUNTIME_ERROR: 'RUNTIME_ERROR',
94
+ // WALLET
95
+ ERROR: 4000,
96
+ BY_USER: 4001,
97
+ REQUIRE_OPENACCOUNT: 4002,
98
+ DUPLICATED: 4003,
99
+ NOTFOUND: 4004,
100
+ INVALID_PARAM: 4005,
101
+ TIMEOUT: 4006,
102
+ });
103
+ class LocusError extends Error {
104
+ constructor(code, message) {
105
+ super(message);
106
+ this.code = code;
107
+ this.message = message;
108
+ }
109
+ }
110
+
87
111
  class RpcProvider extends Rpc {
88
112
  constructor() {
89
113
  super(...arguments);
@@ -112,7 +136,7 @@ class RpcProvider extends Rpc {
112
136
  request(cmd, params, rpcOption) {
113
137
  return __awaiter(this, void 0, void 0, function* () {
114
138
  if (this.getSignal().aborted) {
115
- throw new RpcError(RpcErrorCode.ABORTED, `rpc aborted by user`);
139
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
116
140
  }
117
141
  if (this.id === Number.MAX_SAFE_INTEGER) {
118
142
  this.id = 0;
@@ -128,18 +152,18 @@ class RpcProvider extends Rpc {
128
152
  const callRpc1Signal = this.getSignal();
129
153
  const rpc1Result = yield this.callRpc(data, { signal: callRpc1Signal, headersInit: options.headersInit });
130
154
  if (callRpc1Signal.aborted) {
131
- throw new RpcError(RpcErrorCode.ABORTED, `rpc aborted by user`);
155
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
132
156
  }
133
157
  if (!TX_CREATION_RPC_LIST.some(str => str === cmd)) {
134
158
  return rpc1Result;
135
159
  }
136
160
  if (!this.accountProvider)
137
- throw new RpcError(RpcErrorCode.REQUIRE_ACCOUNT, 'No accounts found. Please add an account before tx creation.');
161
+ throw new LocusError(LocusErrorCode.REQUIRE_ACCOUNT, 'No accounts found. Please add an account before tx creation.');
138
162
  // rpc1Result가 T(제네릭)이므로 'in' 연산자 사용을 위해 any로 캐스팅하여 체크합니다.
139
163
  const txResult = rpc1Result;
140
164
  if (!txResult || typeof txResult !== 'object' || !('hash' in txResult) || !('tx' in txResult)) {
141
165
  // console.warn('rpcResul1>>', txResult)
142
- throw new RpcError(RpcErrorCode.REQUIRE_ACCOUNT, 'Invalid transaction creation result.');
166
+ throw new LocusError(LocusErrorCode.REQUIRE_ACCOUNT, 'Invalid transaction creation result.');
143
167
  }
144
168
  // console.debug('rpcResul1>>', txResult)
145
169
  const additionalParams = yield this.accountProvider.signTx(txResult, params, options.address);
@@ -147,15 +171,15 @@ class RpcProvider extends Rpc {
147
171
  const callRpc2Signal = this.getSignal();
148
172
  const rpcResul2 = yield this.callRpc(newData, { signal: callRpc2Signal, headersInit: options.headersInit });
149
173
  if (callRpc2Signal.aborted) {
150
- throw new RpcError(RpcErrorCode.ABORTED, `rpc aborted by user`);
174
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
151
175
  }
152
176
  return rpcResul2;
153
177
  // console.debug('rpcResul2', rpcResult2)
154
178
  }
155
179
  catch (err) {
156
- if (err.code === RpcErrorCode.ABORTED)
180
+ if (err.code === LocusErrorCode.ABORTED)
157
181
  throw err;
158
- throw new RpcError(RpcErrorCode.RUNTIME_ERROR, err.message);
182
+ throw new LocusError(LocusErrorCode.RUNTIME_ERROR, err.message);
159
183
  // console.trace(err)
160
184
  // console.log(err.stack);
161
185
  }
@@ -175,7 +199,7 @@ class HttpRpcProvider extends RpcProvider {
175
199
  // console.debug('params', data)
176
200
  var _a;
177
201
  if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
178
- throw new RpcError(RpcErrorCode.ABORTED, `rpc aborted by user`);
202
+ throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
179
203
  }
180
204
  try {
181
205
  const res = yield fetch(this.rpcUrl, {
@@ -185,16 +209,16 @@ class HttpRpcProvider extends RpcProvider {
185
209
  signal: options === null || options === void 0 ? void 0 : options.signal
186
210
  });
187
211
  if (!res.ok)
188
- throw new RpcError(RpcErrorCode.NET_ERROR, `node response http status : ${res.status}`);
212
+ throw new LocusError(LocusErrorCode.NET_ERROR, `node response http status : ${res.status}`);
189
213
  const response = yield res.json();
190
214
  if (response.error) {
191
215
  const { code, message } = response.error;
192
- throw new RpcError(message === 'timeout error' ? RpcErrorCode.TIMEOUT : code, message);
216
+ throw new LocusError(message === 'timeout error' ? LocusErrorCode.TIMEOUT : code, message);
193
217
  }
194
218
  return response.result;
195
219
  }
196
220
  catch (err) {
197
- throw new RpcError(err.name === 'TimeoutError' ? RpcErrorCode.TIMEOUT : RpcErrorCode.RUNTIME_ERROR, err.message);
221
+ throw new LocusError(err.name === 'TimeoutError' ? LocusErrorCode.TIMEOUT : LocusErrorCode.RUNTIME_ERROR, err.message);
198
222
  }
199
223
  });
200
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locuschain/lib",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "author": "bloomtechnology",
6
6
  "license": "MIT",
@@ -70,7 +70,7 @@
70
70
  "dependencies": {
71
71
  "lodash": "^4.17.21",
72
72
  "wasm-opt": "^1.4.0",
73
- "@locuschain/errors": "1.0.3"
73
+ "@locuschain/errors": "1.0.5"
74
74
  },
75
75
  "scripts": {
76
76
  "generate-code": "generate-code.sh",
@@ -1,22 +0,0 @@
1
- define(['exports'], (function (exports) { 'use strict';
2
-
3
- exports.RpcErrorCode = void 0;
4
- (function (RpcErrorCode) {
5
- RpcErrorCode["ERROR"] = "LOCUSLIB_ERROR";
6
- RpcErrorCode["RUNTIME_ERROR"] = "LOCUSLIB_RUNTIME_ERROR";
7
- RpcErrorCode["NET_ERROR"] = "LOCUSLIB_NET_ERROR";
8
- RpcErrorCode["TIMEOUT"] = "LOCUSLIB_TIMEOUT";
9
- RpcErrorCode["ABORTED"] = "LOCUSLIB_ABORTED";
10
- RpcErrorCode["REQUIRE_ACCOUNT"] = "LOCUSLIB_REQUIRE_ACCOUNT";
11
- })(exports.RpcErrorCode || (exports.RpcErrorCode = {}));
12
- class RpcError extends Error {
13
- constructor(code, message) {
14
- super(message);
15
- this.code = code;
16
- this.message = message;
17
- }
18
- }
19
-
20
- exports.RpcError = RpcError;
21
-
22
- }));
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- exports.RpcErrorCode = void 0;
4
- (function (RpcErrorCode) {
5
- RpcErrorCode["ERROR"] = "LOCUSLIB_ERROR";
6
- RpcErrorCode["RUNTIME_ERROR"] = "LOCUSLIB_RUNTIME_ERROR";
7
- RpcErrorCode["NET_ERROR"] = "LOCUSLIB_NET_ERROR";
8
- RpcErrorCode["TIMEOUT"] = "LOCUSLIB_TIMEOUT";
9
- RpcErrorCode["ABORTED"] = "LOCUSLIB_ABORTED";
10
- RpcErrorCode["REQUIRE_ACCOUNT"] = "LOCUSLIB_REQUIRE_ACCOUNT";
11
- })(exports.RpcErrorCode || (exports.RpcErrorCode = {}));
12
- class RpcError extends Error {
13
- constructor(code, message) {
14
- super(message);
15
- this.code = code;
16
- this.message = message;
17
- }
18
- }
19
-
20
- exports.RpcError = RpcError;
@@ -1,18 +0,0 @@
1
- var RpcErrorCode;
2
- (function (RpcErrorCode) {
3
- RpcErrorCode["ERROR"] = "LOCUSLIB_ERROR";
4
- RpcErrorCode["RUNTIME_ERROR"] = "LOCUSLIB_RUNTIME_ERROR";
5
- RpcErrorCode["NET_ERROR"] = "LOCUSLIB_NET_ERROR";
6
- RpcErrorCode["TIMEOUT"] = "LOCUSLIB_TIMEOUT";
7
- RpcErrorCode["ABORTED"] = "LOCUSLIB_ABORTED";
8
- RpcErrorCode["REQUIRE_ACCOUNT"] = "LOCUSLIB_REQUIRE_ACCOUNT";
9
- })(RpcErrorCode || (RpcErrorCode = {}));
10
- class RpcError extends Error {
11
- constructor(code, message) {
12
- super(message);
13
- this.code = code;
14
- this.message = message;
15
- }
16
- }
17
-
18
- export { RpcError as R, RpcErrorCode as a };