@locuschain/lib 0.1.31 → 0.1.33
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/account.d.mts +58 -0
- package/dist/accounts/index.amd.js +306 -0
- package/dist/accounts/index.cjs.cjs +311 -0
- package/dist/accounts/index.d.cts +5 -0
- package/dist/accounts/index.d.mts +5 -0
- package/dist/accounts/index.esm.js +304 -0
- package/dist/accounts/keys/index.d.mts +2 -0
- package/dist/accounts/keys/localKeySource.d.mts +23 -0
- package/dist/accounts/keys/toKeySource.d.mts +14 -0
- package/dist/accounts/keysToAccount.d.mts +19 -0
- package/dist/accounts/mnemonicToAccount.d.mts +25 -0
- package/dist/accounts/signing/txKeyPolicy.d.mts +21 -0
- package/dist/accounts/types.d.mts +100 -0
- package/dist/actions/wallet/_deriveTxAdditions.d.mts +18 -0
- package/dist/actions/wallet/_prepareTransaction.d.mts +15 -0
- package/dist/actions/wallet/_sendPreparedTransaction.d.mts +9 -0
- package/dist/actions/wallet/_signLocusTransaction.d.mts +14 -0
- package/dist/actions/wallet/index.d.mts +5 -0
- package/dist/actions/wallet/types.d.mts +38 -0
- package/dist/autogen/actions/debug/index.d.mts +2 -0
- package/dist/autogen/actions/debug/public/allHeights.d.mts +3 -0
- package/dist/autogen/actions/debug/public/balanceGrantList.d.mts +2 -0
- package/dist/autogen/actions/debug/public/balanceList.d.mts +2 -0
- package/dist/autogen/actions/debug/public/createAccount.d.mts +3 -0
- package/dist/autogen/actions/debug/public/createNode.d.mts +4 -0
- package/dist/autogen/actions/debug/public/dumpAllAccounts.d.mts +3 -0
- package/dist/autogen/actions/debug/public/echo.d.mts +2 -0
- package/dist/autogen/actions/debug/public/gameChainCmd.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getAccountsBalances.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getAccountsHeights.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getContractLog.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getGuestsInfo.d.mts +3 -0
- package/dist/autogen/actions/debug/public/getHomeShard.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getImportAccount.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getImportAccountLog.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getKeys.d.mts +4 -0
- package/dist/autogen/actions/debug/public/getNodeBlocks.d.mts +3 -0
- package/dist/autogen/actions/debug/public/getPeerPool.d.mts +2 -0
- package/dist/autogen/actions/debug/public/getPeersInfo.d.mts +3 -0
- package/dist/autogen/actions/debug/public/importAccount.d.mts +4 -0
- package/dist/autogen/actions/debug/public/index.d.mts +29 -0
- package/dist/autogen/actions/debug/public/initReliableNodes.d.mts +4 -0
- package/dist/autogen/actions/debug/public/noArgsRets.d.mts +2 -0
- package/dist/autogen/actions/debug/public/nodeCmd.d.mts +3 -0
- package/dist/autogen/actions/debug/public/removeHoldTxs.d.mts +4 -0
- package/dist/autogen/actions/debug/public/requestVme.d.mts +4 -0
- package/dist/autogen/actions/debug/public/sendRawTransaction.d.mts +4 -0
- package/dist/autogen/actions/debug/public/setImportAccountTx.d.mts +4 -0
- package/dist/autogen/actions/debug/public/setReliableNode.d.mts +4 -0
- package/dist/autogen/actions/debug/public/viewContract.d.mts +4 -0
- package/dist/autogen/actions/debug/wallet/callContract.d.mts +4 -0
- package/dist/autogen/actions/debug/wallet/createContract.d.mts +4 -0
- package/dist/autogen/actions/debug/wallet/createSynthAccount.d.mts +4 -0
- package/dist/autogen/actions/debug/wallet/index.d.mts +4 -0
- package/dist/autogen/actions/debug/wallet/postDataToSynthAccount.d.mts +4 -0
- package/dist/autogen/actions/index.d.mts +3 -0
- package/dist/autogen/actions/public/accountHeightsToDownload.d.mts +4 -0
- package/dist/autogen/actions/public/accountHeightsToUpload.d.mts +4 -0
- package/dist/autogen/actions/public/calculateSpentByExpress.d.mts +4 -0
- package/dist/autogen/actions/public/clientMessage.d.mts +3 -0
- package/dist/autogen/actions/public/downloadAccountTxs.d.mts +4 -0
- package/dist/autogen/actions/public/echo.d.mts +2 -0
- package/dist/autogen/actions/public/findDuplicateSubscriber.d.mts +4 -0
- package/dist/autogen/actions/public/generateLatestStoredDataProof.d.mts +4 -0
- package/dist/autogen/actions/public/getAccountAssetList.d.mts +4 -0
- package/dist/autogen/actions/public/getAccountAssetObject.d.mts +4 -0
- package/dist/autogen/actions/public/getAccountDetail.d.mts +4 -0
- package/dist/autogen/actions/public/getAccountHistory.d.mts +4 -0
- package/dist/autogen/actions/public/getAccountTokenList.d.mts +4 -0
- package/dist/autogen/actions/public/getConciseNodeStatus.d.mts +3 -0
- package/dist/autogen/actions/public/getGenesisAccount.d.mts +3 -0
- package/dist/autogen/actions/public/getIdentityProof.d.mts +4 -0
- package/dist/autogen/actions/public/getInactiveTxList.d.mts +4 -0
- package/dist/autogen/actions/public/getMontInfoList.d.mts +4 -0
- package/dist/autogen/actions/public/getNodeStatus.d.mts +3 -0
- package/dist/autogen/actions/public/getOwnerBalance.d.mts +3 -0
- package/dist/autogen/actions/public/getRoundState.d.mts +4 -0
- package/dist/autogen/actions/public/getRoundStatesList.d.mts +4 -0
- package/dist/autogen/actions/public/getShardOfAccount.d.mts +4 -0
- package/dist/autogen/actions/public/getSyncState.d.mts +3 -0
- package/dist/autogen/actions/public/getTx.d.mts +4 -0
- package/dist/autogen/actions/public/getWorldRoundState.d.mts +4 -0
- package/dist/autogen/actions/public/getWorldRoundStatesList.d.mts +4 -0
- package/dist/autogen/actions/public/hasSystemToken.d.mts +4 -0
- package/dist/autogen/actions/public/index.d.mts +38 -0
- package/dist/autogen/actions/public/makeTxProof.d.mts +4 -0
- package/dist/autogen/actions/public/queryAddress.d.mts +4 -0
- package/dist/autogen/actions/public/readTxListWitness.d.mts +4 -0
- package/dist/autogen/actions/public/setHost.d.mts +3 -0
- package/dist/autogen/actions/public/subscribeAddress.d.mts +4 -0
- package/dist/autogen/actions/public/uploadAccountTxs.d.mts +3 -0
- package/dist/autogen/actions/public/verifyAndSignChallenge.d.mts +4 -0
- package/dist/autogen/actions/public/verifyIdentityProof.d.mts +4 -0
- package/dist/autogen/actions/public/verifyLatestStoredDataProof.d.mts +3 -0
- package/dist/autogen/actions/public/verifyTxListWitness.d.mts +3 -0
- package/dist/autogen/actions/wallet/acceptScript.d.mts +4 -0
- package/dist/autogen/actions/wallet/becomeGuest.d.mts +4 -0
- package/dist/autogen/actions/wallet/becomeHost.d.mts +4 -0
- package/dist/autogen/actions/wallet/changeKey.d.mts +4 -0
- package/dist/autogen/actions/wallet/changeVkey.d.mts +4 -0
- package/dist/autogen/actions/wallet/closeAccount.d.mts +4 -0
- package/dist/autogen/actions/wallet/createAssetObject.d.mts +4 -0
- package/dist/autogen/actions/wallet/createToken.d.mts +4 -0
- package/dist/autogen/actions/wallet/createVme.d.mts +4 -0
- package/dist/autogen/actions/wallet/index.d.mts +19 -0
- package/dist/autogen/actions/wallet/lockStake.d.mts +4 -0
- package/dist/autogen/actions/wallet/openAccount.d.mts +4 -0
- package/dist/autogen/actions/wallet/postData.d.mts +4 -0
- package/dist/autogen/actions/wallet/provideScript.d.mts +4 -0
- package/dist/autogen/actions/wallet/requestDataTrade.d.mts +4 -0
- package/dist/autogen/actions/wallet/transferAssetObject.d.mts +4 -0
- package/dist/autogen/actions/wallet/transferCoin.d.mts +4 -0
- package/dist/autogen/actions/wallet/transferCoinExpress.d.mts +4 -0
- package/dist/autogen/actions/wallet/transferToken.d.mts +4 -0
- package/dist/autogen/actions/wallet/unlockStake.d.mts +4 -0
- package/dist/autogen/debugPublicActions.d.mts +47 -0
- package/dist/autogen/debugWalletActions.d.mts +11 -0
- package/dist/autogen/index.amd.js +151 -0
- package/dist/autogen/index.cjs.cjs +157 -0
- package/dist/autogen/index.d.cts +8 -0
- package/dist/autogen/index.d.mts +8 -0
- package/dist/autogen/index.esm.js +49 -0
- package/dist/autogen/locus-tx.d.mts +5 -0
- package/dist/autogen/publicActions.d.mts +66 -0
- package/dist/autogen/rpc-api-spec.d.mts +208 -0
- package/dist/autogen/types/common/addr-tx-proof.d.mts +5 -0
- package/dist/autogen/types/common/asset-object-transfer.d.mts +8 -0
- package/dist/autogen/types/common/asset-object.d.mts +10 -0
- package/dist/autogen/types/common/asset-proof-objects.d.mts +5 -0
- package/dist/autogen/types/common/asset-transfer-info.d.mts +9 -0
- package/dist/autogen/types/common/base-meta.d.mts +1 -0
- package/dist/autogen/types/common/contract-exec-status.d.mts +16 -0
- package/dist/autogen/types/common/contract-transfer-info.d.mts +7 -0
- package/dist/autogen/types/common/get-peers-info.d.mts +9 -0
- package/dist/autogen/types/common/index-value-pair.d.mts +4 -0
- package/dist/autogen/types/common/index.d.mts +54 -0
- package/dist/autogen/types/common/input-params-data-transfer.d.mts +8 -0
- package/dist/autogen/types/common/key-bind-info.d.mts +4 -0
- package/dist/autogen/types/common/mont-info.d.mts +4 -0
- package/dist/autogen/types/common/object-amount-transfer.d.mts +5 -0
- package/dist/autogen/types/common/object-amount.d.mts +4 -0
- package/dist/autogen/types/common/output-download-account-txs.d.mts +4 -0
- package/dist/autogen/types/common/param-str.d.mts +3 -0
- package/dist/autogen/types/common/param-tx-data.d.mts +5 -0
- package/dist/autogen/types/common/params-token-value-pair.d.mts +4 -0
- package/dist/autogen/types/common/public-height-chunk.d.mts +4 -0
- package/dist/autogen/types/common/ref-tx-info.d.mts +5 -0
- package/dist/autogen/types/common/ref-vtx.d.mts +6 -0
- package/dist/autogen/types/common/ret-type-base.d.mts +1 -0
- package/dist/autogen/types/common/round-state-abstract.d.mts +11 -0
- package/dist/autogen/types/common/round-state-detail.d.mts +16 -0
- package/dist/autogen/types/common/rpc-account-height.d.mts +5 -0
- package/dist/autogen/types/common/rpc-accounts-balances-result.d.mts +4 -0
- package/dist/autogen/types/common/rpc-asset-list-values.d.mts +7 -0
- package/dist/autogen/types/common/rpc-data-trade-result.d.mts +5 -0
- package/dist/autogen/types/common/rpc-token-balance-pair.d.mts +4 -0
- package/dist/autogen/types/common/token-value-ab.d.mts +5 -0
- package/dist/autogen/types/common/token-value-pair.d.mts +4 -0
- package/dist/autogen/types/common/transaction-sender-index.d.mts +7 -0
- package/dist/autogen/types/common/transfer-info.d.mts +7 -0
- package/dist/autogen/types/common/tx-base.d.mts +13 -0
- package/dist/autogen/types/common/tx-hash-elements.d.mts +6 -0
- package/dist/autogen/types/common/tx-key-height-hash.d.mts +4 -0
- package/dist/autogen/types/common/tx-key-nround.d.mts +5 -0
- package/dist/autogen/types/common/tx-key.d.mts +4 -0
- package/dist/autogen/types/common/tx-meta.d.mts +2 -0
- package/dist/autogen/types/common/tx-no-signature.d.mts +1 -0
- package/dist/autogen/types/common/tx-recv-set-meta.d.mts +2 -0
- package/dist/autogen/types/common/tx-sign-key.d.mts +1 -0
- package/dist/autogen/types/common/tx-signature.d.mts +3 -0
- package/dist/autogen/types/common/tx-vsignature.d.mts +3 -0
- package/dist/autogen/types/common/vm-engine-block.d.mts +11 -0
- package/dist/autogen/types/common/vm-reward.d.mts +4 -0
- package/dist/autogen/types/common/vm-tx-state.d.mts +27 -0
- package/dist/autogen/types/common/vme-block-meta.d.mts +2 -0
- package/dist/autogen/types/common/vme-info.d.mts +3 -0
- package/dist/autogen/types/common/vme-lock-stake.d.mts +4 -0
- package/dist/autogen/types/common/vote-info-rpc.d.mts +5 -0
- package/dist/autogen/types/common/vtx-meta.d.mts +2 -0
- package/dist/autogen/types/common/wrs-validators-info.d.mts +5 -0
- package/dist/autogen/types/consts/address-class.d.mts +11 -0
- package/dist/autogen/types/consts/consts.d.mts +2 -0
- package/dist/autogen/types/consts/currency-unit.d.mts +15 -0
- package/dist/autogen/types/consts/index.d.mts +3 -0
- package/dist/autogen/types/consts/tx-type.d.mts +61 -0
- package/dist/autogen/types/consts/tx-types.d.mts +415 -0
- package/dist/autogen/types/rpc/heights-result.d.mts +4 -0
- package/dist/autogen/types/rpc/index.d.mts +106 -0
- package/dist/autogen/types/rpc/params-accept-script.d.mts +8 -0
- package/dist/autogen/types/rpc/params-account-and-index.d.mts +4 -0
- package/dist/autogen/types/rpc/params-account-heights.d.mts +5 -0
- package/dist/autogen/types/rpc/params-account-history.d.mts +5 -0
- package/dist/autogen/types/rpc/params-account.d.mts +3 -0
- package/dist/autogen/types/rpc/params-accounts.d.mts +3 -0
- package/dist/autogen/types/rpc/params-become-guest.d.mts +5 -0
- package/dist/autogen/types/rpc/params-become-host.d.mts +5 -0
- package/dist/autogen/types/rpc/params-calculate-spent-by-express.d.mts +5 -0
- package/dist/autogen/types/rpc/params-call-contract.d.mts +13 -0
- package/dist/autogen/types/rpc/params-change-key.d.mts +8 -0
- package/dist/autogen/types/rpc/params-change-vkey.d.mts +5 -0
- package/dist/autogen/types/rpc/params-close-account.d.mts +7 -0
- package/dist/autogen/types/rpc/params-contract-log.d.mts +6 -0
- package/dist/autogen/types/rpc/params-create-asset-object.d.mts +10 -0
- package/dist/autogen/types/rpc/params-create-contract.d.mts +14 -0
- package/dist/autogen/types/rpc/params-create-node.d.mts +4 -0
- package/dist/autogen/types/rpc/params-create-synth-account.d.mts +8 -0
- package/dist/autogen/types/rpc/params-create-token.d.mts +7 -0
- package/dist/autogen/types/rpc/params-create-vme.d.mts +8 -0
- package/dist/autogen/types/rpc/params-download-account-txs.d.mts +6 -0
- package/dist/autogen/types/rpc/params-find-duplicate-subscriber.d.mts +3 -0
- package/dist/autogen/types/rpc/params-game-chain-cmd.d.mts +5 -0
- package/dist/autogen/types/rpc/params-generate-latest-stored-data-proof.d.mts +4 -0
- package/dist/autogen/types/rpc/params-get-asset-list.d.mts +4 -0
- package/dist/autogen/types/rpc/params-get-asset-objects.d.mts +4 -0
- package/dist/autogen/types/rpc/params-get-home-shard.d.mts +3 -0
- package/dist/autogen/types/rpc/params-get-identity-proof.d.mts +4 -0
- package/dist/autogen/types/rpc/params-get-import-account.d.mts +3 -0
- package/dist/autogen/types/rpc/params-import-account.d.mts +7 -0
- package/dist/autogen/types/rpc/params-init-reliable-nodes.d.mts +5 -0
- package/dist/autogen/types/rpc/params-latest-stored-data-proof.d.mts +4 -0
- package/dist/autogen/types/rpc/params-lock-stake.d.mts +7 -0
- package/dist/autogen/types/rpc/params-open-account.d.mts +11 -0
- package/dist/autogen/types/rpc/params-post-data-to-synth-account.d.mts +11 -0
- package/dist/autogen/types/rpc/params-provide-script.d.mts +14 -0
- package/dist/autogen/types/rpc/params-query-address.d.mts +3 -0
- package/dist/autogen/types/rpc/params-read-tx-list.d.mts +5 -0
- package/dist/autogen/types/rpc/params-remove-hold-txs.d.mts +5 -0
- package/dist/autogen/types/rpc/params-request-data-trade.d.mts +10 -0
- package/dist/autogen/types/rpc/params-request-vme.d.mts +4 -0
- package/dist/autogen/types/rpc/params-round-list.d.mts +4 -0
- package/dist/autogen/types/rpc/params-round.d.mts +3 -0
- package/dist/autogen/types/rpc/params-rs.d.mts +4 -0
- package/dist/autogen/types/rpc/params-send-raw-transaction.d.mts +4 -0
- package/dist/autogen/types/rpc/params-set-host.d.mts +4 -0
- package/dist/autogen/types/rpc/params-set-import-account-tx.d.mts +5 -0
- package/dist/autogen/types/rpc/params-set-reliable-node.d.mts +4 -0
- package/dist/autogen/types/rpc/params-subscribe-address.d.mts +4 -0
- package/dist/autogen/types/rpc/params-transfer-asset-object.d.mts +9 -0
- package/dist/autogen/types/rpc/params-transfer-coin-express.d.mts +7 -0
- package/dist/autogen/types/rpc/params-transfer-coin.d.mts +8 -0
- package/dist/autogen/types/rpc/params-transfer-tokens.d.mts +14 -0
- package/dist/autogen/types/rpc/params-tx-list-witness.d.mts +6 -0
- package/dist/autogen/types/rpc/params-tx-list.d.mts +5 -0
- package/dist/autogen/types/rpc/params-unlock-stake.d.mts +7 -0
- package/dist/autogen/types/rpc/params-upload-account-txs.d.mts +5 -0
- package/dist/autogen/types/rpc/params-verify-and-sign-challenge.d.mts +8 -0
- package/dist/autogen/types/rpc/params-verify-identity-proof.d.mts +6 -0
- package/dist/autogen/types/rpc/result-dump-accounts.d.mts +4 -0
- package/dist/autogen/types/rpc/rpc-bool-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-calculate-spent-by-express-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-create-account-result.d.mts +7 -0
- package/dist/autogen/types/rpc/rpc-create-node-result.d.mts +5 -0
- package/dist/autogen/types/rpc/rpc-create-tx-result.d.mts +7 -0
- package/dist/autogen/types/rpc/rpc-find-duplicate-subscriber-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-game-chain-cmd-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-generate-latest-stored-data-proof-result.d.mts +4 -0
- package/dist/autogen/types/rpc/rpc-get-account-asset-list-result.d.mts +4 -0
- package/dist/autogen/types/rpc/rpc-get-account-asset-object-result.d.mts +5 -0
- package/dist/autogen/types/rpc/rpc-get-account-detail-result.d.mts +10 -0
- package/dist/autogen/types/rpc/rpc-get-account-history-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-account-token-list-result.d.mts +6 -0
- package/dist/autogen/types/rpc/rpc-get-accounts-balances-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-accounts-heights-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-concise-node-status-result.d.mts +18 -0
- package/dist/autogen/types/rpc/rpc-get-contract-log-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-genesis-account-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-guests-info-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-home-shard-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-identity-proof-result.d.mts +6 -0
- package/dist/autogen/types/rpc/rpc-get-import-account-result.d.mts +10 -0
- package/dist/autogen/types/rpc/rpc-get-inactive-tx-list-result.d.mts +14 -0
- package/dist/autogen/types/rpc/rpc-get-keys-result.d.mts +7 -0
- package/dist/autogen/types/rpc/rpc-get-mont-info-list-result.d.mts +5 -0
- package/dist/autogen/types/rpc/rpc-get-node-blocks-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-node-status-result.d.mts +28 -0
- package/dist/autogen/types/rpc/rpc-get-shard-of-account-result.d.mts +4 -0
- package/dist/autogen/types/rpc/rpc-get-sync-state-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-tx-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-get-world-round-state-result.d.mts +13 -0
- package/dist/autogen/types/rpc/rpc-get-world-round-states-list-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-has-system-token-result.d.mts +4 -0
- package/dist/autogen/types/rpc/rpc-import-account-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-node-cmd-result.d.mts +5 -0
- package/dist/autogen/types/rpc/rpc-query-address-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-read-tx-list-witness-result.d.mts +6 -0
- package/dist/autogen/types/rpc/rpc-request-vme-result.d.mts +3 -0
- package/dist/autogen/types/rpc/rpc-send-raw-transaction-result.d.mts +1 -0
- package/dist/autogen/types/rpc/rpc-set-import-account-tx-result.d.mts +5 -0
- package/dist/autogen/types/rpc/rpc-subscribe-address-result.d.mts +1 -0
- package/dist/autogen/types/rpc/rpc-verify-and-sign-challenge-result.d.mts +8 -0
- package/dist/autogen/types/rpc/rpc-verify-identity-proof-result.d.mts +4 -0
- package/dist/autogen/types/rpc/rpc-view-contract-result.d.mts +3 -0
- package/dist/autogen/types/rpc/upload-heights-result.d.mts +6 -0
- package/dist/autogen/types/tx/index.d.mts +50 -0
- package/dist/autogen/types/tx/tx-accept-script-after-time-lock.d.mts +12 -0
- package/dist/autogen/types/tx/tx-accept-script.d.mts +15 -0
- package/dist/autogen/types/tx/tx-activate-all-assets.d.mts +15 -0
- package/dist/autogen/types/tx/tx-activate-asset-object.d.mts +9 -0
- package/dist/autogen/types/tx/tx-activate-call-contract.d.mts +15 -0
- package/dist/autogen/types/tx/tx-activate-coin.d.mts +9 -0
- package/dist/autogen/types/tx/tx-activate-contract-result.d.mts +18 -0
- package/dist/autogen/types/tx/tx-activate-contract-reward.d.mts +8 -0
- package/dist/autogen/types/tx/tx-activate-contract-transfer.d.mts +15 -0
- package/dist/autogen/types/tx/tx-activate-data-synth-account.d.mts +12 -0
- package/dist/autogen/types/tx/tx-activate-foundation-reserve.d.mts +7 -0
- package/dist/autogen/types/tx/tx-activate-incentive.d.mts +11 -0
- package/dist/autogen/types/tx/tx-activate-lock-stake-for-vme.d.mts +9 -0
- package/dist/autogen/types/tx/tx-activate-open-contract.d.mts +15 -0
- package/dist/autogen/types/tx/tx-activate-open-synth-account.d.mts +9 -0
- package/dist/autogen/types/tx/tx-activate-open-vm-engine.d.mts +11 -0
- package/dist/autogen/types/tx/tx-activate-token.d.mts +12 -0
- package/dist/autogen/types/tx/tx-become-guest.d.mts +10 -0
- package/dist/autogen/types/tx/tx-become-host.d.mts +7 -0
- package/dist/autogen/types/tx/tx-burn-asset-object.d.mts +8 -0
- package/dist/autogen/types/tx/tx-burn-token.d.mts +10 -0
- package/dist/autogen/types/tx/tx-call-contract.d.mts +16 -0
- package/dist/autogen/types/tx/tx-change-foundation-account.d.mts +6 -0
- package/dist/autogen/types/tx/tx-change-keypair.d.mts +10 -0
- package/dist/autogen/types/tx/tx-change-vkey.d.mts +6 -0
- package/dist/autogen/types/tx/tx-close-account.d.mts +12 -0
- package/dist/autogen/types/tx/tx-contract-blank-reward.d.mts +5 -0
- package/dist/autogen/types/tx/tx-contract-transfer-reward.d.mts +8 -0
- package/dist/autogen/types/tx/tx-create-asset-object.d.mts +10 -0
- package/dist/autogen/types/tx/tx-create-contract.d.mts +17 -0
- package/dist/autogen/types/tx/tx-create-synth-account.d.mts +7 -0
- package/dist/autogen/types/tx/tx-create-token.d.mts +10 -0
- package/dist/autogen/types/tx/tx-create-vm-engine.d.mts +8 -0
- package/dist/autogen/types/tx/tx-dummy.d.mts +3 -0
- package/dist/autogen/types/tx/tx-finalize.d.mts +6 -0
- package/dist/autogen/types/tx/tx-freeze-account.d.mts +5 -0
- package/dist/autogen/types/tx/tx-genesis-account.d.mts +11 -0
- package/dist/autogen/types/tx/tx-lead-vtx.d.mts +9 -0
- package/dist/autogen/types/tx/tx-lock-stake-for-vme.d.mts +7 -0
- package/dist/autogen/types/tx/tx-open-account.d.mts +18 -0
- package/dist/autogen/types/tx/tx-post-data-synth-account.d.mts +9 -0
- package/dist/autogen/types/tx/tx-post-data.d.mts +11 -0
- package/dist/autogen/types/tx/tx-provide-script.d.mts +16 -0
- package/dist/autogen/types/tx/tx-revoke.d.mts +16 -0
- package/dist/autogen/types/tx/tx-transfer-asset-object.d.mts +8 -0
- package/dist/autogen/types/tx/tx-transfer-coin-express.d.mts +8 -0
- package/dist/autogen/types/tx/tx-transfer-coin.d.mts +7 -0
- package/dist/autogen/types/tx/tx-transfer-token.d.mts +11 -0
- package/dist/autogen/types/tx/tx-unlock-stake.d.mts +7 -0
- package/dist/autogen/types/tx/tx-vm-engine-block.d.mts +6 -0
- package/dist/autogen/types/wasm/grant-consume-result.d.mts +4 -0
- package/dist/autogen/types/wasm/index.d.mts +26 -0
- package/dist/autogen/types/wasm/library-versions.d.mts +6 -0
- package/dist/autogen/types/wasm/param-calculate-tx-link-hash.d.mts +3 -0
- package/dist/autogen/types/wasm/param-code-core-script.d.mts +3 -0
- package/dist/autogen/types/wasm/param-convert-currency.d.mts +5 -0
- package/dist/autogen/types/wasm/param-create-account-and-keystore.d.mts +6 -0
- package/dist/autogen/types/wasm/param-create-master-keystore.d.mts +6 -0
- package/dist/autogen/types/wasm/param-create-normal-key.d.mts +4 -0
- package/dist/autogen/types/wasm/param-create-normal-keystore.d.mts +8 -0
- package/dist/autogen/types/wasm/param-derive-keys-from-mnemonic-and-path.d.mts +4 -0
- package/dist/autogen/types/wasm/param-derive-keys-from-mnemonic.d.mts +6 -0
- package/dist/autogen/types/wasm/param-encode-tx-currency.d.mts +3 -0
- package/dist/autogen/types/wasm/param-encode-tx-number.d.mts +4 -0
- package/dist/autogen/types/wasm/param-generate-mnemonic-by-seed.d.mts +3 -0
- package/dist/autogen/types/wasm/param-generate-mnemonic.d.mts +3 -0
- package/dist/autogen/types/wasm/param-get-home-shard.d.mts +4 -0
- package/dist/autogen/types/wasm/param-hash.d.mts +4 -0
- package/dist/autogen/types/wasm/param-load-keystore.d.mts +4 -0
- package/dist/autogen/types/wasm/param-make-currency.d.mts +4 -0
- package/dist/autogen/types/wasm/param-sign-by-master-key.d.mts +4 -0
- package/dist/autogen/types/wasm/param-sign-key-bind.d.mts +5 -0
- package/dist/autogen/types/wasm/param-sign.d.mts +4 -0
- package/dist/autogen/types/wasm/param-test-core-script.d.mts +7 -0
- package/dist/autogen/types/wasm/param-txs.d.mts +3 -0
- package/dist/autogen/types/wasm/param-verify-merkle-proof.d.mts +5 -0
- package/dist/autogen/types/wasm/param-verify.d.mts +5 -0
- package/dist/autogen/walletActions.d.mts +41 -0
- package/dist/autogen/wasm/crypto_aimer.d.mts +2 -0
- package/dist/autogen/wasm/crypto_haetae.d.mts +2 -0
- package/dist/autogen/wasm/crypto_smaugt.d.mts +2 -0
- package/dist/autogen/wasm/lclib.wasm +0 -0
- package/dist/autogen/wasm.d.mts +72 -0
- package/dist/chunks/account-BAsiKnSL.cjs +77 -0
- package/dist/chunks/account-BSrvZ7S8.js +77 -0
- package/dist/chunks/account-FZT9LH_s.js +71 -0
- package/dist/chunks/address-class-CHAZYhdZ.js +14 -0
- package/dist/chunks/address-class-Cjy48Uqk.cjs +16 -0
- package/dist/chunks/address-class-Dp7aNQb2.js +18 -0
- package/dist/chunks/base-BQXfRsuw.js +23 -0
- package/dist/chunks/base-B_kRRfsf.js +27 -0
- package/dist/chunks/base-Cy5SSYLF.cjs +25 -0
- package/dist/chunks/debugWalletActions-6qjkZVq9.cjs +995 -0
- package/dist/chunks/debugWalletActions-BDz-h2tl.js +993 -0
- package/dist/chunks/debugWalletActions-D5-Ds7Hl.js +900 -0
- package/dist/chunks/keystore-BFVSylSw.js +139 -0
- package/dist/chunks/keystore-BbK5pVrh.cjs +145 -0
- package/dist/chunks/keystore-BexHKV9z.js +143 -0
- package/dist/chunks/lclib-BfTIyj-E.js +3838 -0
- package/dist/chunks/lclib-C2eG5HzD.js +3818 -0
- package/dist/chunks/lclib-DuoOR0-Q.cjs +3822 -0
- package/dist/chunks/rpc-BlPk44QH.js +22 -0
- package/dist/chunks/rpc-C4n7t9y0.js +25 -0
- package/dist/chunks/rpc-DwWIkUva.cjs +25 -0
- package/dist/chunks/transport-BBAz1kmP.js +30 -0
- package/dist/chunks/transport-VThNtzck.cjs +30 -0
- package/dist/chunks/transport-ktAPuqsc.js +26 -0
- package/dist/chunks/tslib.es6-Cfi3-HmA.cjs +35 -0
- package/dist/chunks/tslib.es6-D29rxPkW.js +37 -0
- package/dist/chunks/tslib.es6-WQS2tr1v.js +33 -0
- package/dist/chunks/tx-type-BPkhMGad.js +64 -0
- package/dist/chunks/tx-type-CS4wIUJ8.js +68 -0
- package/dist/chunks/tx-type-DI_nKG8B.cjs +66 -0
- package/dist/chunks/wasm-3Ghi_Hxd.js +213 -0
- package/dist/chunks/wasm-BtPcXTR4.js +166 -0
- package/dist/chunks/wasm-DTyHBxcY.cjs +213 -0
- package/dist/clients/createClient.d.mts +8 -0
- package/dist/clients/createLocusPublicClient.d.mts +100 -0
- package/dist/clients/createLocusWalletClient.d.mts +56 -0
- package/dist/clients/createPublicClient.d.mts +6 -0
- package/dist/clients/createWalletClient.d.mts +8 -0
- package/dist/clients/index.amd.js +97 -0
- package/dist/clients/index.cjs.cjs +104 -0
- package/dist/clients/index.d.cts +6 -0
- package/dist/clients/index.d.mts +6 -0
- package/dist/clients/index.esm.js +98 -0
- package/dist/clients/types.d.mts +19 -0
- package/dist/constant/index.amd.js +458 -0
- package/dist/constant/index.cjs.cjs +459 -0
- package/dist/constant/index.d.cts +513 -0
- package/dist/constant/index.d.mts +513 -0
- package/dist/constant/index.esm.js +451 -0
- package/dist/contracts/abis/erc20.d.mts +174 -0
- package/dist/contracts/abis/index.d.mts +1 -0
- package/dist/contracts/getContract.d.mts +33 -0
- package/dist/contracts/index.amd.js +19640 -0
- package/dist/contracts/index.cjs.cjs +19642 -0
- package/dist/contracts/index.d.cts +2 -0
- package/dist/contracts/index.d.mts +2 -0
- package/dist/contracts/index.esm.js +19639 -0
- package/dist/errors/account.d.mts +45 -0
- package/dist/errors/base.d.mts +13 -0
- package/dist/errors/index.amd.js +17 -0
- package/dist/errors/index.cjs.cjs +20 -0
- package/dist/errors/index.d.cts +4 -0
- package/dist/errors/index.d.mts +4 -0
- package/dist/errors/index.esm.js +4 -0
- package/dist/errors/rpc.d.mts +21 -0
- package/dist/errors/transport.d.mts +21 -0
- package/dist/index.amd.js +43 -0
- package/dist/index.cjs.cjs +58 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.esm.js +16 -0
- package/dist/transports/http.d.mts +9 -0
- package/dist/transports/index.amd.js +98 -0
- package/dist/transports/index.cjs.cjs +101 -0
- package/dist/transports/index.d.cts +2 -0
- package/dist/transports/index.d.mts +2 -0
- package/dist/transports/index.esm.js +99 -0
- package/dist/transports/types.d.mts +36 -0
- package/dist/types/index.d.cts +11 -0
- package/dist/types/index.d.mts +11 -0
- package/dist/types/primitives.d.mts +5 -0
- package/dist/utils/index.amd.js +323 -0
- package/dist/utils/index.cjs.cjs +330 -0
- package/dist/utils/index.d.cts +41 -0
- package/dist/utils/index.d.mts +41 -0
- package/dist/utils/index.esm.js +271 -0
- package/dist/utils/keystore.d.mts +87 -0
- package/dist/utils/lclib.d.mts +2 -0
- package/dist/utils/locus-wasm-bridge.d.mts +1 -0
- package/dist/utils/tx-validator.d.mts +26 -0
- package/dist/utils/types.d.mts +15 -0
- package/dist/utils/wasm-fetch.d.mts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { c as createAccountAndKeystore, l as loadMasterKeystore, a as loadNormalKeystore } from './wasm-BtPcXTR4.js';
|
|
2
|
+
import { B as BaseError } from './base-BQXfRsuw.js';
|
|
3
|
+
import { D as DegenerateKeyError } from './account-FZT9LH_s.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 새 dual-key keystore 를 만들고 결과 JSON array 를 master / normal 두
|
|
7
|
+
* 반쪽으로 분리한다. 각 반쪽은 독립적으로 영속화한 뒤 unlockMasterKeystore
|
|
8
|
+
* / unlockNormalKeystore 로 다시 unlock 할 수 있다.
|
|
9
|
+
*
|
|
10
|
+
* WASM 의 `createAccountAndKeystore` 에 대한 얇은 래퍼다. `utils/index.mts`
|
|
11
|
+
* 가 raw WASM export 도 함께 re-export 하므로 충돌을 피하려고 이름을
|
|
12
|
+
* 새로 붙였다.
|
|
13
|
+
*/
|
|
14
|
+
function createKeystoreBundle(args) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const raw = createAccountAndKeystore({
|
|
17
|
+
passwordMaster: args.passwordMaster,
|
|
18
|
+
passwordNormal: args.passwordNormal,
|
|
19
|
+
algoMaster: (_a = args.algoMaster) !== null && _a !== void 0 ? _a : '',
|
|
20
|
+
algoNormal: (_b = args.algoNormal) !== null && _b !== void 0 ? _b : '',
|
|
21
|
+
});
|
|
22
|
+
const { masterKsJson, normalKsJson } = splitKeystoreBundle(raw);
|
|
23
|
+
return { raw, masterKsJson, normalKsJson };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* WASM `createAccountAndKeystore` 헬퍼가 반환한 `[master, normal]` keystore
|
|
27
|
+
* 배열을 두 JSON 문자열로 분리한다.
|
|
28
|
+
*/
|
|
29
|
+
function splitKeystoreBundle(bundleJson) {
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = JSON.parse(bundleJson);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
throw new BaseError('splitKeystoreBundle: bundle is not valid JSON', { cause: err });
|
|
36
|
+
}
|
|
37
|
+
if (!Array.isArray(parsed) || parsed.length !== 2) {
|
|
38
|
+
throw new BaseError(`splitKeystoreBundle: expected a JSON array of length 2, got length ${Array.isArray(parsed) ? parsed.length : 'n/a'}`);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
masterKsJson: JSON.stringify(parsed[0]),
|
|
42
|
+
normalKsJson: JSON.stringify(parsed[1]),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* master keystore JSON 을 password 로 복호화한다.
|
|
47
|
+
*
|
|
48
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `mkeyAlgorithm`,
|
|
49
|
+
* `msecretKey`, `mpublicKey`) 를 그대로 반환한다.
|
|
50
|
+
*/
|
|
51
|
+
function unlockMasterKeystore(args) {
|
|
52
|
+
const raw = loadMasterKeystore({
|
|
53
|
+
passStr: args.password,
|
|
54
|
+
ksJson: args.ksJson,
|
|
55
|
+
});
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(raw);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
throw new BaseError('unlockMasterKeystore: WASM returned non-JSON', { cause: err });
|
|
62
|
+
}
|
|
63
|
+
assertField(parsed, 'address', 'unlockMasterKeystore');
|
|
64
|
+
assertField(parsed, 'msecretKey', 'unlockMasterKeystore');
|
|
65
|
+
assertField(parsed, 'mpublicKey', 'unlockMasterKeystore');
|
|
66
|
+
return parsed;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* normal keystore JSON 을 password 로 복호화한다.
|
|
70
|
+
*
|
|
71
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `nkeyAlgorithm`,
|
|
72
|
+
* `nsecretKey`, `npublicKey`, `keyBind`) 를 그대로 반환한다.
|
|
73
|
+
*/
|
|
74
|
+
function unlockNormalKeystore(args) {
|
|
75
|
+
const raw = loadNormalKeystore({
|
|
76
|
+
passStr: args.password,
|
|
77
|
+
ksJson: args.ksJson,
|
|
78
|
+
});
|
|
79
|
+
let parsed;
|
|
80
|
+
try {
|
|
81
|
+
parsed = JSON.parse(raw);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
throw new BaseError('unlockNormalKeystore: WASM returned non-JSON', { cause: err });
|
|
85
|
+
}
|
|
86
|
+
assertField(parsed, 'address', 'unlockNormalKeystore');
|
|
87
|
+
assertField(parsed, 'nsecretKey', 'unlockNormalKeystore');
|
|
88
|
+
assertField(parsed, 'npublicKey', 'unlockNormalKeystore');
|
|
89
|
+
return parsed;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* one-shot 헬퍼: 전체 `[master, normal]` keystore JSON 과 두 password 를
|
|
93
|
+
* 받아 `keysToAccount` 가 소비하는 평탄한 (address, msk, mpk, nsk, npk)
|
|
94
|
+
* tuple 을 반환한다.
|
|
95
|
+
*/
|
|
96
|
+
function unlockKeystoreBundle(args) {
|
|
97
|
+
const halves = typeof args.ksJsonBundle === 'string'
|
|
98
|
+
? splitKeystoreBundle(args.ksJsonBundle)
|
|
99
|
+
: {
|
|
100
|
+
masterKsJson: args.ksJsonBundle.masterKsJson,
|
|
101
|
+
normalKsJson: args.ksJsonBundle.normalKsJson,
|
|
102
|
+
};
|
|
103
|
+
const master = unlockMasterKeystore({
|
|
104
|
+
ksJson: halves.masterKsJson,
|
|
105
|
+
password: args.passwordMaster,
|
|
106
|
+
});
|
|
107
|
+
const normal = unlockNormalKeystore({
|
|
108
|
+
ksJson: halves.normalKsJson,
|
|
109
|
+
password: args.passwordNormal,
|
|
110
|
+
});
|
|
111
|
+
if (master.address !== normal.address) {
|
|
112
|
+
throw new BaseError(`unlockKeystoreBundle: keystore address mismatch (master=${master.address} normal=${normal.address})`);
|
|
113
|
+
}
|
|
114
|
+
if (master.mpublicKey === normal.npublicKey) {
|
|
115
|
+
throw new DegenerateKeyError({
|
|
116
|
+
source: 'unlockKeystoreBundle',
|
|
117
|
+
algoMaster: master.mkeyAlgorithm,
|
|
118
|
+
algoNormal: normal.nkeyAlgorithm,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
address: master.address,
|
|
123
|
+
msk: master.msecretKey,
|
|
124
|
+
mpk: master.mpublicKey,
|
|
125
|
+
nsk: normal.nsecretKey,
|
|
126
|
+
npk: normal.npublicKey,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function assertField(obj, key, fn) {
|
|
130
|
+
if (!obj || typeof obj !== 'object') {
|
|
131
|
+
throw new BaseError(`${fn}: WASM result is not an object`);
|
|
132
|
+
}
|
|
133
|
+
const v = obj[key];
|
|
134
|
+
if (typeof v !== 'string' || v.length === 0) {
|
|
135
|
+
throw new BaseError(`${fn}: WASM result missing '${key}'`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { unlockMasterKeystore as a, unlockNormalKeystore as b, createKeystoreBundle as c, splitKeystoreBundle as s, unlockKeystoreBundle as u };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var wasm = require('./wasm-DTyHBxcY.cjs');
|
|
4
|
+
var base = require('./base-Cy5SSYLF.cjs');
|
|
5
|
+
var account = require('./account-BAsiKnSL.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 새 dual-key keystore 를 만들고 결과 JSON array 를 master / normal 두
|
|
9
|
+
* 반쪽으로 분리한다. 각 반쪽은 독립적으로 영속화한 뒤 unlockMasterKeystore
|
|
10
|
+
* / unlockNormalKeystore 로 다시 unlock 할 수 있다.
|
|
11
|
+
*
|
|
12
|
+
* WASM 의 `createAccountAndKeystore` 에 대한 얇은 래퍼다. `utils/index.mts`
|
|
13
|
+
* 가 raw WASM export 도 함께 re-export 하므로 충돌을 피하려고 이름을
|
|
14
|
+
* 새로 붙였다.
|
|
15
|
+
*/
|
|
16
|
+
function createKeystoreBundle(args) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const raw = wasm.createAccountAndKeystore({
|
|
19
|
+
passwordMaster: args.passwordMaster,
|
|
20
|
+
passwordNormal: args.passwordNormal,
|
|
21
|
+
algoMaster: (_a = args.algoMaster) !== null && _a !== void 0 ? _a : '',
|
|
22
|
+
algoNormal: (_b = args.algoNormal) !== null && _b !== void 0 ? _b : '',
|
|
23
|
+
});
|
|
24
|
+
const { masterKsJson, normalKsJson } = splitKeystoreBundle(raw);
|
|
25
|
+
return { raw, masterKsJson, normalKsJson };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* WASM `createAccountAndKeystore` 헬퍼가 반환한 `[master, normal]` keystore
|
|
29
|
+
* 배열을 두 JSON 문자열로 분리한다.
|
|
30
|
+
*/
|
|
31
|
+
function splitKeystoreBundle(bundleJson) {
|
|
32
|
+
let parsed;
|
|
33
|
+
try {
|
|
34
|
+
parsed = JSON.parse(bundleJson);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
throw new base.BaseError('splitKeystoreBundle: bundle is not valid JSON', { cause: err });
|
|
38
|
+
}
|
|
39
|
+
if (!Array.isArray(parsed) || parsed.length !== 2) {
|
|
40
|
+
throw new base.BaseError(`splitKeystoreBundle: expected a JSON array of length 2, got length ${Array.isArray(parsed) ? parsed.length : 'n/a'}`);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
masterKsJson: JSON.stringify(parsed[0]),
|
|
44
|
+
normalKsJson: JSON.stringify(parsed[1]),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* master keystore JSON 을 password 로 복호화한다.
|
|
49
|
+
*
|
|
50
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `mkeyAlgorithm`,
|
|
51
|
+
* `msecretKey`, `mpublicKey`) 를 그대로 반환한다.
|
|
52
|
+
*/
|
|
53
|
+
function unlockMasterKeystore(args) {
|
|
54
|
+
const raw = wasm.loadMasterKeystore({
|
|
55
|
+
passStr: args.password,
|
|
56
|
+
ksJson: args.ksJson,
|
|
57
|
+
});
|
|
58
|
+
let parsed;
|
|
59
|
+
try {
|
|
60
|
+
parsed = JSON.parse(raw);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
throw new base.BaseError('unlockMasterKeystore: WASM returned non-JSON', { cause: err });
|
|
64
|
+
}
|
|
65
|
+
assertField(parsed, 'address', 'unlockMasterKeystore');
|
|
66
|
+
assertField(parsed, 'msecretKey', 'unlockMasterKeystore');
|
|
67
|
+
assertField(parsed, 'mpublicKey', 'unlockMasterKeystore');
|
|
68
|
+
return parsed;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* normal keystore JSON 을 password 로 복호화한다.
|
|
72
|
+
*
|
|
73
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `nkeyAlgorithm`,
|
|
74
|
+
* `nsecretKey`, `npublicKey`, `keyBind`) 를 그대로 반환한다.
|
|
75
|
+
*/
|
|
76
|
+
function unlockNormalKeystore(args) {
|
|
77
|
+
const raw = wasm.loadNormalKeystore({
|
|
78
|
+
passStr: args.password,
|
|
79
|
+
ksJson: args.ksJson,
|
|
80
|
+
});
|
|
81
|
+
let parsed;
|
|
82
|
+
try {
|
|
83
|
+
parsed = JSON.parse(raw);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
throw new base.BaseError('unlockNormalKeystore: WASM returned non-JSON', { cause: err });
|
|
87
|
+
}
|
|
88
|
+
assertField(parsed, 'address', 'unlockNormalKeystore');
|
|
89
|
+
assertField(parsed, 'nsecretKey', 'unlockNormalKeystore');
|
|
90
|
+
assertField(parsed, 'npublicKey', 'unlockNormalKeystore');
|
|
91
|
+
return parsed;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* one-shot 헬퍼: 전체 `[master, normal]` keystore JSON 과 두 password 를
|
|
95
|
+
* 받아 `keysToAccount` 가 소비하는 평탄한 (address, msk, mpk, nsk, npk)
|
|
96
|
+
* tuple 을 반환한다.
|
|
97
|
+
*/
|
|
98
|
+
function unlockKeystoreBundle(args) {
|
|
99
|
+
const halves = typeof args.ksJsonBundle === 'string'
|
|
100
|
+
? splitKeystoreBundle(args.ksJsonBundle)
|
|
101
|
+
: {
|
|
102
|
+
masterKsJson: args.ksJsonBundle.masterKsJson,
|
|
103
|
+
normalKsJson: args.ksJsonBundle.normalKsJson,
|
|
104
|
+
};
|
|
105
|
+
const master = unlockMasterKeystore({
|
|
106
|
+
ksJson: halves.masterKsJson,
|
|
107
|
+
password: args.passwordMaster,
|
|
108
|
+
});
|
|
109
|
+
const normal = unlockNormalKeystore({
|
|
110
|
+
ksJson: halves.normalKsJson,
|
|
111
|
+
password: args.passwordNormal,
|
|
112
|
+
});
|
|
113
|
+
if (master.address !== normal.address) {
|
|
114
|
+
throw new base.BaseError(`unlockKeystoreBundle: keystore address mismatch (master=${master.address} normal=${normal.address})`);
|
|
115
|
+
}
|
|
116
|
+
if (master.mpublicKey === normal.npublicKey) {
|
|
117
|
+
throw new account.DegenerateKeyError({
|
|
118
|
+
source: 'unlockKeystoreBundle',
|
|
119
|
+
algoMaster: master.mkeyAlgorithm,
|
|
120
|
+
algoNormal: normal.nkeyAlgorithm,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
address: master.address,
|
|
125
|
+
msk: master.msecretKey,
|
|
126
|
+
mpk: master.mpublicKey,
|
|
127
|
+
nsk: normal.nsecretKey,
|
|
128
|
+
npk: normal.npublicKey,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function assertField(obj, key, fn) {
|
|
132
|
+
if (!obj || typeof obj !== 'object') {
|
|
133
|
+
throw new base.BaseError(`${fn}: WASM result is not an object`);
|
|
134
|
+
}
|
|
135
|
+
const v = obj[key];
|
|
136
|
+
if (typeof v !== 'string' || v.length === 0) {
|
|
137
|
+
throw new base.BaseError(`${fn}: WASM result missing '${key}'`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
exports.createKeystoreBundle = createKeystoreBundle;
|
|
142
|
+
exports.splitKeystoreBundle = splitKeystoreBundle;
|
|
143
|
+
exports.unlockKeystoreBundle = unlockKeystoreBundle;
|
|
144
|
+
exports.unlockMasterKeystore = unlockMasterKeystore;
|
|
145
|
+
exports.unlockNormalKeystore = unlockNormalKeystore;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
define(['exports', './wasm-3Ghi_Hxd', './base-B_kRRfsf', './account-BSrvZ7S8'], (function (exports, wasm, base, account) { 'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 새 dual-key keystore 를 만들고 결과 JSON array 를 master / normal 두
|
|
5
|
+
* 반쪽으로 분리한다. 각 반쪽은 독립적으로 영속화한 뒤 unlockMasterKeystore
|
|
6
|
+
* / unlockNormalKeystore 로 다시 unlock 할 수 있다.
|
|
7
|
+
*
|
|
8
|
+
* WASM 의 `createAccountAndKeystore` 에 대한 얇은 래퍼다. `utils/index.mts`
|
|
9
|
+
* 가 raw WASM export 도 함께 re-export 하므로 충돌을 피하려고 이름을
|
|
10
|
+
* 새로 붙였다.
|
|
11
|
+
*/
|
|
12
|
+
function createKeystoreBundle(args) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const raw = wasm.createAccountAndKeystore({
|
|
15
|
+
passwordMaster: args.passwordMaster,
|
|
16
|
+
passwordNormal: args.passwordNormal,
|
|
17
|
+
algoMaster: (_a = args.algoMaster) !== null && _a !== void 0 ? _a : '',
|
|
18
|
+
algoNormal: (_b = args.algoNormal) !== null && _b !== void 0 ? _b : '',
|
|
19
|
+
});
|
|
20
|
+
const { masterKsJson, normalKsJson } = splitKeystoreBundle(raw);
|
|
21
|
+
return { raw, masterKsJson, normalKsJson };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* WASM `createAccountAndKeystore` 헬퍼가 반환한 `[master, normal]` keystore
|
|
25
|
+
* 배열을 두 JSON 문자열로 분리한다.
|
|
26
|
+
*/
|
|
27
|
+
function splitKeystoreBundle(bundleJson) {
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse(bundleJson);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
throw new base.BaseError('splitKeystoreBundle: bundle is not valid JSON', { cause: err });
|
|
34
|
+
}
|
|
35
|
+
if (!Array.isArray(parsed) || parsed.length !== 2) {
|
|
36
|
+
throw new base.BaseError(`splitKeystoreBundle: expected a JSON array of length 2, got length ${Array.isArray(parsed) ? parsed.length : 'n/a'}`);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
masterKsJson: JSON.stringify(parsed[0]),
|
|
40
|
+
normalKsJson: JSON.stringify(parsed[1]),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* master keystore JSON 을 password 로 복호화한다.
|
|
45
|
+
*
|
|
46
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `mkeyAlgorithm`,
|
|
47
|
+
* `msecretKey`, `mpublicKey`) 를 그대로 반환한다.
|
|
48
|
+
*/
|
|
49
|
+
function unlockMasterKeystore(args) {
|
|
50
|
+
const raw = wasm.loadMasterKeystore({
|
|
51
|
+
passStr: args.password,
|
|
52
|
+
ksJson: args.ksJson,
|
|
53
|
+
});
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = JSON.parse(raw);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
throw new base.BaseError('unlockMasterKeystore: WASM returned non-JSON', { cause: err });
|
|
60
|
+
}
|
|
61
|
+
assertField(parsed, 'address', 'unlockMasterKeystore');
|
|
62
|
+
assertField(parsed, 'msecretKey', 'unlockMasterKeystore');
|
|
63
|
+
assertField(parsed, 'mpublicKey', 'unlockMasterKeystore');
|
|
64
|
+
return parsed;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* normal keystore JSON 을 password 로 복호화한다.
|
|
68
|
+
*
|
|
69
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `nkeyAlgorithm`,
|
|
70
|
+
* `nsecretKey`, `npublicKey`, `keyBind`) 를 그대로 반환한다.
|
|
71
|
+
*/
|
|
72
|
+
function unlockNormalKeystore(args) {
|
|
73
|
+
const raw = wasm.loadNormalKeystore({
|
|
74
|
+
passStr: args.password,
|
|
75
|
+
ksJson: args.ksJson,
|
|
76
|
+
});
|
|
77
|
+
let parsed;
|
|
78
|
+
try {
|
|
79
|
+
parsed = JSON.parse(raw);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
throw new base.BaseError('unlockNormalKeystore: WASM returned non-JSON', { cause: err });
|
|
83
|
+
}
|
|
84
|
+
assertField(parsed, 'address', 'unlockNormalKeystore');
|
|
85
|
+
assertField(parsed, 'nsecretKey', 'unlockNormalKeystore');
|
|
86
|
+
assertField(parsed, 'npublicKey', 'unlockNormalKeystore');
|
|
87
|
+
return parsed;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* one-shot 헬퍼: 전체 `[master, normal]` keystore JSON 과 두 password 를
|
|
91
|
+
* 받아 `keysToAccount` 가 소비하는 평탄한 (address, msk, mpk, nsk, npk)
|
|
92
|
+
* tuple 을 반환한다.
|
|
93
|
+
*/
|
|
94
|
+
function unlockKeystoreBundle(args) {
|
|
95
|
+
const halves = typeof args.ksJsonBundle === 'string'
|
|
96
|
+
? splitKeystoreBundle(args.ksJsonBundle)
|
|
97
|
+
: {
|
|
98
|
+
masterKsJson: args.ksJsonBundle.masterKsJson,
|
|
99
|
+
normalKsJson: args.ksJsonBundle.normalKsJson,
|
|
100
|
+
};
|
|
101
|
+
const master = unlockMasterKeystore({
|
|
102
|
+
ksJson: halves.masterKsJson,
|
|
103
|
+
password: args.passwordMaster,
|
|
104
|
+
});
|
|
105
|
+
const normal = unlockNormalKeystore({
|
|
106
|
+
ksJson: halves.normalKsJson,
|
|
107
|
+
password: args.passwordNormal,
|
|
108
|
+
});
|
|
109
|
+
if (master.address !== normal.address) {
|
|
110
|
+
throw new base.BaseError(`unlockKeystoreBundle: keystore address mismatch (master=${master.address} normal=${normal.address})`);
|
|
111
|
+
}
|
|
112
|
+
if (master.mpublicKey === normal.npublicKey) {
|
|
113
|
+
throw new account.DegenerateKeyError({
|
|
114
|
+
source: 'unlockKeystoreBundle',
|
|
115
|
+
algoMaster: master.mkeyAlgorithm,
|
|
116
|
+
algoNormal: normal.nkeyAlgorithm,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
address: master.address,
|
|
121
|
+
msk: master.msecretKey,
|
|
122
|
+
mpk: master.mpublicKey,
|
|
123
|
+
nsk: normal.nsecretKey,
|
|
124
|
+
npk: normal.npublicKey,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function assertField(obj, key, fn) {
|
|
128
|
+
if (!obj || typeof obj !== 'object') {
|
|
129
|
+
throw new base.BaseError(`${fn}: WASM result is not an object`);
|
|
130
|
+
}
|
|
131
|
+
const v = obj[key];
|
|
132
|
+
if (typeof v !== 'string' || v.length === 0) {
|
|
133
|
+
throw new base.BaseError(`${fn}: WASM result missing '${key}'`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
exports.createKeystoreBundle = createKeystoreBundle;
|
|
138
|
+
exports.splitKeystoreBundle = splitKeystoreBundle;
|
|
139
|
+
exports.unlockKeystoreBundle = unlockKeystoreBundle;
|
|
140
|
+
exports.unlockMasterKeystore = unlockMasterKeystore;
|
|
141
|
+
exports.unlockNormalKeystore = unlockNormalKeystore;
|
|
142
|
+
|
|
143
|
+
}));
|