@locuschain/lib 0.1.38 → 0.1.40

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.
Files changed (51) hide show
  1. package/dist/accounts/index.amd.js +306 -0
  2. package/dist/accounts/index.cjs.cjs +2 -2
  3. package/dist/accounts/index.esm.js +2 -2
  4. package/dist/autogen/index.amd.js +151 -0
  5. package/dist/autogen/index.cjs.cjs +2 -2
  6. package/dist/autogen/index.esm.js +2 -2
  7. package/dist/chunks/account-BSrvZ7S8.js +77 -0
  8. package/dist/chunks/address-class-Dp7aNQb2.js +18 -0
  9. package/dist/chunks/base-B_kRRfsf.js +27 -0
  10. package/dist/chunks/debugWalletActions-BDz-h2tl.js +993 -0
  11. package/dist/chunks/{keystore-BFVSylSw.js → keystore-B86UzV8A.js} +1 -1
  12. package/dist/chunks/{keystore-BbK5pVrh.cjs → keystore-BUskzeOs.cjs} +1 -1
  13. package/dist/chunks/keystore-y1JlFTKh.js +143 -0
  14. package/dist/chunks/lclib-Bv86gksL.js +3861 -0
  15. package/dist/chunks/{lclib-C2eG5HzD.js → lclib-j2x9RvDY.js} +55 -32
  16. package/dist/chunks/{lclib-DuoOR0-Q.cjs → lclib-rGyKpClJ.cjs} +64 -41
  17. package/dist/chunks/rpc-C4n7t9y0.js +25 -0
  18. package/dist/chunks/transport-BBAz1kmP.js +30 -0
  19. package/dist/chunks/tslib.es6-D29rxPkW.js +37 -0
  20. package/dist/chunks/tx-type-CS4wIUJ8.js +68 -0
  21. package/dist/chunks/{wasm-DTyHBxcY.cjs → wasm-BYOKRR31.cjs} +1 -1
  22. package/dist/chunks/{wasm-BtPcXTR4.js → wasm-CLXJDrJA.js} +1 -1
  23. package/dist/chunks/wasm-CkFW222S.js +213 -0
  24. package/dist/clients/index.amd.js +97 -0
  25. package/dist/clients/index.cjs.cjs +1 -1
  26. package/dist/clients/index.esm.js +1 -1
  27. package/dist/constant/index.amd.js +458 -0
  28. package/dist/contracts/index.amd.js +19640 -0
  29. package/dist/contracts/index.cjs.cjs +2 -2
  30. package/dist/contracts/index.esm.js +2 -2
  31. package/dist/errors/index.amd.js +17 -0
  32. package/dist/index.amd.js +43 -0
  33. package/dist/index.cjs.cjs +3 -3
  34. package/dist/index.esm.js +3 -3
  35. package/dist/transports/index.amd.js +98 -0
  36. package/dist/utils/index.amd.js +353 -0
  37. package/dist/utils/index.cjs.cjs +3 -3
  38. package/dist/utils/index.esm.js +4 -4
  39. package/dist/vite-plugin/index.amd.js +186 -0
  40. package/dist/vite-plugin/index.cjs.cjs +189 -0
  41. package/dist/vite-plugin/index.d.cts +46 -0
  42. package/dist/vite-plugin/index.d.mts +46 -0
  43. package/dist/vite-plugin/index.esm.js +183 -0
  44. package/dist/webpack-plugin/index.amd.js +101 -0
  45. package/dist/webpack-plugin/index.cjs.cjs +104 -0
  46. package/dist/webpack-plugin/index.d.cts +46 -0
  47. package/dist/webpack-plugin/index.d.mts +46 -0
  48. package/dist/webpack-plugin/index.esm.js +98 -0
  49. package/package.json +36 -6
  50. package/dist/index.umd.d.mts +0 -15
  51. package/dist/umd/index.umd.js +0 -26296
