@hardkas/accounts 0.12.0-rc.10 → 0.12.0-rc.16
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-DDHM4SUH.js} +1 -2
- package/dist/{chunk-23LEGEIY.js → chunk-AVTGARCA.js} +23 -2
- package/dist/{chunk-5WYALW6N.js → chunk-EKQU22GY.js} +3 -3
- package/dist/{chunk-P7GKSUK7.js → chunk-SYYYAEO7.js} +6 -6
- package/dist/{dev-accounts-IIHQSSO2.js → dev-accounts-K5TPW2TH.js} +2 -3
- package/dist/index.d.ts +3 -2
- 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-5JBZXBNN.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
|
@@ -229,6 +229,22 @@ function resolveHardkasAccount(options) {
|
|
|
229
229
|
`Unknown HardKAS account '${nameOrAddress}'. Available accounts: ${available}`
|
|
230
230
|
);
|
|
231
231
|
}
|
|
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
|
+
}
|
|
232
248
|
function listHardkasAccounts(config) {
|
|
233
249
|
const accounts = /* @__PURE__ */ new Map();
|
|
234
250
|
let targetMode = "localnet";
|
|
@@ -245,6 +261,8 @@ function listHardkasAccounts(config) {
|
|
|
245
261
|
targetMode = "simulator";
|
|
246
262
|
}
|
|
247
263
|
}
|
|
264
|
+
} else if (config?.defaultNetwork === "simulated") {
|
|
265
|
+
targetMode = "simulator";
|
|
248
266
|
}
|
|
249
267
|
const detAccounts = createDeterministicAccounts();
|
|
250
268
|
for (const det of detAccounts) {
|
|
@@ -279,12 +297,14 @@ function listHardkasAccounts(config) {
|
|
|
279
297
|
if (!keystore.metadata?.network) {
|
|
280
298
|
throw new AccountNetworkMismatchError({ expected: "known network", actual: "undefined", detail: `at ${path2.join(devAccountsDir, file)}` });
|
|
281
299
|
}
|
|
300
|
+
const accountKind = targetMode === "simulator" ? "synthetic" : "kaspa";
|
|
282
301
|
accounts.set(name, {
|
|
283
302
|
name,
|
|
284
|
-
kind:
|
|
303
|
+
kind: accountKind,
|
|
285
304
|
network: keystore.metadata.network,
|
|
286
305
|
address: keystore.payload?.address || keystore.metadata?.address,
|
|
287
|
-
keystorePath: path2.join(devAccountsDir, file)
|
|
306
|
+
keystorePath: path2.join(devAccountsDir, file),
|
|
307
|
+
...accountKind === "synthetic" ? { executionMode: "simulator" } : {}
|
|
288
308
|
});
|
|
289
309
|
}
|
|
290
310
|
} catch (e) {
|
|
@@ -474,6 +494,7 @@ export {
|
|
|
474
494
|
listRealDevAccounts,
|
|
475
495
|
resolveRealAccountOrAddress,
|
|
476
496
|
resolveHardkasAccount,
|
|
497
|
+
assertAccountCompatible,
|
|
477
498
|
listHardkasAccounts,
|
|
478
499
|
resolveHardkasAccountAddress,
|
|
479
500
|
describeAccount
|
|
@@ -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-5JBZXBNN.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-K5TPW2TH.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) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-R5P3WIWR.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveHardkasAccount
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AVTGARCA.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-K5TPW2TH.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-DDHM4SUH.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(`
|
|
@@ -4,12 +4,11 @@ import {
|
|
|
4
4
|
ensureDevAccounts,
|
|
5
5
|
getOrCreateDevAccount,
|
|
6
6
|
listDevAccountsSync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SYYYAEO7.js";
|
|
8
8
|
import "./chunk-R5P3WIWR.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-AVTGARCA.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 {
|
|
@@ -153,6 +153,7 @@ interface ResolveAccountOptions {
|
|
|
153
153
|
config?: HardkasConfig | undefined;
|
|
154
154
|
}
|
|
155
155
|
declare function resolveHardkasAccount(options: ResolveAccountOptions): HardkasAccount;
|
|
156
|
+
declare function assertAccountCompatible(account: HardkasAccount, target: _hardkas_core.HardkasExecutionTarget): void;
|
|
156
157
|
declare function listHardkasAccounts(config?: HardkasConfig): HardkasAccount[];
|
|
157
158
|
declare function resolveHardkasAccountAddress(accountOrAddress: string, config?: HardkasConfig, context?: "L1" | "L2"): Promise<string>;
|
|
158
159
|
declare function describeAccount(account: HardkasAccount): Record<string, unknown>;
|
|
@@ -565,4 +566,4 @@ declare class WalletStateStoreJson {
|
|
|
565
566
|
nextChangeIndex(walletId: string): number;
|
|
566
567
|
}
|
|
567
568
|
|
|
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
|
|
569
|
+
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-SYYYAEO7.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-AVTGARCA.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-EKQU22GY.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-AVTGARCA.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.16",
|
|
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/
|
|
27
|
+
"@hardkas/artifacts": "0.12.0-rc.16",
|
|
28
|
+
"@hardkas/config": "0.12.0-rc.16",
|
|
29
|
+
"@hardkas/tx-builder": "0.12.0-rc.16",
|
|
30
|
+
"@hardkas/core": "0.12.0-rc.16",
|
|
31
|
+
"@hardkas/localnet": "0.12.0-rc.16"
|
|
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
|
-
};
|