@hardkas/accounts 0.12.0-rc.10 → 0.12.0-rc.17
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/{authorizers-NEWT33BI.js → authorizers-UXI2FDEL.js} +1 -2
- package/dist/{chunk-P7GKSUK7.js → chunk-JEDKKL3A.js} +6 -6
- package/dist/{chunk-5WYALW6N.js → chunk-SKS7OJDP.js} +3 -3
- package/dist/{chunk-23LEGEIY.js → chunk-ZLLSFQAB.js} +40 -15
- package/dist/{dev-accounts-IIHQSSO2.js → dev-accounts-VK4AUUW2.js} +2 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -4
- package/dist/internal/wasm-rpc-serialization.js +0 -1
- package/dist/{keystore-2KRHVGCM.js → keystore-CMWEKGBF.js} +0 -1
- package/dist/{resolve-LNOAVBLS.js → resolve-ZSVFIV4Y.js} +3 -2
- package/dist/{signer-backend-X3FD3XMB.js → signer-backend-W3LNCQA3.js} +0 -1
- package/package.json +6 -6
- package/dist/chunk-MCKGQKYU.js +0 -15
- package/dist/core-lib-2VZIZ7XT.js +0 -29006
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-R5P3WIWR.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveHardkasAccount
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZLLSFQAB.js";
|
|
7
7
|
import {
|
|
8
8
|
loadKaspaWasm
|
|
9
9
|
} from "./chunk-6DPO5V3N.js";
|
|
@@ -28,7 +28,7 @@ var KaspaWasmPrivateKeySigner = class {
|
|
|
28
28
|
async signTxPlan(input) {
|
|
29
29
|
const plan = input.planArtifact;
|
|
30
30
|
const sdk = await loadKaspaWasm(this.options.wasmConfig);
|
|
31
|
-
const { detectCapabilities } = await import("./signer-backend-
|
|
31
|
+
const { detectCapabilities } = await import("./signer-backend-W3LNCQA3.js");
|
|
32
32
|
const capabilities = detectCapabilities(sdk);
|
|
33
33
|
if (plan.computeBudget !== void 0 || plan.outputs.some((o) => o.covenant)) {
|
|
34
34
|
if (!capabilities.transactionV1Signing) {
|
|
@@ -55,8 +55,8 @@ var KaspaWasmPrivateKeySigner = class {
|
|
|
55
55
|
}
|
|
56
56
|
if (!pkValue && account.keystorePath) {
|
|
57
57
|
try {
|
|
58
|
-
const KeystoreManager2 = (await import("./keystore-
|
|
59
|
-
const DEV_ACCOUNTS_PASSWORD2 = (await import("./dev-accounts-
|
|
58
|
+
const KeystoreManager2 = (await import("./keystore-CMWEKGBF.js")).KeystoreManager;
|
|
59
|
+
const DEV_ACCOUNTS_PASSWORD2 = (await import("./dev-accounts-VK4AUUW2.js")).DEV_ACCOUNTS_PASSWORD;
|
|
60
60
|
const keystore = await KeystoreManager2.loadEncryptedKeystore(account.keystorePath);
|
|
61
61
|
const unlock = await KeystoreManager2.decryptEncryptedKeystore(keystore, DEV_ACCOUNTS_PASSWORD2);
|
|
62
62
|
if (unlock.success && unlock.payload) {
|
|
@@ -76,7 +76,7 @@ var KaspaWasmPrivateKeySigner = class {
|
|
|
76
76
|
throw err;
|
|
77
77
|
}
|
|
78
78
|
const expectedAddress = new sdk.PrivateKey(pkValue).toKeypair().toAddress(plan.networkId || "simnet").toString();
|
|
79
|
-
const { PrivateKeyAuthorizer } = await import("./authorizers-
|
|
79
|
+
const { PrivateKeyAuthorizer } = await import("./authorizers-UXI2FDEL.js");
|
|
80
80
|
const sourceInputs = plan.inputs || plan.selectedUtxos || [];
|
|
81
81
|
for (let i = 0; i < numInputs; i++) {
|
|
82
82
|
if (!authorizers[i]) {
|
|
@@ -341,7 +341,7 @@ async function getOrCreateDevAccount(workspaceDir, index, alias) {
|
|
|
341
341
|
try {
|
|
342
342
|
sdkModule = await import(
|
|
343
343
|
/* @vite-ignore */
|
|
344
|
-
"
|
|
344
|
+
"@kaspa/core-lib"
|
|
345
345
|
);
|
|
346
346
|
} catch (e) {
|
|
347
347
|
console.warn(`
|
|
@@ -63,7 +63,7 @@ var LazyAccountAuthorizer = class {
|
|
|
63
63
|
accountName;
|
|
64
64
|
workspaceRoot;
|
|
65
65
|
async authorize(context) {
|
|
66
|
-
const { resolveHardkasAccount } = await import("./resolve-
|
|
66
|
+
const { resolveHardkasAccount } = await import("./resolve-ZSVFIV4Y.js");
|
|
67
67
|
const account = await resolveHardkasAccount({
|
|
68
68
|
nameOrAddress: this.accountName,
|
|
69
69
|
config: { cwd: this.workspaceRoot }
|
|
@@ -74,8 +74,8 @@ var LazyAccountAuthorizer = class {
|
|
|
74
74
|
}
|
|
75
75
|
if (!pkValue && account.keystorePath) {
|
|
76
76
|
try {
|
|
77
|
-
const { KeystoreManager } = await import("./keystore-
|
|
78
|
-
const { DEV_ACCOUNTS_PASSWORD } = await import("./dev-accounts-
|
|
77
|
+
const { KeystoreManager } = await import("./keystore-CMWEKGBF.js");
|
|
78
|
+
const { DEV_ACCOUNTS_PASSWORD } = await import("./dev-accounts-VK4AUUW2.js");
|
|
79
79
|
const keystore = await KeystoreManager.loadEncryptedKeystore(account.keystorePath);
|
|
80
80
|
const unlock = await KeystoreManager.decryptEncryptedKeystore(keystore, DEV_ACCOUNTS_PASSWORD);
|
|
81
81
|
if (unlock.success && unlock.payload) {
|
|
@@ -219,7 +219,7 @@ function resolveHardkasAccount(options) {
|
|
|
219
219
|
let alias = nameOrAddress;
|
|
220
220
|
if (alias === "0") alias = "alice";
|
|
221
221
|
if (alias === "1") alias = "bob";
|
|
222
|
-
const accounts = listHardkasAccounts(config);
|
|
222
|
+
const accounts = listHardkasAccounts(config, options.executionTarget);
|
|
223
223
|
const found = accounts.find((a) => a.name === alias);
|
|
224
224
|
if (found) {
|
|
225
225
|
return found;
|
|
@@ -229,21 +229,43 @@ function resolveHardkasAccount(options) {
|
|
|
229
229
|
`Unknown HardKAS account '${nameOrAddress}'. Available accounts: ${available}`
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function assertAccountCompatible(account, target) {
|
|
233
|
+
if (account.kind === "synthetic" && target.mode !== "simulator") {
|
|
234
|
+
throw new AccountNetworkMismatchError({
|
|
235
|
+
expected: `Execution mode 'simulator'`,
|
|
236
|
+
actual: `Execution mode '${target.mode}'`,
|
|
237
|
+
detail: `Account '${account.name}' is a synthetic simulator account and cannot be used with mode '${target.mode}'.`
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if ("network" in account && account.network && target.network && account.network !== target.network) {
|
|
241
|
+
throw new AccountNetworkMismatchError({
|
|
242
|
+
expected: target.network,
|
|
243
|
+
actual: account.network,
|
|
244
|
+
detail: `Account '${account.name}' is bound to network '${account.network}' but execution target is '${target.network}'.`
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function listHardkasAccounts(config, executionTarget) {
|
|
233
249
|
const accounts = /* @__PURE__ */ new Map();
|
|
234
250
|
let targetMode = "localnet";
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
251
|
+
if (executionTarget) {
|
|
252
|
+
targetMode = executionTarget.mode;
|
|
253
|
+
} else {
|
|
254
|
+
const execConfig = config?.execution;
|
|
255
|
+
if (execConfig) {
|
|
256
|
+
if (execConfig.mode) {
|
|
257
|
+
targetMode = execConfig.mode;
|
|
258
|
+
} else if (execConfig.default) {
|
|
259
|
+
const targetName = execConfig.default;
|
|
260
|
+
const target = execConfig.targets?.[targetName];
|
|
261
|
+
if (target?.mode) {
|
|
262
|
+
targetMode = target.mode;
|
|
263
|
+
} else if (targetName === "simulator") {
|
|
264
|
+
targetMode = "simulator";
|
|
265
|
+
}
|
|
246
266
|
}
|
|
267
|
+
} else if (config?.defaultNetwork === "simulated") {
|
|
268
|
+
targetMode = "simulator";
|
|
247
269
|
}
|
|
248
270
|
}
|
|
249
271
|
const detAccounts = createDeterministicAccounts();
|
|
@@ -279,12 +301,14 @@ function listHardkasAccounts(config) {
|
|
|
279
301
|
if (!keystore.metadata?.network) {
|
|
280
302
|
throw new AccountNetworkMismatchError({ expected: "known network", actual: "undefined", detail: `at ${path2.join(devAccountsDir, file)}` });
|
|
281
303
|
}
|
|
304
|
+
const accountKind = targetMode === "simulator" ? "synthetic" : "kaspa";
|
|
282
305
|
accounts.set(name, {
|
|
283
306
|
name,
|
|
284
|
-
kind:
|
|
307
|
+
kind: accountKind,
|
|
285
308
|
network: keystore.metadata.network,
|
|
286
309
|
address: keystore.payload?.address || keystore.metadata?.address,
|
|
287
|
-
keystorePath: path2.join(devAccountsDir, file)
|
|
310
|
+
keystorePath: path2.join(devAccountsDir, file),
|
|
311
|
+
...accountKind === "synthetic" ? { executionMode: "simulator" } : {}
|
|
288
312
|
});
|
|
289
313
|
}
|
|
290
314
|
} catch (e) {
|
|
@@ -474,6 +498,7 @@ export {
|
|
|
474
498
|
listRealDevAccounts,
|
|
475
499
|
resolveRealAccountOrAddress,
|
|
476
500
|
resolveHardkasAccount,
|
|
501
|
+
assertAccountCompatible,
|
|
477
502
|
listHardkasAccounts,
|
|
478
503
|
resolveHardkasAccountAddress,
|
|
479
504
|
describeAccount
|
|
@@ -4,12 +4,11 @@ import {
|
|
|
4
4
|
ensureDevAccounts,
|
|
5
5
|
getOrCreateDevAccount,
|
|
6
6
|
listDevAccountsSync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JEDKKL3A.js";
|
|
8
8
|
import "./chunk-R5P3WIWR.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ZLLSFQAB.js";
|
|
10
10
|
import "./chunk-6DPO5V3N.js";
|
|
11
11
|
import "./chunk-YLG2NIAU.js";
|
|
12
|
-
import "./chunk-MCKGQKYU.js";
|
|
13
12
|
export {
|
|
14
13
|
DEV_ACCOUNTS_PASSWORD,
|
|
15
14
|
createDevSigner,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TxPlanArtifact, SignedTxArtifact, HardkasArtifactBase } from '@hardkas/artifacts';
|
|
2
|
-
import { HardkasConfig } from '@hardkas/config';
|
|
3
2
|
import * as _hardkas_core from '@hardkas/core';
|
|
4
3
|
import { NetworkId } from '@hardkas/core';
|
|
4
|
+
import { HardkasConfig } from '@hardkas/config';
|
|
5
5
|
import { TxPlan } from '@hardkas/tx-builder';
|
|
6
6
|
|
|
7
7
|
interface TxInputAuthorizationContext {
|
|
@@ -151,9 +151,11 @@ declare class SimulatedSigner implements HardkasSigner {
|
|
|
151
151
|
interface ResolveAccountOptions {
|
|
152
152
|
nameOrAddress: string;
|
|
153
153
|
config?: HardkasConfig | undefined;
|
|
154
|
+
executionTarget?: _hardkas_core.HardkasExecutionTarget | undefined;
|
|
154
155
|
}
|
|
155
156
|
declare function resolveHardkasAccount(options: ResolveAccountOptions): HardkasAccount;
|
|
156
|
-
declare function
|
|
157
|
+
declare function assertAccountCompatible(account: HardkasAccount, target: _hardkas_core.HardkasExecutionTarget): void;
|
|
158
|
+
declare function listHardkasAccounts(config?: HardkasConfig, executionTarget?: _hardkas_core.HardkasExecutionTarget): HardkasAccount[];
|
|
157
159
|
declare function resolveHardkasAccountAddress(accountOrAddress: string, config?: HardkasConfig, context?: "L1" | "L2"): Promise<string>;
|
|
158
160
|
declare function describeAccount(account: HardkasAccount): Record<string, unknown>;
|
|
159
161
|
|
|
@@ -565,4 +567,4 @@ declare class WalletStateStoreJson {
|
|
|
565
567
|
nextChangeIndex(walletId: string): number;
|
|
566
568
|
}
|
|
567
569
|
|
|
568
|
-
export { AddressManager, type ChainType, type CreateKaspaWalletOptions, DEV_ACCOUNTS_PASSWORD, type DeriveRequest, type DerivedAddress, type EncryptedKeystoreV2, type EvmExportResult, type GeneratedKaspaDevAccount, type HardkasAccount, type HardkasAccountKind, type HardkasBaseAccount, type HardkasEvmPrivateKeyAccount, type HardkasExternalWalletAccount, type HardkasKaspaAccount, type HardkasSigner, type HardkasSignerKind, type HardkasSyntheticAccount, type HardkasTxPlanSigner, type HelperDeriveRequest, type InputAuthorization, type KaspaKeyGenerator, KaspaSdkKeyGenerator, type KaspaSdkKeyGeneratorOptions, KaspaSdkRealTxSigner, type KaspaSdkRealTxSignerOptions, type KaspaSigningBackendStatus, KaspaWasmPrivateKeySigner, type KaspaWasmSignerOptions, type KeystoreCipherParams, type KeystoreKdfParams, KeystoreManager, type KeystorePayload, type KeystoreUnlockResult, LazyAccountAuthorizer, type NetworkType, type PathRequest, PrivateKeyAuthorizer, type RealAccountStore, type RealDevAccount, type RealTxSigner, type RealTxSigningInput, type RealTxSigningResult, type
|
|
570
|
+
export { AddressManager, type ChainType, type CreateKaspaWalletOptions, DEV_ACCOUNTS_PASSWORD, type DeriveRequest, type DerivedAddress, type EncryptedKeystoreV2, type EvmExportResult, type GeneratedKaspaDevAccount, type HardkasAccount, type HardkasAccountKind, type HardkasBaseAccount, type HardkasEvmPrivateKeyAccount, type HardkasExternalWalletAccount, type HardkasKaspaAccount, type HardkasSigner, type HardkasSignerKind, type HardkasSyntheticAccount, type HardkasTxPlanSigner, type HelperDeriveRequest, type InputAuthorization, type KaspaKeyGenerator, KaspaSdkKeyGenerator, type KaspaSdkKeyGeneratorOptions, KaspaSdkRealTxSigner, type KaspaSdkRealTxSignerOptions, type KaspaSigningBackendStatus, KaspaWasmPrivateKeySigner, type KaspaWasmSignerOptions, type KeystoreCipherParams, type KeystoreKdfParams, KeystoreManager, type KeystorePayload, type KeystoreUnlockResult, LazyAccountAuthorizer, type NetworkType, type PathRequest, PrivateKeyAuthorizer, type RealAccountStore, type RealDevAccount, type RealTxSigner, type RealTxSigningInput, type RealTxSigningResult, type SignTxPlanInput, type SignTxPlanResult, SimulatedSigner, StaticSignatureScriptAuthorizer, type TxInputAuthorizationContext, type TxInputAuthorizer, UnsupportedKaspaKeyGenerator, UnsupportedRealKaspaSigner, UnsupportedRealTxSigner, type WalletArtifact, type WalletClaims, type WalletCreateRequest, type WalletImportRequest, WalletManager, WalletManagerImpl, type WalletMetadata, type WalletState, WalletStateStoreJson, type WalletStateStoreOptions, type WasmInputSigner, type WasmProviderConfig, appendToKeystoreJson, assertAccountCompatible, assertSigningNetworkAllowed, createDevSigner, createEmptyRealAccountStore, createLocalKaspaWallet, describeAccount, detectCapabilities, ensureDevAccounts, getDefaultRealAccountsPath, getKaspaSigningBackendStatus, getOrCreateDevAccount, getRealDevAccount, getRequiredEnv, importRealDevAccount, listDevAccountsSync, listHardkasAccounts, listRealDevAccounts, loadKaspaWasm, loadOrCreateRealAccountStore, loadRealAccountStore, loadRealAccountStoreSync, prepareEvmAccountExport, removeRealDevAccount, resolveHardkasAccount, resolveHardkasAccountAddress, resolveRealAccountOrAddress, saveRealAccountStore, signTxPlanArtifact, validateAccountName, validateAddressNetwork, validateAddressPrefix, withKeystoreLock };
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,10 @@ import {
|
|
|
6
6
|
ensureDevAccounts,
|
|
7
7
|
getOrCreateDevAccount,
|
|
8
8
|
listDevAccountsSync
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JEDKKL3A.js";
|
|
10
10
|
import "./chunk-R5P3WIWR.js";
|
|
11
11
|
import {
|
|
12
|
+
assertAccountCompatible,
|
|
12
13
|
createEmptyRealAccountStore,
|
|
13
14
|
describeAccount,
|
|
14
15
|
getDefaultRealAccountsPath,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
validateAccountName,
|
|
28
29
|
validateAddressNetwork,
|
|
29
30
|
validateAddressPrefix
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZLLSFQAB.js";
|
|
31
32
|
import {
|
|
32
33
|
detectCapabilities,
|
|
33
34
|
getKaspaSigningBackendStatus,
|
|
@@ -40,8 +41,7 @@ import {
|
|
|
40
41
|
LazyAccountAuthorizer,
|
|
41
42
|
PrivateKeyAuthorizer,
|
|
42
43
|
StaticSignatureScriptAuthorizer
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-MCKGQKYU.js";
|
|
44
|
+
} from "./chunk-SKS7OJDP.js";
|
|
45
45
|
|
|
46
46
|
// src/simulated.ts
|
|
47
47
|
var SimulatedSigner = class {
|
|
@@ -718,6 +718,7 @@ export {
|
|
|
718
718
|
WalletManagerImpl,
|
|
719
719
|
WalletStateStoreJson,
|
|
720
720
|
appendToKeystoreJson,
|
|
721
|
+
assertAccountCompatible,
|
|
721
722
|
assertSigningNetworkAllowed,
|
|
722
723
|
createDevSigner,
|
|
723
724
|
createEmptyRealAccountStore,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
assertAccountCompatible,
|
|
2
3
|
describeAccount,
|
|
3
4
|
listHardkasAccounts,
|
|
4
5
|
resolveHardkasAccount,
|
|
5
6
|
resolveHardkasAccountAddress
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-MCKGQKYU.js";
|
|
7
|
+
} from "./chunk-ZLLSFQAB.js";
|
|
8
8
|
export {
|
|
9
|
+
assertAccountCompatible,
|
|
9
10
|
describeAccount,
|
|
10
11
|
listHardkasAccounts,
|
|
11
12
|
resolveHardkasAccount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardkas/accounts",
|
|
3
|
-
"version": "0.12.0-rc.
|
|
3
|
+
"version": "0.12.0-rc.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"hash-wasm": "^4.12.0",
|
|
26
26
|
"kaspa-wasm": "0.13.0",
|
|
27
|
-
"@hardkas/artifacts": "0.12.0-rc.
|
|
28
|
-
"@hardkas/
|
|
29
|
-
"@hardkas/
|
|
30
|
-
"@hardkas/
|
|
31
|
-
"@hardkas/tx-builder": "0.12.0-rc.
|
|
27
|
+
"@hardkas/artifacts": "0.12.0-rc.17",
|
|
28
|
+
"@hardkas/localnet": "0.12.0-rc.17",
|
|
29
|
+
"@hardkas/core": "0.12.0-rc.17",
|
|
30
|
+
"@hardkas/config": "0.12.0-rc.17",
|
|
31
|
+
"@hardkas/tx-builder": "0.12.0-rc.17"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsup": "^8.3.5",
|
package/dist/chunk-MCKGQKYU.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
-
}) : x)(function(x) {
|
|
5
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
__require,
|
|
14
|
-
__commonJS
|
|
15
|
-
};
|