@@ -0,0 +1,213 @@
1
+ define(['exports', './lclib-Bv86gksL'], (function (exports, lclib) { 'use strict';
2
+
3
+ // Automatically generated file. DO NOT EDIT.
4
+ const callWasm = (cmd, params) => {
5
+ // @ts-ignore
6
+ let callLclib = globalThis["CallLclib"];
7
+ // @ts-ignore
8
+ if (lclib.namespace && globalThis[lclib.namespace]) {
9
+ // @ts-ignore
10
+ callLclib = globalThis[lclib.namespace]["CallLclib"];
11
+ }
12
+ // @ts-ignore
13
+ if (typeof callLclib !== "function")
14
+ throw new Error("Wasm module is not loaded. Please call loadWasm or loadWasmSync first.");
15
+ // @ts-ignore
16
+ const resultString = callLclib(cmd, JSON.stringify(params));
17
+ const result = JSON.parse(resultString);
18
+ if (result.error && result.error.code != 0) {
19
+ const error = Object.assign(Object.assign({}, result.error), { message: result.error.message });
20
+ delete error.message;
21
+ throw error;
22
+ }
23
+ else {
24
+ return result.result;
25
+ }
26
+ };
27
+ const calculateTxLinkHash = (params) => {
28
+ return callWasm('calculateTxLinkHash', [params]);
29
+ };
30
+ const compileCoreScript = (params) => {
31
+ return callWasm('compileCoreScript', [params]);
32
+ };
33
+ const convertAddressToData = (addrEncoded) => {
34
+ return callWasm('convertAddressToData', [addrEncoded]);
35
+ };
36
+ const convertAddressToHex = (addrEncoded) => {
37
+ return callWasm('convertAddressToHex', [addrEncoded]);
38
+ };
39
+ const convertBase32ToData = (encoded) => {
40
+ return callWasm('convertBase32ToData', [encoded]);
41
+ };
42
+ const convertBase32ToHex = (encoded) => {
43
+ return callWasm('convertBase32ToHex', [encoded]);
44
+ };
45
+ const convertCurrency = (params) => {
46
+ return callWasm('convertCurrency', [params]);
47
+ };
48
+ const convertDataTo = (value, retType) => {
49
+ return callWasm('convertDataTo', [value, retType]);
50
+ };
51
+ const convertDataToAddress = (str) => {
52
+ return callWasm('convertDataToAddress', [str]);
53
+ };
54
+ const convertDataToBase32 = (str) => {
55
+ return callWasm('convertDataToBase32', [str]);
56
+ };
57
+ const convertDataToHex = (str) => {
58
+ return callWasm('convertDataToHex', [str]);
59
+ };
60
+ const convertDataToString = (str) => {
61
+ return callWasm('convertDataToString', [str]);
62
+ };
63
+ const convertHexToAddress = (hexString) => {
64
+ return callWasm('convertHexToAddress', [hexString]);
65
+ };
66
+ const convertHexToBase32 = (hexString) => {
67
+ return callWasm('convertHexToBase32', [hexString]);
68
+ };
69
+ const convertHexToData = (encoded) => {
70
+ return callWasm('convertHexToData', [encoded]);
71
+ };
72
+ const convertStringToData = (raw) => {
73
+ return callWasm('convertStringToData', [raw]);
74
+ };
75
+ const convertToData = (value, valueType) => {
76
+ return callWasm('convertToData', [value, valueType]);
77
+ };
78
+ const createAccountAndKeystore = (params) => {
79
+ return callWasm('createAccountAndKeystore', [params]);
80
+ };
81
+ const createMasterKeystore = (params) => {
82
+ return callWasm('createMasterKeystore', [params]);
83
+ };
84
+ const createNormalKey = (params) => {
85
+ return callWasm('createNormalKey', [params]);
86
+ };
87
+ const createNormalKeystore = (params) => {
88
+ return callWasm('createNormalKeystore', [params]);
89
+ };
90
+ const decodeTxs = (params) => {
91
+ return callWasm('decodeTxs', [params]);
92
+ };
93
+ const deriveKeysFromMnemonic = (params) => {
94
+ return callWasm('deriveKeysFromMnemonic', [params]);
95
+ };
96
+ const deriveKeysFromMnemonicAndPath = (params) => {
97
+ return callWasm('deriveKeysFromMnemonicAndPath', [params]);
98
+ };
99
+ const disCompileCoreScript = (params) => {
100
+ return callWasm('disCompileCoreScript', [params]);
101
+ };
102
+ const encodeTxCurrency = (params) => {
103
+ return callWasm('encodeTxCurrency', [params]);
104
+ };
105
+ const encodeTxNumber = (params) => {
106
+ return callWasm('encodeTxNumber', [params]);
107
+ };
108
+ const generateMnemonic = (params) => {
109
+ return callWasm('generateMnemonic', [params]);
110
+ };
111
+ const generateMnemonicBySeed = (params) => {
112
+ return callWasm('generateMnemonicBySeed', [params]);
113
+ };
114
+ const getDefFromCoreScript = (params) => {
115
+ return callWasm('getDefFromCoreScript', [params]);
116
+ };
117
+ const getHomeShard = (params) => {
118
+ return callWasm('getHomeShard', [params]);
119
+ };
120
+ const getLibraryVersions = () => {
121
+ return callWasm('getLibraryVersions', []);
122
+ };
123
+ const gzipAndEncode = (str) => {
124
+ return callWasm('gzipAndEncode', [str]);
125
+ };
126
+ const hash = (params) => {
127
+ return callWasm('hash', [params]);
128
+ };
129
+ const isGrantConsumingTx = (txTypeStr) => {
130
+ return callWasm('isGrantConsumingTx', [txTypeStr]);
131
+ };
132
+ const loadMasterKeystore = (params) => {
133
+ return callWasm('loadMasterKeystore', [params]);
134
+ };
135
+ const loadNormalKeystore = (params) => {
136
+ return callWasm('loadNormalKeystore', [params]);
137
+ };
138
+ const makeCurrency = (params) => {
139
+ return callWasm('makeCurrency', [params]);
140
+ };
141
+ const sign = (param) => {
142
+ return callWasm('sign', [param]);
143
+ };
144
+ const signByMasterKey = (params) => {
145
+ return callWasm('signByMasterKey', [params]);
146
+ };
147
+ const signKeyBind = (params) => {
148
+ return callWasm('signKeyBind', [params]);
149
+ };
150
+ const testCoreScript = (params) => {
151
+ return callWasm('testCoreScript', [params]);
152
+ };
153
+ const verify = (params) => {
154
+ return callWasm('verify', [params]);
155
+ };
156
+ const verifyByMasterKey = (params) => {
157
+ return callWasm('verifyByMasterKey', [params]);
158
+ };
159
+ const verifyMerkleProof = (params) => {
160
+ return callWasm('verifyMerkleProof', [params]);
161
+ };
162
+ const verifyTx = (jsonTx) => {
163
+ return callWasm('verifyTx', [jsonTx]);
164
+ };
165
+
166
+ exports.calculateTxLinkHash = calculateTxLinkHash;
167
+ exports.compileCoreScript = compileCoreScript;
168
+ exports.convertAddressToData = convertAddressToData;
169
+ exports.convertAddressToHex = convertAddressToHex;
170
+ exports.convertBase32ToData = convertBase32ToData;
171
+ exports.convertBase32ToHex = convertBase32ToHex;
172
+ exports.convertCurrency = convertCurrency;
173
+ exports.convertDataTo = convertDataTo;
174
+ exports.convertDataToAddress = convertDataToAddress;
175
+ exports.convertDataToBase32 = convertDataToBase32;
176
+ exports.convertDataToHex = convertDataToHex;
177
+ exports.convertDataToString = convertDataToString;
178
+ exports.convertHexToAddress = convertHexToAddress;
179
+ exports.convertHexToBase32 = convertHexToBase32;
180
+ exports.convertHexToData = convertHexToData;
181
+ exports.convertStringToData = convertStringToData;
182
+ exports.convertToData = convertToData;
183
+ exports.createAccountAndKeystore = createAccountAndKeystore;
184
+ exports.createMasterKeystore = createMasterKeystore;
185
+ exports.createNormalKey = createNormalKey;
186
+ exports.createNormalKeystore = createNormalKeystore;
187
+ exports.decodeTxs = decodeTxs;
188
+ exports.deriveKeysFromMnemonic = deriveKeysFromMnemonic;
189
+ exports.deriveKeysFromMnemonicAndPath = deriveKeysFromMnemonicAndPath;
190
+ exports.disCompileCoreScript = disCompileCoreScript;
191
+ exports.encodeTxCurrency = encodeTxCurrency;
192
+ exports.encodeTxNumber = encodeTxNumber;
193
+ exports.generateMnemonic = generateMnemonic;
194
+ exports.generateMnemonicBySeed = generateMnemonicBySeed;
195
+ exports.getDefFromCoreScript = getDefFromCoreScript;
196
+ exports.getHomeShard = getHomeShard;
197
+ exports.getLibraryVersions = getLibraryVersions;
198
+ exports.gzipAndEncode = gzipAndEncode;
199
+ exports.hash = hash;
200
+ exports.isGrantConsumingTx = isGrantConsumingTx;
201
+ exports.loadMasterKeystore = loadMasterKeystore;
202
+ exports.loadNormalKeystore = loadNormalKeystore;
203
+ exports.makeCurrency = makeCurrency;
204
+ exports.sign = sign;
205
+ exports.signByMasterKey = signByMasterKey;
206
+ exports.signKeyBind = signKeyBind;
207
+ exports.testCoreScript = testCoreScript;
208
+ exports.verify = verify;
209
+ exports.verifyByMasterKey = verifyByMasterKey;
210
+ exports.verifyMerkleProof = verifyMerkleProof;
211
+ exports.verifyTx = verifyTx;
212
+
213
+ }));
@@ -0,0 +1,97 @@
1
+ define(['exports', '../chunks/lclib-Bv86gksL', '../chunks/debugWalletActions-BDz-h2tl', '../chunks/tslib.es6-D29rxPkW', '../transports/index.amd', '../chunks/rpc-C4n7t9y0', '../chunks/base-B_kRRfsf', '../chunks/account-BSrvZ7S8', '../chunks/transport-BBAz1kmP'], (function (exports, lclib, debugWalletActions, tslib_es6, transports, rpc, base, account, transport) { 'use strict';
2
+
3
+ function createClient(args) {
4
+ var _a;
5
+ let counter = 0;
6
+ const idGen = () => {
7
+ if (counter === Number.MAX_SAFE_INTEGER)
8
+ counter = 0;
9
+ return ++counter;
10
+ };
11
+ const transport = args.transport({ id: idGen });
12
+ const account = ((_a = args.account) !== null && _a !== void 0 ? _a : undefined);
13
+ const request = (rpcArgs, opts) => transport.request(rpcArgs, opts);
14
+ const base = {
15
+ transport,
16
+ account,
17
+ request,
18
+ };
19
+ return attachExtend(base);
20
+ }
21
+ function attachExtend(base) {
22
+ const target = base;
23
+ target.extend = (fn) => {
24
+ const ext = fn(base);
25
+ const merged = Object.assign(Object.assign({}, base), ext);
26
+ return attachExtend(merged);
27
+ };
28
+ return target;
29
+ }
30
+
31
+ function createPublicClient(args) {
32
+ return createClient({ transport: args.transport });
33
+ }
34
+
35
+ function createWalletClient(args) {
36
+ return createClient({
37
+ transport: args.transport,
38
+ account: args.account,
39
+ });
40
+ }
41
+
42
+ /**
43
+ * Locus 읽기 전용 클라이언트의 one-call 생성자.
44
+ *
45
+ * bare {@link createPublicClient} 를 HTTP 트랜스포트와 함께 감싸고, 두 표준
46
+ * read 액션 셋 (`publicActions` + `debugPublicActions`) 을 단일 `.extend()`
47
+ * 호출로 합쳐 부착한다. 반환된 클라이언트는 두 셋 모두 정적 타입이 잡힌
48
+ * 상태로 노출된다.
49
+ *
50
+ * 생성 이후엔 모든 read RPC (`locus_getNodeStatus`, `locus_getAccountDetail`,
51
+ * `calculateSpentByExpress`, `debug_viewContract`, ...) 가 타입이 잡힌
52
+ * 메서드로 호출 가능:
53
+ *
54
+ * ```ts
55
+ * const client = createLocusPublicClient({ rpcUrl });
56
+ * const status = await client.getNodeStatus();
57
+ * const balance = await client.getAccountDetail({ account });
58
+ * ```
59
+ *
60
+ * write TX 용 클라이언트는 {@link createLocusWalletClient} 참고.
61
+ */
62
+ function createLocusPublicClient(args) {
63
+ return createPublicClient({
64
+ transport: transports.http(args.rpcUrl, args.transport),
65
+ }).extend((c) => (Object.assign(Object.assign({}, debugWalletActions.publicActions(c)), debugWalletActions.debugPublicActions(c))));
66
+ }
67
+
68
+ /**
69
+ * Locus write 클라이언트의 one-call 생성자.
70
+ *
71
+ * bare {@link createWalletClient} 를 HTTP 트랜스포트와 함께 감싸고, 두 표준
72
+ * write 액션 셋 (`walletActions` + `debugWalletActions`) 을 단일 `.extend()`
73
+ * 호출로 합쳐 부착한다. 반환된 클라이언트는 두 셋 모두 정적 타입이 잡힌
74
+ * 상태로 노출된다.
75
+ *
76
+ * 생성 이후엔 모든 write RPC (`transferCoin`, `openAccount`, `changeKey`,
77
+ * `closeAccount`, `callContract`, `debug_createContract`, ...) 가 타입이
78
+ * 잡힌 메서드로 호출 가능. 각 호출은 내부적으로 prepare → sign → submit
79
+ * 파이프라인을 한 번에 돌리며, master/normal 키 라우팅은 `txKeyPolicy` 와
80
+ * 바인드된 `account` 의 `KeySource` 슬롯이 결정한다.
81
+ *
82
+ * 읽기 전용 RPC 는 {@link createLocusPublicClient} 참고.
83
+ */
84
+ function createLocusWalletClient(args) {
85
+ return createWalletClient({
86
+ transport: transports.http(args.rpcUrl, args.transport),
87
+ account: args.account,
88
+ }).extend((c) => (Object.assign(Object.assign({}, debugWalletActions.walletActions(c)), debugWalletActions.debugWalletActions(c))));
89
+ }
90
+
91
+ exports.createClient = createClient;
92
+ exports.createLocusPublicClient = createLocusPublicClient;
93
+ exports.createLocusWalletClient = createLocusWalletClient;
94
+ exports.createPublicClient = createPublicClient;
95
+ exports.createWalletClient = createWalletClient;
96
+
97
+ }));
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- require('../chunks/lclib-DuoOR0-Q.cjs');
3
+ require('../chunks/lclib-rGyKpClJ.cjs');
4
4
  var debugWalletActions = require('../chunks/debugWalletActions-6qjkZVq9.cjs');
5
5
  require('../chunks/tslib.es6-Cfi3-HmA.cjs');
6
6
  var transports = require('../transports/index.cjs.cjs');
@@ -1,4 +1,4 @@
1
- import '../chunks/lclib-C2eG5HzD.js';
1
+ import '../chunks/lclib-j2x9RvDY.js';
2
2
  import { an as publicActions, U as debugPublicActions, aD as walletActions, V as debugWalletActions } from '../chunks/debugWalletActions-D5-Ds7Hl.js';
3
3
  import '../chunks/tslib.es6-WQS2tr1v.js';
4
4
  import { http } from '../transports/index.esm.js';