@locuschain/lib 0.1.33 → 0.1.35

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.
@@ -4,7 +4,6 @@ var addressClass = require('../chunks/address-class-Cjy48Uqk.cjs');
4
4
  var wasm = require('../chunks/wasm-DTyHBxcY.cjs');
5
5
  var keystore = require('../chunks/keystore-BbK5pVrh.cjs');
6
6
  var lclib = require('../chunks/lclib-DuoOR0-Q.cjs');
7
- var _ = require('lodash');
8
7
  require('../chunks/base-Cy5SSYLF.cjs');
9
8
  require('../chunks/account-BAsiKnSL.cjs');
10
9
  require('../chunks/tslib.es6-Cfi3-HmA.cjs');
@@ -173,7 +172,7 @@ class TxValidator {
173
172
  for (const paramKey in mapping) {
174
173
  const txKey = mapping[paramKey];
175
174
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
176
- const txValue = _.get(tx, txKey);
175
+ const txValue = this.getByPath(tx, txKey);
177
176
  if (paramValue !== txValue) {
178
177
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
179
178
  }
@@ -182,7 +181,7 @@ class TxValidator {
182
181
  const txKey = optional[paramKey];
183
182
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
184
183
  if (paramValue && paramValue !== '' && paramValue !== 0) {
185
- const txValue = _.get(tx, txKey);
184
+ const txValue = this.getByPath(tx, txKey);
186
185
  if (paramValue !== txValue) {
187
186
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
188
187
  }
@@ -192,8 +191,8 @@ class TxValidator {
192
191
  };
193
192
  this.checkComplexField = (params, tx, { paramPath, txPath, paramTransform, txTransform }) => {
194
193
  const paramValue = paramTransform(this.getByPathIgnoreCase(params, paramPath));
195
- const txValue = txTransform(_.get(tx, txPath));
196
- if (!_.isEqual(paramValue, txValue)) {
194
+ const txValue = txTransform(this.getByPath(tx, txPath));
195
+ if (!this.isDeepEqual(paramValue, txValue)) {
197
196
  return this.logAndFail(tx.type, paramPath, paramValue, txValue);
198
197
  }
199
198
  return true;
@@ -217,6 +216,36 @@ class TxValidator {
217
216
  }
218
217
  return current;
219
218
  }
219
+ getByPath(obj, path) {
220
+ const keys = path.split('.');
221
+ let current = obj;
222
+ for (const key of keys) {
223
+ if (current == null)
224
+ return undefined;
225
+ current = current[key];
226
+ }
227
+ return current;
228
+ }
229
+ isDeepEqual(a, b) {
230
+ if (a === b)
231
+ return true;
232
+ if (a == null || b == null)
233
+ return a === b;
234
+ if (typeof a !== typeof b || typeof a !== 'object')
235
+ return false;
236
+ if (Array.isArray(a) !== Array.isArray(b))
237
+ return false;
238
+ if (Array.isArray(a)) {
239
+ if (a.length !== b.length)
240
+ return false;
241
+ return a.every((v, i) => this.isDeepEqual(v, b[i]));
242
+ }
243
+ const keysA = Object.keys(a);
244
+ const keysB = Object.keys(b);
245
+ if (keysA.length !== keysB.length)
246
+ return false;
247
+ return keysA.every(k => Object.prototype.hasOwnProperty.call(b, k) && this.isDeepEqual(a[k], b[k]));
248
+ }
220
249
  }
221
250
 
222
251
  /**
@@ -3,7 +3,6 @@ import { T as verifyTx, d as compileCoreScript, f as convertAddressToHex } from
3
3
  export { b as calculateTxLinkHash, e as convertAddressToData, 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 } from '../chunks/wasm-BtPcXTR4.js';
4
4
  export { c as createKeystoreBundle, s as splitKeystoreBundle, u as unlockKeystoreBundle, a as unlockMasterKeystore, b as unlockNormalKeystore } from '../chunks/keystore-BFVSylSw.js';
5
5
  import { l as load } from '../chunks/lclib-C2eG5HzD.js';
6
- import _ from 'lodash';
7
6
  import '../chunks/base-BQXfRsuw.js';
8
7
  import '../chunks/account-FZT9LH_s.js';
9
8
  import '../chunks/tslib.es6-WQS2tr1v.js';
@@ -172,7 +171,7 @@ class TxValidator {
172
171
  for (const paramKey in mapping) {
173
172
  const txKey = mapping[paramKey];
174
173
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
175
- const txValue = _.get(tx, txKey);
174
+ const txValue = this.getByPath(tx, txKey);
176
175
  if (paramValue !== txValue) {
177
176
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
178
177
  }
@@ -181,7 +180,7 @@ class TxValidator {
181
180
  const txKey = optional[paramKey];
182
181
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
183
182
  if (paramValue && paramValue !== '' && paramValue !== 0) {
184
- const txValue = _.get(tx, txKey);
183
+ const txValue = this.getByPath(tx, txKey);
185
184
  if (paramValue !== txValue) {
186
185
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
187
186
  }
@@ -191,8 +190,8 @@ class TxValidator {
191
190
  };
192
191
  this.checkComplexField = (params, tx, { paramPath, txPath, paramTransform, txTransform }) => {
193
192
  const paramValue = paramTransform(this.getByPathIgnoreCase(params, paramPath));
194
- const txValue = txTransform(_.get(tx, txPath));
195
- if (!_.isEqual(paramValue, txValue)) {
193
+ const txValue = txTransform(this.getByPath(tx, txPath));
194
+ if (!this.isDeepEqual(paramValue, txValue)) {
196
195
  return this.logAndFail(tx.type, paramPath, paramValue, txValue);
197
196
  }
198
197
  return true;
@@ -216,6 +215,36 @@ class TxValidator {
216
215
  }
217
216
  return current;
218
217
  }
218
+ getByPath(obj, path) {
219
+ const keys = path.split('.');
220
+ let current = obj;
221
+ for (const key of keys) {
222
+ if (current == null)
223
+ return undefined;
224
+ current = current[key];
225
+ }
226
+ return current;
227
+ }
228
+ isDeepEqual(a, b) {
229
+ if (a === b)
230
+ return true;
231
+ if (a == null || b == null)
232
+ return a === b;
233
+ if (typeof a !== typeof b || typeof a !== 'object')
234
+ return false;
235
+ if (Array.isArray(a) !== Array.isArray(b))
236
+ return false;
237
+ if (Array.isArray(a)) {
238
+ if (a.length !== b.length)
239
+ return false;
240
+ return a.every((v, i) => this.isDeepEqual(v, b[i]));
241
+ }
242
+ const keysA = Object.keys(a);
243
+ const keysB = Object.keys(b);
244
+ if (keysA.length !== keysB.length)
245
+ return false;
246
+ return keysA.every(k => Object.prototype.hasOwnProperty.call(b, k) && this.isDeepEqual(a[k], b[k]));
247
+ }
219
248
  }
220
249
 
221
250
  /**
@@ -13,6 +13,8 @@ export declare class TxValidator {
13
13
  }) => IntegrityCheckResult;
14
14
  private logAndFail;
15
15
  private getByPathIgnoreCase;
16
+ private getByPath;
17
+ private isDeepEqual;
16
18
  /**
17
19
  * params 객체와 tx 객체의 필드를 주어진 매핑에 따라 비교합니다.
18
20
  * @param params 파라미터 객체.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locuschain/lib",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "type": "module",
5
5
  "author": "bloomtechnology",
6
6
  "license": "MIT",
@@ -9,7 +9,9 @@
9
9
  "node": "~22.19.0"
10
10
  },
11
11
  "main": "./dist/index.cjs.cjs",
12
- "module": "./dist/index.amd.js",
12
+ "module": "./dist/index.esm.js",
13
+ "unpkg": "./dist/umd/index.umd.js",
14
+ "jsdelivr": "./dist/umd/index.umd.js",
13
15
  "types": "./dist/index.d.mts",
14
16
  "exports": {
15
17
  ".": {
@@ -99,14 +101,12 @@
99
101
  "@rollup/plugin-json": "^6.1.0",
100
102
  "@rollup/plugin-node-resolve": "^15.3.0",
101
103
  "@rollup/plugin-typescript": "^12.1.1",
102
- "@types/lodash": "^4.17.21",
103
104
  "copyfiles": "^2.4.1",
104
105
  "rollup": "^4.24.3",
105
106
  "rollup-plugin-copy": "^3.5.0",
106
107
  "tslib": "^2.8.1"
107
108
  },
108
109
  "dependencies": {
109
- "lodash": "^4.17.21",
110
110
  "wasm-opt": "^1.4.0",
111
111
  "@locuschain/errors": "1.1.0"
112
112
  },
@@ -1,306 +0,0 @@
1
- define(['exports', '../chunks/tslib.es6-D29rxPkW', '../chunks/tx-type-CS4wIUJ8', '../chunks/base-B_kRRfsf', '../chunks/account-BSrvZ7S8', '../chunks/wasm-3Ghi_Hxd', '../chunks/lclib-BfTIyj-E'], (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
- }));
@@ -1,151 +0,0 @@
1
- define(['exports', '../chunks/wasm-3Ghi_Hxd', '../chunks/debugWalletActions-BDz-h2tl', '../chunks/lclib-BfTIyj-E', '../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
- }));