@locuschain/lib 0.1.37 → 0.1.39
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/dist/accounts/index.amd.js +306 -0
- package/dist/accounts/index.cjs.cjs +2 -2
- package/dist/accounts/index.esm.js +2 -2
- package/dist/autogen/index.amd.js +151 -0
- package/dist/autogen/index.cjs.cjs +2 -2
- package/dist/autogen/index.esm.js +2 -2
- package/dist/chunks/account-BSrvZ7S8.js +77 -0
- package/dist/chunks/address-class-Dp7aNQb2.js +18 -0
- package/dist/chunks/base-B_kRRfsf.js +27 -0
- package/dist/chunks/debugWalletActions-BDz-h2tl.js +993 -0
- package/dist/chunks/{keystore-BFVSylSw.js → keystore-BMgBWq6G.js} +1 -1
- package/dist/chunks/{keystore-BbK5pVrh.cjs → keystore-CjcbAa1r.cjs} +1 -1
- package/dist/chunks/keystore-D7_ZZNzS.js +143 -0
- package/dist/chunks/{lclib-C2eG5HzD.js → lclib-BlnZKIGv.js} +43 -27
- package/dist/chunks/lclib-DBHaYcY8.js +3854 -0
- package/dist/chunks/{lclib-DuoOR0-Q.cjs → lclib-xRDGxtgw.cjs} +52 -36
- package/dist/chunks/rpc-C4n7t9y0.js +25 -0
- package/dist/chunks/transport-BBAz1kmP.js +30 -0
- package/dist/chunks/tslib.es6-D29rxPkW.js +37 -0
- package/dist/chunks/tx-type-CS4wIUJ8.js +68 -0
- package/dist/chunks/wasm-BCEa0JCQ.js +213 -0
- package/dist/chunks/{wasm-BtPcXTR4.js → wasm-C4WNl2YQ.js} +1 -1
- package/dist/chunks/{wasm-DTyHBxcY.cjs → wasm-D4S52Ifh.cjs} +1 -1
- package/dist/clients/index.amd.js +97 -0
- package/dist/clients/index.cjs.cjs +1 -1
- package/dist/clients/index.esm.js +1 -1
- package/dist/constant/index.amd.js +458 -0
- package/dist/contracts/index.amd.js +19640 -0
- package/dist/contracts/index.cjs.cjs +2 -2
- package/dist/contracts/index.esm.js +2 -2
- package/dist/errors/index.amd.js +17 -0
- package/dist/index.amd.js +43 -0
- package/dist/index.cjs.cjs +3 -3
- package/dist/index.esm.js +3 -3
- package/dist/transports/index.amd.js +98 -0
- package/dist/utils/index.amd.js +353 -0
- package/dist/utils/index.cjs.cjs +3 -3
- package/dist/utils/index.esm.js +4 -4
- package/dist/vite-plugin/index.amd.js +186 -0
- package/dist/vite-plugin/index.cjs.cjs +189 -0
- package/dist/vite-plugin/index.d.cts +46 -0
- package/dist/vite-plugin/index.d.mts +46 -0
- package/dist/vite-plugin/index.esm.js +183 -0
- package/dist/webpack-plugin/index.amd.js +101 -0
- package/dist/webpack-plugin/index.cjs.cjs +104 -0
- package/dist/webpack-plugin/index.d.cts +46 -0
- package/dist/webpack-plugin/index.d.mts +46 -0
- package/dist/webpack-plugin/index.esm.js +98 -0
- package/package.json +36 -6
- package/dist/index.umd.d.mts +0 -15
- package/dist/umd/index.umd.js +0 -26296
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
define(['exports', '../chunks/tslib.es6-D29rxPkW', '../chunks/tx-type-CS4wIUJ8', '../chunks/base-B_kRRfsf', '../chunks/account-BSrvZ7S8', '../chunks/wasm-BCEa0JCQ', '../chunks/lclib-DBHaYcY8'], (function (exports, tslib_es6, txType, base, account, wasm, lclib) { 'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 메인 서명을 master 키로 생성하는 TX 타입 집합 (signByMasterKey WASM 호출).
|
|
5
|
+
* 그 외 모든 TX 는 normal 키로 서명한다 (sign WASM 호출).
|
|
6
|
+
*
|
|
7
|
+
* Source of truth: locuschain 프로토콜 — CLOSE_ACCOUNT 만 메인 tx 를 master
|
|
8
|
+
* 키로 직접 서명한다.
|
|
9
|
+
*/
|
|
10
|
+
const MASTER_SIGN_TX_TYPES = new Set([
|
|
11
|
+
txType.TxType.CLOSE_ACCOUNT,
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* Submit payload 에 SignKeyBind 결과가 포함되는 TX 타입 집합. 메인 tx 는
|
|
15
|
+
* 여전히 normal 키가 서명하고, master 키는 (새 normal pubkey, 현재 normal
|
|
16
|
+
* pubkey) 간의 binding 만 증명한다.
|
|
17
|
+
*
|
|
18
|
+
* 정확한 submit 필드는 RPC 마다 다르다:
|
|
19
|
+
* - TX_OPEN_ACCOUNT -> additions.keySign (ParamsOpenAccount.keySign)
|
|
20
|
+
* - TX_CHANGE_KEYPAIR -> additions.signByMasterKey (ParamsChangeKey.signByMasterKey)
|
|
21
|
+
*
|
|
22
|
+
* Source of truth: locuschain 프로토콜 — run/test_lclib/lclib/lclib.go 의
|
|
23
|
+
* SignKeyBind 와 nodeext/rpclocus/rpc.go 의 ParamsXxx struct 참고.
|
|
24
|
+
*/
|
|
25
|
+
new Set([
|
|
26
|
+
txType.TxType.OPEN_ACCOUNT,
|
|
27
|
+
txType.TxType.CHANGE_KEYPAIR,
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
/** master 가 증명한 key-bind 서명을 미리 채워야 하는 RPC 메서드들. */
|
|
31
|
+
const OPEN_ACCOUNT_METHOD = 'locus_openAccount';
|
|
32
|
+
const CHANGE_KEY_METHOD = 'locus_changeKey';
|
|
33
|
+
/**
|
|
34
|
+
* Locus dual-key account 를 만든다. 반환된 `signTransaction` 은 prepare 된
|
|
35
|
+
* TX 에 대해 master/normal 라우팅을 모두 캡슐화하므로, wallet action 들이
|
|
36
|
+
* tx.type 분기를 직접 할 필요가 없다.
|
|
37
|
+
*
|
|
38
|
+
* 2 단계 흐름 노트:
|
|
39
|
+
*
|
|
40
|
+
* - OPEN_ACCOUNT 는 prepare RPC 에서도 master key-bind 서명이 필요하다.
|
|
41
|
+
* `prepareParams` 는 호출자가 `keySign` 을 빈 값으로 둔 경우 자동으로
|
|
42
|
+
* 채운다. FALCON+ED25519 가 non-deterministic 이라 submit 단계에서
|
|
43
|
+
* 서명을 다시 계산하지 *않고*, `prepared.tx.keyBind.sign` 에서 prepare
|
|
44
|
+
* 단계 값을 그대로 읽어 쓴다 (노드가 prepare 파라미터를 그대로 echo).
|
|
45
|
+
*
|
|
46
|
+
* - CHANGE_KEYPAIR 는 *자동으로 채우지 않는다*. 노드가 메인 tx 서명을
|
|
47
|
+
* 이전 키가 아닌 *새* normal pubkey 로 검증 (proof-of-possession)
|
|
48
|
+
* 하므로, 호출자가 새 normal secret 을 보유한 상태로 새 DualKeyAccount
|
|
49
|
+
* 를 만들어 호출해야 한다. account.normal.getPublicKey() 가 새 키로
|
|
50
|
+
* 바뀐 후라면 auto-compute 된 `signByMasterKey` 는 잘못된 `currentNpk`
|
|
51
|
+
* 를 쓰게 되므로 자동 계산을 비활성화한다. 호출자 측 흐름:
|
|
52
|
+
*
|
|
53
|
+
* 1. signByMasterKey = await oldAccount.master.signKeyBind({
|
|
54
|
+
* newNpk: <새 normal pubkey>,
|
|
55
|
+
* currentNpk: <이전 normal pubkey>,
|
|
56
|
+
* });
|
|
57
|
+
* 2. const newAccount = keysToAccount({ address, msk, mpk,
|
|
58
|
+
* nsk: <new>, npk: <new> });
|
|
59
|
+
* 3. await wallet.changeKey({ ..., signByMasterKey });
|
|
60
|
+
*
|
|
61
|
+
* signByMasterKey 가 비어 있으면 prepareParams 가 throw 한다.
|
|
62
|
+
*
|
|
63
|
+
* - 그 외 모든 TX 는 prepareParams 가 pass-through.
|
|
64
|
+
*
|
|
65
|
+
* 정책 (single source of truth — 노드 측 ParamsOpenAccount / ParamsChangeKey
|
|
66
|
+
* / ParamsChangeVKey / ParamsCloseAccount RPC struct 와 동기 유지):
|
|
67
|
+
*
|
|
68
|
+
* TX_CLOSE_ACCOUNT -> sign = master.signMessage(hash)
|
|
69
|
+
* TX_OPEN_ACCOUNT -> sign = normal.signMessage(hash) AND
|
|
70
|
+
* keySign = prepared.tx.keyBind.sign
|
|
71
|
+
* TX_CHANGE_KEYPAIR -> sign = normal.signMessage(hash) // normal 은 *새* 키여야 함
|
|
72
|
+
* signByMasterKey = prepared.tx.keyBind.sign
|
|
73
|
+
* TX_CHANGE_VKEY -> sign = normal.signMessage(hash)
|
|
74
|
+
* 그 외 -> sign = normal.signMessage(hash)
|
|
75
|
+
*
|
|
76
|
+
* public key 필드 (mpk/pk/mpkey/masterPkey/newNormalPkey) 는 여기서
|
|
77
|
+
* 합성하지 않는다 — 호출자가 prepare 파라미터에 직접 포함시켜 넘기고,
|
|
78
|
+
* `_sendPreparedTransaction` 이 submit 단계에서 params[0] 에 추가 필드들
|
|
79
|
+
* 을 병합할 때 원본 값을 보존한다.
|
|
80
|
+
*/
|
|
81
|
+
function dualKeyAccount(args) {
|
|
82
|
+
const { address, master, normal } = args;
|
|
83
|
+
const prepareParams = (_a) => tslib_es6.__awaiter(this, [_a], void 0, function* ({ method, params, signal, }) {
|
|
84
|
+
var _b;
|
|
85
|
+
if (params.length === 0)
|
|
86
|
+
return params;
|
|
87
|
+
const first = params[0];
|
|
88
|
+
if (!first || typeof first !== 'object')
|
|
89
|
+
return params;
|
|
90
|
+
if (method === OPEN_ACCOUNT_METHOD) {
|
|
91
|
+
const p = first;
|
|
92
|
+
if (!p.keySign || p.keySign.length === 0) {
|
|
93
|
+
if (!master.signKeyBind)
|
|
94
|
+
throw new account.SignKeyBindUnsupportedError(master.type);
|
|
95
|
+
const keySign = yield master.signKeyBind({
|
|
96
|
+
newNpk: (_b = p.pk) !== null && _b !== void 0 ? _b : '',
|
|
97
|
+
currentNpk: '',
|
|
98
|
+
signal,
|
|
99
|
+
});
|
|
100
|
+
return [Object.assign(Object.assign({}, p), { keySign }), ...params.slice(1)];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (method === CHANGE_KEY_METHOD) {
|
|
104
|
+
const p = first;
|
|
105
|
+
if (!p.signByMasterKey || p.signByMasterKey.length === 0) {
|
|
106
|
+
throw new base.BaseError(`changeKey: 'signByMasterKey' must be precomputed before calling this action`, {
|
|
107
|
+
metaMessages: [
|
|
108
|
+
`TX_CHANGE_KEYPAIR 는 새 normal 키가 메인 tx 에 서명 (proof-of-possession) 하므로,`,
|
|
109
|
+
`호출자가 (1) currentNpk 로 *이전* normal pubkey 를 넣어 signByMasterKey 를 미리`,
|
|
110
|
+
`계산하고, (2) *새* normal 키를 새 DualKeyAccount 에 바인드한 뒤 submit 해야 한다.`,
|
|
111
|
+
`자세한 흐름은 README 의 "Normal 키 교체" 섹션 참고.`,
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return params;
|
|
117
|
+
});
|
|
118
|
+
const signTransaction = (_a) => tslib_es6.__awaiter(this, [_a], void 0, function* ({ prepared, signal, }) {
|
|
119
|
+
var _b;
|
|
120
|
+
const tx = prepared.tx;
|
|
121
|
+
const txType$1 = typeof (tx === null || tx === void 0 ? void 0 : tx.type) === 'string' ? tx.type : '';
|
|
122
|
+
const useMaster = MASTER_SIGN_TX_TYPES.has(txType$1);
|
|
123
|
+
const mainSigner = useMaster ? master : normal;
|
|
124
|
+
const sign = yield mainSigner.signMessage({
|
|
125
|
+
message: prepared.hash,
|
|
126
|
+
signal,
|
|
127
|
+
});
|
|
128
|
+
const additions = {
|
|
129
|
+
sign,
|
|
130
|
+
signedHeight: prepared.signedHeight,
|
|
131
|
+
};
|
|
132
|
+
const keyBindSign = (_b = tx === null || tx === void 0 ? void 0 : tx.keyBind) === null || _b === void 0 ? void 0 : _b.sign;
|
|
133
|
+
if (txType$1 === txType.TxType.OPEN_ACCOUNT && keyBindSign) {
|
|
134
|
+
additions.keySign = keyBindSign;
|
|
135
|
+
}
|
|
136
|
+
else if (txType$1 === txType.TxType.CHANGE_KEYPAIR && keyBindSign) {
|
|
137
|
+
additions.signByMasterKey = keyBindSign;
|
|
138
|
+
}
|
|
139
|
+
return additions;
|
|
140
|
+
});
|
|
141
|
+
const signMessage = ({ message, role = 'normal', signal, }) => {
|
|
142
|
+
const signer = role === 'master' ? master : normal;
|
|
143
|
+
return signer.signMessage({ message, signal });
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
type: 'locus-dual-key',
|
|
147
|
+
address,
|
|
148
|
+
master,
|
|
149
|
+
normal,
|
|
150
|
+
prepareParams,
|
|
151
|
+
signTransaction,
|
|
152
|
+
signMessage,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// 타입 이름과 대칭을 맞추기 위한 alias — dualKeyAccount 와 동일하다.
|
|
156
|
+
const toAccount = dualKeyAccount;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* 인메모리 secret-key 소스. 개발용, CLI 도구, 또는 호출자가 평문 키
|
|
160
|
+
* 자료를 보관해도 무방한 경우에 적합하다.
|
|
161
|
+
*
|
|
162
|
+
* 키를 keystore / 하드웨어 장치 / 다른 프로세스 뒤에 보관하는 지갑은
|
|
163
|
+
* raw `key` 를 라이브러리에 넘기는 대신 toKeySource() 와 자체 콜백을
|
|
164
|
+
* 주입하는 방식을 써야 한다.
|
|
165
|
+
*/
|
|
166
|
+
function localKeySource(args) {
|
|
167
|
+
const { key, publicKey, role } = args;
|
|
168
|
+
const publicKeyPromise = Promise.resolve(publicKey);
|
|
169
|
+
if (role === 'master') {
|
|
170
|
+
return {
|
|
171
|
+
type: 'local',
|
|
172
|
+
getPublicKey: () => publicKeyPromise,
|
|
173
|
+
signMessage: ({ message }) => {
|
|
174
|
+
try {
|
|
175
|
+
return Promise.resolve(wasm.signByMasterKey({ msk: key, message }));
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
throw new account.SignFailedError('local master signMessage failed', { cause: err });
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
signKeyBind: ({ newNpk, currentNpk }) => {
|
|
182
|
+
try {
|
|
183
|
+
return Promise.resolve(wasm.signKeyBind({ msk: key, newNpk, currentNpk }));
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
throw new account.SignFailedError('local master signKeyBind failed', { cause: err });
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
type: 'local',
|
|
193
|
+
getPublicKey: () => publicKeyPromise,
|
|
194
|
+
signMessage: ({ message }) => {
|
|
195
|
+
try {
|
|
196
|
+
return Promise.resolve(wasm.sign({ sk: key, message }));
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
throw new account.SignFailedError('local normal signMessage failed', { cause: err });
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 평문 master/normal 키페어로부터 DualKeyAccount 를 만든다. 개발용, 테스트,
|
|
207
|
+
* CLI 도구 용도 — 프로덕션 지갑은 secret key 가 라이브러리에 들어가지
|
|
208
|
+
* 않도록 toAccount() 와 toKeySource() 콜백을 사용해야 한다.
|
|
209
|
+
*/
|
|
210
|
+
function keysToAccount(args) {
|
|
211
|
+
return dualKeyAccount({
|
|
212
|
+
address: args.address,
|
|
213
|
+
master: localKeySource({ key: args.msk, publicKey: args.mpk, role: 'master' }),
|
|
214
|
+
normal: localKeySource({ key: args.nsk, publicKey: args.npk, role: 'normal' }),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* BIP-39 mnemonic 으로부터 WASM 을 거쳐 Locus DualKeyAccount 를 derive 한다.
|
|
220
|
+
* 라이브러리는 결과 secret key 를 반환된 localKeySource 클로저 외에는
|
|
221
|
+
* 보관하지 않는다 — 콜백 방식 키 위임이 필요한 호출자는
|
|
222
|
+
* deriveKeysFromMnemonic / deriveKeysFromMnemonicAndPath 를 직접 호출한 뒤
|
|
223
|
+
* 결과를 `toAccount({ master, normal })` 에 넘기는 게 권장.
|
|
224
|
+
*/
|
|
225
|
+
function mnemonicToAccount(args) {
|
|
226
|
+
const json = args.path
|
|
227
|
+
? wasm.deriveKeysFromMnemonicAndPath({ mnemonic: args.mnemonic, path: args.path })
|
|
228
|
+
: deriveByIndex(args);
|
|
229
|
+
let parsed;
|
|
230
|
+
try {
|
|
231
|
+
parsed = JSON.parse(json);
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
throw new base.BaseError('mnemonicToAccount: WASM returned non-JSON', { cause: err });
|
|
235
|
+
}
|
|
236
|
+
assertDerivedShape(parsed);
|
|
237
|
+
if (parsed.masterPublicKey === parsed.publicKey) {
|
|
238
|
+
throw new account.DegenerateKeyError({
|
|
239
|
+
source: 'mnemonicToAccount',
|
|
240
|
+
algoMaster: args.algoMaster,
|
|
241
|
+
algoNormal: args.algoNormal,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return dualKeyAccount({
|
|
245
|
+
address: parsed.address,
|
|
246
|
+
master: localKeySource({
|
|
247
|
+
key: parsed.masterSecretKey,
|
|
248
|
+
publicKey: parsed.masterPublicKey,
|
|
249
|
+
role: 'master',
|
|
250
|
+
}),
|
|
251
|
+
normal: localKeySource({
|
|
252
|
+
key: parsed.secretKey,
|
|
253
|
+
publicKey: parsed.publicKey,
|
|
254
|
+
role: 'normal',
|
|
255
|
+
}),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function deriveByIndex(args) {
|
|
259
|
+
var _a;
|
|
260
|
+
if (!args.algoMaster || !args.algoNormal) {
|
|
261
|
+
throw new base.BaseError(`mnemonicToAccount: 'algoMaster' and 'algoNormal' are required when 'path' is not supplied`);
|
|
262
|
+
}
|
|
263
|
+
return wasm.deriveKeysFromMnemonic({
|
|
264
|
+
mnemonic: args.mnemonic,
|
|
265
|
+
algoMaster: args.algoMaster,
|
|
266
|
+
algoNormal: args.algoNormal,
|
|
267
|
+
index: (_a = args.index) !== null && _a !== void 0 ? _a : 0,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function assertDerivedShape(v) {
|
|
271
|
+
if (!v || typeof v !== 'object') {
|
|
272
|
+
throw new base.BaseError('mnemonicToAccount: malformed WASM result');
|
|
273
|
+
}
|
|
274
|
+
const o = v;
|
|
275
|
+
for (const k of ['address', 'publicKey', 'secretKey', 'masterPublicKey', 'masterSecretKey']) {
|
|
276
|
+
if (typeof o[k] !== 'string' || o[k].length === 0) {
|
|
277
|
+
throw new base.BaseError(`mnemonicToAccount: WASM result missing '${k}'`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* 호출자가 제공한 콜백으로 KeySource 를 만든다. keystore 기반 지갑,
|
|
284
|
+
* 하드웨어 지갑, 외부 지갑 앱이 통합되는 진입점 — 라이브러리는 secret key
|
|
285
|
+
* 를 보지 않는다.
|
|
286
|
+
*/
|
|
287
|
+
function toKeySource(args) {
|
|
288
|
+
var _a;
|
|
289
|
+
const source = {
|
|
290
|
+
type: (_a = args.type) !== null && _a !== void 0 ? _a : 'custom',
|
|
291
|
+
getPublicKey: args.getPublicKey,
|
|
292
|
+
signMessage: args.signMessage,
|
|
293
|
+
};
|
|
294
|
+
if (args.signKeyBind)
|
|
295
|
+
source.signKeyBind = args.signKeyBind;
|
|
296
|
+
return source;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
exports.dualKeyAccount = dualKeyAccount;
|
|
300
|
+
exports.keysToAccount = keysToAccount;
|
|
301
|
+
exports.localKeySource = localKeySource;
|
|
302
|
+
exports.mnemonicToAccount = mnemonicToAccount;
|
|
303
|
+
exports.toAccount = toAccount;
|
|
304
|
+
exports.toKeySource = toKeySource;
|
|
305
|
+
|
|
306
|
+
}));
|
|
@@ -4,8 +4,8 @@ var tslib_es6 = require('../chunks/tslib.es6-Cfi3-HmA.cjs');
|
|
|
4
4
|
var txType = require('../chunks/tx-type-DI_nKG8B.cjs');
|
|
5
5
|
var base = require('../chunks/base-Cy5SSYLF.cjs');
|
|
6
6
|
var account = require('../chunks/account-BAsiKnSL.cjs');
|
|
7
|
-
var wasm = require('../chunks/wasm-
|
|
8
|
-
require('../chunks/lclib-
|
|
7
|
+
var wasm = require('../chunks/wasm-D4S52Ifh.cjs');
|
|
8
|
+
require('../chunks/lclib-xRDGxtgw.cjs');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 메인 서명을 master 키로 생성하는 TX 타입 집합 (signByMasterKey WASM 호출).
|
|
@@ -2,8 +2,8 @@ import { _ as __awaiter } from '../chunks/tslib.es6-WQS2tr1v.js';
|
|
|
2
2
|
import { T as TxType } from '../chunks/tx-type-BPkhMGad.js';
|
|
3
3
|
import { B as BaseError } from '../chunks/base-BQXfRsuw.js';
|
|
4
4
|
import { a as SignKeyBindUnsupportedError, S as SignFailedError, D as DegenerateKeyError } from '../chunks/account-FZT9LH_s.js';
|
|
5
|
-
import { O as signKeyBind, N as signByMasterKey, M as sign, z as deriveKeysFromMnemonicAndPath, y as deriveKeysFromMnemonic } from '../chunks/wasm-
|
|
6
|
-
import '../chunks/lclib-
|
|
5
|
+
import { O as signKeyBind, N as signByMasterKey, M as sign, z as deriveKeysFromMnemonicAndPath, y as deriveKeysFromMnemonic } from '../chunks/wasm-C4WNl2YQ.js';
|
|
6
|
+
import '../chunks/lclib-BlnZKIGv.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 메인 서명을 master 키로 생성하는 TX 타입 집합 (signByMasterKey WASM 호출).
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
define(['exports', '../chunks/wasm-BCEa0JCQ', '../chunks/debugWalletActions-BDz-h2tl', '../chunks/lclib-DBHaYcY8', '../chunks/tslib.es6-D29rxPkW', '../chunks/rpc-C4n7t9y0', '../chunks/base-B_kRRfsf', '../chunks/account-BSrvZ7S8'], (function (exports, wasm, debugWalletActions, lclib, tslib_es6, rpc, base, account) { 'use strict';
|
|
2
|
+
|
|
3
|
+
// Automatically generated file. DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
6
|
+
__proto__: null,
|
|
7
|
+
allHeights: debugWalletActions.allHeights,
|
|
8
|
+
balanceGrantList: debugWalletActions.balanceGrantList,
|
|
9
|
+
balanceList: debugWalletActions.balanceList,
|
|
10
|
+
callContract: debugWalletActions.callContract,
|
|
11
|
+
createAccount: debugWalletActions.createAccount,
|
|
12
|
+
createContract: debugWalletActions.createContract,
|
|
13
|
+
createNode: debugWalletActions.createNode,
|
|
14
|
+
createSynthAccount: debugWalletActions.createSynthAccount,
|
|
15
|
+
dumpAllAccounts: debugWalletActions.dumpAllAccounts,
|
|
16
|
+
echo: debugWalletActions.echo,
|
|
17
|
+
gameChainCmd: debugWalletActions.gameChainCmd,
|
|
18
|
+
getAccountsBalances: debugWalletActions.getAccountsBalances,
|
|
19
|
+
getAccountsHeights: debugWalletActions.getAccountsHeights,
|
|
20
|
+
getContractLog: debugWalletActions.getContractLog,
|
|
21
|
+
getGuestsInfo: debugWalletActions.getGuestsInfo,
|
|
22
|
+
getHomeShard: debugWalletActions.getHomeShard,
|
|
23
|
+
getImportAccount: debugWalletActions.getImportAccount,
|
|
24
|
+
getImportAccountLog: debugWalletActions.getImportAccountLog,
|
|
25
|
+
getKeys: debugWalletActions.getKeys,
|
|
26
|
+
getNodeBlocks: debugWalletActions.getNodeBlocks,
|
|
27
|
+
getPeerPool: debugWalletActions.getPeerPool,
|
|
28
|
+
getPeersInfo: debugWalletActions.getPeersInfo,
|
|
29
|
+
importAccount: debugWalletActions.importAccount,
|
|
30
|
+
initReliableNodes: debugWalletActions.initReliableNodes,
|
|
31
|
+
noArgsRets: debugWalletActions.noArgsRets,
|
|
32
|
+
nodeCmd: debugWalletActions.nodeCmd,
|
|
33
|
+
postDataToSynthAccount: debugWalletActions.postDataToSynthAccount,
|
|
34
|
+
removeHoldTxs: debugWalletActions.removeHoldTxs,
|
|
35
|
+
requestVme: debugWalletActions.requestVme,
|
|
36
|
+
sendRawTransaction: debugWalletActions.sendRawTransaction,
|
|
37
|
+
setImportAccountTx: debugWalletActions.setImportAccountTx,
|
|
38
|
+
setReliableNode: debugWalletActions.setReliableNode,
|
|
39
|
+
viewContract: debugWalletActions.viewContract
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
exports.calculateTxLinkHash = wasm.calculateTxLinkHash;
|
|
43
|
+
exports.compileCoreScript = wasm.compileCoreScript;
|
|
44
|
+
exports.convertAddressToData = wasm.convertAddressToData;
|
|
45
|
+
exports.convertAddressToHex = wasm.convertAddressToHex;
|
|
46
|
+
exports.convertBase32ToData = wasm.convertBase32ToData;
|
|
47
|
+
exports.convertBase32ToHex = wasm.convertBase32ToHex;
|
|
48
|
+
exports.convertCurrency = wasm.convertCurrency;
|
|
49
|
+
exports.convertDataTo = wasm.convertDataTo;
|
|
50
|
+
exports.convertDataToAddress = wasm.convertDataToAddress;
|
|
51
|
+
exports.convertDataToBase32 = wasm.convertDataToBase32;
|
|
52
|
+
exports.convertDataToHex = wasm.convertDataToHex;
|
|
53
|
+
exports.convertDataToString = wasm.convertDataToString;
|
|
54
|
+
exports.convertHexToAddress = wasm.convertHexToAddress;
|
|
55
|
+
exports.convertHexToBase32 = wasm.convertHexToBase32;
|
|
56
|
+
exports.convertHexToData = wasm.convertHexToData;
|
|
57
|
+
exports.convertStringToData = wasm.convertStringToData;
|
|
58
|
+
exports.convertToData = wasm.convertToData;
|
|
59
|
+
exports.createAccountAndKeystore = wasm.createAccountAndKeystore;
|
|
60
|
+
exports.createMasterKeystore = wasm.createMasterKeystore;
|
|
61
|
+
exports.createNormalKey = wasm.createNormalKey;
|
|
62
|
+
exports.createNormalKeystore = wasm.createNormalKeystore;
|
|
63
|
+
exports.decodeTxs = wasm.decodeTxs;
|
|
64
|
+
exports.deriveKeysFromMnemonic = wasm.deriveKeysFromMnemonic;
|
|
65
|
+
exports.deriveKeysFromMnemonicAndPath = wasm.deriveKeysFromMnemonicAndPath;
|
|
66
|
+
exports.disCompileCoreScript = wasm.disCompileCoreScript;
|
|
67
|
+
exports.encodeTxCurrency = wasm.encodeTxCurrency;
|
|
68
|
+
exports.encodeTxNumber = wasm.encodeTxNumber;
|
|
69
|
+
exports.generateMnemonic = wasm.generateMnemonic;
|
|
70
|
+
exports.generateMnemonicBySeed = wasm.generateMnemonicBySeed;
|
|
71
|
+
exports.getDefFromCoreScript = wasm.getDefFromCoreScript;
|
|
72
|
+
exports.getHomeShard = wasm.getHomeShard;
|
|
73
|
+
exports.getLibraryVersions = wasm.getLibraryVersions;
|
|
74
|
+
exports.gzipAndEncode = wasm.gzipAndEncode;
|
|
75
|
+
exports.hash = wasm.hash;
|
|
76
|
+
exports.isGrantConsumingTx = wasm.isGrantConsumingTx;
|
|
77
|
+
exports.loadMasterKeystore = wasm.loadMasterKeystore;
|
|
78
|
+
exports.loadNormalKeystore = wasm.loadNormalKeystore;
|
|
79
|
+
exports.makeCurrency = wasm.makeCurrency;
|
|
80
|
+
exports.sign = wasm.sign;
|
|
81
|
+
exports.signByMasterKey = wasm.signByMasterKey;
|
|
82
|
+
exports.signKeyBind = wasm.signKeyBind;
|
|
83
|
+
exports.testCoreScript = wasm.testCoreScript;
|
|
84
|
+
exports.verify = wasm.verify;
|
|
85
|
+
exports.verifyByMasterKey = wasm.verifyByMasterKey;
|
|
86
|
+
exports.verifyMerkleProof = wasm.verifyMerkleProof;
|
|
87
|
+
exports.verifyTx = wasm.verifyTx;
|
|
88
|
+
exports.acceptScript = debugWalletActions.acceptScript;
|
|
89
|
+
exports.accountHeightsToDownload = debugWalletActions.accountHeightsToDownload;
|
|
90
|
+
exports.accountHeightsToUpload = debugWalletActions.accountHeightsToUpload;
|
|
91
|
+
exports.becomeGuest = debugWalletActions.becomeGuest;
|
|
92
|
+
exports.becomeHost = debugWalletActions.becomeHost;
|
|
93
|
+
exports.calculateSpentByExpress = debugWalletActions.calculateSpentByExpress;
|
|
94
|
+
exports.changeKey = debugWalletActions.changeKey;
|
|
95
|
+
exports.changeVkey = debugWalletActions.changeVkey;
|
|
96
|
+
exports.clientMessage = debugWalletActions.clientMessage;
|
|
97
|
+
exports.closeAccount = debugWalletActions.closeAccount;
|
|
98
|
+
exports.createAssetObject = debugWalletActions.createAssetObject;
|
|
99
|
+
exports.createToken = debugWalletActions.createToken;
|
|
100
|
+
exports.createVme = debugWalletActions.createVme;
|
|
101
|
+
exports.debugPublicActions = debugWalletActions.debugPublicActions;
|
|
102
|
+
exports.debugWalletActions = debugWalletActions.debugWalletActions;
|
|
103
|
+
exports.downloadAccountTxs = debugWalletActions.downloadAccountTxs;
|
|
104
|
+
exports.echo = debugWalletActions.echo$1;
|
|
105
|
+
exports.findDuplicateSubscriber = debugWalletActions.findDuplicateSubscriber;
|
|
106
|
+
exports.generateLatestStoredDataProof = debugWalletActions.generateLatestStoredDataProof;
|
|
107
|
+
exports.getAccountAssetList = debugWalletActions.getAccountAssetList;
|
|
108
|
+
exports.getAccountAssetObject = debugWalletActions.getAccountAssetObject;
|
|
109
|
+
exports.getAccountDetail = debugWalletActions.getAccountDetail;
|
|
110
|
+
exports.getAccountHistory = debugWalletActions.getAccountHistory;
|
|
111
|
+
exports.getAccountTokenList = debugWalletActions.getAccountTokenList;
|
|
112
|
+
exports.getConciseNodeStatus = debugWalletActions.getConciseNodeStatus;
|
|
113
|
+
exports.getGenesisAccount = debugWalletActions.getGenesisAccount;
|
|
114
|
+
exports.getIdentityProof = debugWalletActions.getIdentityProof;
|
|
115
|
+
exports.getInactiveTxList = debugWalletActions.getInactiveTxList;
|
|
116
|
+
exports.getMontInfoList = debugWalletActions.getMontInfoList;
|
|
117
|
+
exports.getNodeStatus = debugWalletActions.getNodeStatus;
|
|
118
|
+
exports.getOwnerBalance = debugWalletActions.getOwnerBalance;
|
|
119
|
+
exports.getRoundState = debugWalletActions.getRoundState;
|
|
120
|
+
exports.getRoundStatesList = debugWalletActions.getRoundStatesList;
|
|
121
|
+
exports.getShardOfAccount = debugWalletActions.getShardOfAccount;
|
|
122
|
+
exports.getSyncState = debugWalletActions.getSyncState;
|
|
123
|
+
exports.getTx = debugWalletActions.getTx;
|
|
124
|
+
exports.getWorldRoundState = debugWalletActions.getWorldRoundState;
|
|
125
|
+
exports.getWorldRoundStatesList = debugWalletActions.getWorldRoundStatesList;
|
|
126
|
+
exports.hasSystemToken = debugWalletActions.hasSystemToken;
|
|
127
|
+
exports.lockStake = debugWalletActions.lockStake;
|
|
128
|
+
exports.makeTxProof = debugWalletActions.makeTxProof;
|
|
129
|
+
exports.openAccount = debugWalletActions.openAccount;
|
|
130
|
+
exports.postData = debugWalletActions.postData;
|
|
131
|
+
exports.provideScript = debugWalletActions.provideScript;
|
|
132
|
+
exports.publicActions = debugWalletActions.publicActions;
|
|
133
|
+
exports.queryAddress = debugWalletActions.queryAddress;
|
|
134
|
+
exports.readTxListWitness = debugWalletActions.readTxListWitness;
|
|
135
|
+
exports.requestDataTrade = debugWalletActions.requestDataTrade;
|
|
136
|
+
exports.setHost = debugWalletActions.setHost;
|
|
137
|
+
exports.subscribeAddress = debugWalletActions.subscribeAddress;
|
|
138
|
+
exports.transferAssetObject = debugWalletActions.transferAssetObject;
|
|
139
|
+
exports.transferCoin = debugWalletActions.transferCoin;
|
|
140
|
+
exports.transferCoinExpress = debugWalletActions.transferCoinExpress;
|
|
141
|
+
exports.transferToken = debugWalletActions.transferToken;
|
|
142
|
+
exports.unlockStake = debugWalletActions.unlockStake;
|
|
143
|
+
exports.uploadAccountTxs = debugWalletActions.uploadAccountTxs;
|
|
144
|
+
exports.verifyAndSignChallenge = debugWalletActions.verifyAndSignChallenge;
|
|
145
|
+
exports.verifyIdentityProof = debugWalletActions.verifyIdentityProof;
|
|
146
|
+
exports.verifyLatestStoredDataProof = debugWalletActions.verifyLatestStoredDataProof;
|
|
147
|
+
exports.verifyTxListWitness = debugWalletActions.verifyTxListWitness;
|
|
148
|
+
exports.walletActions = debugWalletActions.walletActions;
|
|
149
|
+
exports.debug = index;
|
|
150
|
+
|
|
151
|
+
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var wasm = require('../chunks/wasm-
|
|
3
|
+
var wasm = require('../chunks/wasm-D4S52Ifh.cjs');
|
|
4
4
|
var debugWalletActions = require('../chunks/debugWalletActions-6qjkZVq9.cjs');
|
|
5
|
-
require('../chunks/lclib-
|
|
5
|
+
require('../chunks/lclib-xRDGxtgw.cjs');
|
|
6
6
|
require('../chunks/tslib.es6-Cfi3-HmA.cjs');
|
|
7
7
|
require('../chunks/rpc-DwWIkUva.cjs');
|
|
8
8
|
require('../chunks/base-Cy5SSYLF.cjs');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { b as calculateTxLinkHash, d as compileCoreScript, e as convertAddressToData, f as convertAddressToHex, g as convertBase32ToData, h as convertBase32ToHex, i as convertCurrency, j as convertDataTo, k as convertDataToAddress, m as convertDataToBase32, n as convertDataToHex, o as convertDataToString, p as convertHexToAddress, q as convertHexToBase32, r as convertHexToData, s as convertStringToData, t as convertToData, c as createAccountAndKeystore, u as createMasterKeystore, v as createNormalKey, w as createNormalKeystore, x as decodeTxs, y as deriveKeysFromMnemonic, z as deriveKeysFromMnemonicAndPath, A as disCompileCoreScript, B as encodeTxCurrency, C as encodeTxNumber, D as generateMnemonic, E as generateMnemonicBySeed, F as getDefFromCoreScript, G as getHomeShard, H as getLibraryVersions, I as gzipAndEncode, J as hash, K as isGrantConsumingTx, l as loadMasterKeystore, a as loadNormalKeystore, L as makeCurrency, M as sign, N as signByMasterKey, O as signKeyBind, P as testCoreScript, Q as verify, R as verifyByMasterKey, S as verifyMerkleProof, T as verifyTx } from '../chunks/wasm-
|
|
1
|
+
export { b as calculateTxLinkHash, d as compileCoreScript, e as convertAddressToData, f as convertAddressToHex, g as convertBase32ToData, h as convertBase32ToHex, i as convertCurrency, j as convertDataTo, k as convertDataToAddress, m as convertDataToBase32, n as convertDataToHex, o as convertDataToString, p as convertHexToAddress, q as convertHexToBase32, r as convertHexToData, s as convertStringToData, t as convertToData, c as createAccountAndKeystore, u as createMasterKeystore, v as createNormalKey, w as createNormalKeystore, x as decodeTxs, y as deriveKeysFromMnemonic, z as deriveKeysFromMnemonicAndPath, A as disCompileCoreScript, B as encodeTxCurrency, C as encodeTxNumber, D as generateMnemonic, E as generateMnemonicBySeed, F as getDefFromCoreScript, G as getHomeShard, H as getLibraryVersions, I as gzipAndEncode, J as hash, K as isGrantConsumingTx, l as loadMasterKeystore, a as loadNormalKeystore, L as makeCurrency, M as sign, N as signByMasterKey, O as signKeyBind, P as testCoreScript, Q as verify, R as verifyByMasterKey, S as verifyMerkleProof, T as verifyTx } from '../chunks/wasm-C4WNl2YQ.js';
|
|
2
2
|
import { a as allHeights, b as balanceGrantList, c as balanceList, d as callContract, e as createAccount, f as createContract, g as createNode, h as createSynthAccount, i as dumpAllAccounts, j as echo, k as gameChainCmd, l as getAccountsBalances, m as getAccountsHeights, n as getContractLog, o as getGuestsInfo, p as getHomeShard, q as getImportAccount, r as getImportAccountLog, s as getKeys, t as getNodeBlocks, u as getPeerPool, v as getPeersInfo, w as importAccount, x as initReliableNodes, y as noArgsRets, z as nodeCmd, A as postDataToSynthAccount, B as removeHoldTxs, C as requestVme, D as sendRawTransaction, E as setImportAccountTx, F as setReliableNode, G as viewContract } from '../chunks/debugWalletActions-D5-Ds7Hl.js';
|
|
3
3
|
export { H as acceptScript, I as accountHeightsToDownload, J as accountHeightsToUpload, K as becomeGuest, L as becomeHost, M as calculateSpentByExpress, N as changeKey, O as changeVkey, P as clientMessage, Q as closeAccount, R as createAssetObject, S as createToken, T as createVme, U as debugPublicActions, V as debugWalletActions, W as downloadAccountTxs, X as echo, Y as findDuplicateSubscriber, Z as generateLatestStoredDataProof, _ as getAccountAssetList, $ as getAccountAssetObject, a0 as getAccountDetail, a1 as getAccountHistory, a2 as getAccountTokenList, a3 as getConciseNodeStatus, a4 as getGenesisAccount, a5 as getIdentityProof, a6 as getInactiveTxList, a7 as getMontInfoList, a8 as getNodeStatus, a9 as getOwnerBalance, aa as getRoundState, ab as getRoundStatesList, ac as getShardOfAccount, ad as getSyncState, ae as getTx, af as getWorldRoundState, ag as getWorldRoundStatesList, ah as hasSystemToken, ai as lockStake, aj as makeTxProof, ak as openAccount, al as postData, am as provideScript, an as publicActions, ao as queryAddress, ap as readTxListWitness, aq as requestDataTrade, ar as setHost, as as subscribeAddress, at as transferAssetObject, au as transferCoin, av as transferCoinExpress, aw as transferToken, ax as unlockStake, ay as uploadAccountTxs, az as verifyAndSignChallenge, aA as verifyIdentityProof, aB as verifyLatestStoredDataProof, aC as verifyTxListWitness, aD as walletActions } from '../chunks/debugWalletActions-D5-Ds7Hl.js';
|
|
4
|
-
import '../chunks/lclib-
|
|
4
|
+
import '../chunks/lclib-BlnZKIGv.js';
|
|
5
5
|
import '../chunks/tslib.es6-WQS2tr1v.js';
|
|
6
6
|
import '../chunks/rpc-BlPk44QH.js';
|
|
7
7
|
import '../chunks/base-BQXfRsuw.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
define(['exports', './base-B_kRRfsf'], (function (exports, base) { 'use strict';
|
|
2
|
+
|
|
3
|
+
class AccountRequiredError extends base.BaseError {
|
|
4
|
+
constructor(method) {
|
|
5
|
+
super(`account required to invoke '${method}'`, {
|
|
6
|
+
metaMessages: [
|
|
7
|
+
`wallet client 를 만들 때 account 를 전달해야 한다:`,
|
|
8
|
+
` createWalletClient({ transport, account })`,
|
|
9
|
+
],
|
|
10
|
+
});
|
|
11
|
+
this.name = 'AccountRequiredError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class InvalidTxResultError extends base.BaseError {
|
|
15
|
+
constructor(shortMessage, options = {}) {
|
|
16
|
+
super(shortMessage, options);
|
|
17
|
+
this.name = 'InvalidTxResultError';
|
|
18
|
+
this.method = options.method;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class SignFailedError extends base.BaseError {
|
|
22
|
+
constructor(shortMessage, options = {}) {
|
|
23
|
+
super(shortMessage, options);
|
|
24
|
+
this.name = 'SignFailedError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* WASM 의 키 derivation 경로가 동일한 master / normal public key 를 반환한
|
|
29
|
+
* 경우에 던진다. 과거에는 JS 브릿지가 deterministic seed 를 WASM 으로
|
|
30
|
+
* 전달하지 못하던 버그 (bug-002, 커밋 e00a35e 에서 해결) 가 원인이었고,
|
|
31
|
+
* 그 결과 AIMER / HAETAE 조합에서 두 슬롯의 키가 같은 값으로 derive 되곤
|
|
32
|
+
* 했다. 브릿지 fix 이후 이 가드는 회귀 안전망 역할만 한다 — 생성 시점에
|
|
33
|
+
* 조용히 실패하면 호출자는 master==normal account 를 들고 있다가 노드의
|
|
34
|
+
* `openAccount` 단계에서 거부 당하므로, JS 경계에서 미리 surface 한다.
|
|
35
|
+
*/
|
|
36
|
+
class DegenerateKeyError extends base.BaseError {
|
|
37
|
+
constructor(options) {
|
|
38
|
+
const { source, algoMaster, algoNormal, cause } = options;
|
|
39
|
+
const combo = algoMaster || algoNormal
|
|
40
|
+
? ` (algoMaster='${algoMaster !== null && algoMaster !== void 0 ? algoMaster : '?'}', algoNormal='${algoNormal !== null && algoNormal !== void 0 ? algoNormal : '?'}')`
|
|
41
|
+
: '';
|
|
42
|
+
super(`${source}: WASM returned identical master and normal public keys${combo}`, {
|
|
43
|
+
metaMessages: [
|
|
44
|
+
`이 가드는 JS 또는 WASM 키 derivation 경로의 회귀를 잡기 위한 안전망이며, 알고리즘 자체의 특성이 아니다.`,
|
|
45
|
+
`WASM 브릿지가 deterministic seed 를 제대로 전달하는지, WASM 빌드가 최신인지 확인하라.`,
|
|
46
|
+
],
|
|
47
|
+
cause,
|
|
48
|
+
});
|
|
49
|
+
this.name = 'DegenerateKeyError';
|
|
50
|
+
this.algoMaster = algoMaster;
|
|
51
|
+
this.algoNormal = algoNormal;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* TX 가 `master.signKeyBind` 를 필요로 하는데 (OPEN_ACCOUNT, CHANGE_KEYPAIR)
|
|
56
|
+
* master KeySource 가 이를 제공하지 않은 경우에 던진다.
|
|
57
|
+
*/
|
|
58
|
+
class SignKeyBindUnsupportedError extends base.BaseError {
|
|
59
|
+
constructor(keySourceType) {
|
|
60
|
+
super(`master KeySource (type='${keySourceType}') does not implement signKeyBind`, {
|
|
61
|
+
metaMessages: [
|
|
62
|
+
`signKeyBind 는 TX_OPEN_ACCOUNT 와 TX_CHANGE_KEYPAIR 에 필요하다.`,
|
|
63
|
+
`toKeySource({ ... }) 에서 signKeyBind 를 직접 구현하거나, 자동 derive 되는 localKeySource 를 사용하라.`,
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
this.name = 'SignKeyBindUnsupportedError';
|
|
67
|
+
this.keySourceType = keySourceType;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exports.AccountRequiredError = AccountRequiredError;
|
|
72
|
+
exports.DegenerateKeyError = DegenerateKeyError;
|
|
73
|
+
exports.InvalidTxResultError = InvalidTxResultError;
|
|
74
|
+
exports.SignFailedError = SignFailedError;
|
|
75
|
+
exports.SignKeyBindUnsupportedError = SignKeyBindUnsupportedError;
|
|
76
|
+
|
|
77
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
define(['exports'], (function (exports) { 'use strict';
|
|
2
|
+
|
|
3
|
+
// Automatically generated file. DO NOT EDIT.
|
|
4
|
+
const AddressClass = Object.freeze({
|
|
5
|
+
User: 0,
|
|
6
|
+
Synthetic: 1,
|
|
7
|
+
Contract: 2,
|
|
8
|
+
VmEngine: 3,
|
|
9
|
+
UserToken: 4,
|
|
10
|
+
ContractToken: 5,
|
|
11
|
+
Observer: 6,
|
|
12
|
+
AssetNFT: 7,
|
|
13
|
+
AssetToken: 8,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
exports.AddressClass = AddressClass;
|
|
17
|
+
|
|
18
|
+
}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
define(['exports'], (function (exports) { 'use strict';
|
|
2
|
+
|
|
3
|
+
class BaseError extends Error {
|
|
4
|
+
constructor(shortMessage, options = {}) {
|
|
5
|
+
var _a;
|
|
6
|
+
super(formatMessage(shortMessage, options));
|
|
7
|
+
this.name = 'LocusError';
|
|
8
|
+
this.shortMessage = shortMessage;
|
|
9
|
+
this.metaMessages = (_a = options.metaMessages) !== null && _a !== void 0 ? _a : [];
|
|
10
|
+
this.details = options.details;
|
|
11
|
+
this.cause = options.cause;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function formatMessage(short, opts) {
|
|
15
|
+
const parts = [short];
|
|
16
|
+
if (opts.metaMessages && opts.metaMessages.length > 0) {
|
|
17
|
+
parts.push('', ...opts.metaMessages);
|
|
18
|
+
}
|
|
19
|
+
if (opts.details) {
|
|
20
|
+
parts.push('', `Details: ${opts.details}`);
|
|
21
|
+
}
|
|
22
|
+
return parts.join('\n');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.BaseError = BaseError;
|
|
26
|
+
|
|
27
|
+
}));
|