@locuschain/lib 0.2.1 → 0.2.3
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.cts +58 -0
- package/dist/accounts/index.d.cts +5 -5
- package/dist/accounts/keys/index.d.cts +2 -0
- package/dist/accounts/keys/localKeySource.d.cts +23 -0
- package/dist/accounts/keys/toKeySource.d.cts +14 -0
- package/dist/accounts/keysToAccount.d.cts +19 -0
- package/dist/accounts/mnemonicToAccount.d.cts +25 -0
- package/dist/accounts/signing/txKeyPolicy.d.cts +21 -0
- package/dist/accounts/types.d.cts +100 -0
- package/dist/actions/wallet/_deriveTxAdditions.d.cts +18 -0
- package/dist/actions/wallet/_prepareTransaction.d.cts +15 -0
- package/dist/actions/wallet/_sendPreparedTransaction.d.cts +9 -0
- package/dist/actions/wallet/_signLocusTransaction.d.cts +14 -0
- package/dist/actions/wallet/index.d.cts +5 -0
- package/dist/actions/wallet/types.d.cts +38 -0
- package/dist/autogen/actions/debug/index.d.cts +2 -0
- package/dist/autogen/actions/debug/public/allHeights.d.cts +3 -0
- package/dist/autogen/actions/debug/public/balanceGrantList.d.cts +2 -0
- package/dist/autogen/actions/debug/public/balanceList.d.cts +2 -0
- package/dist/autogen/actions/debug/public/createAccount.d.cts +3 -0
- package/dist/autogen/actions/debug/public/createNode.d.cts +4 -0
- package/dist/autogen/actions/debug/public/dumpAllAccounts.d.cts +3 -0
- package/dist/autogen/actions/debug/public/echo.d.cts +2 -0
- package/dist/autogen/actions/debug/public/gameChainCmd.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getAccountsBalances.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getAccountsHeights.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getContractLog.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getGuestsInfo.d.cts +3 -0
- package/dist/autogen/actions/debug/public/getHomeShard.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getImportAccount.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getImportAccountLog.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getKeys.d.cts +4 -0
- package/dist/autogen/actions/debug/public/getNodeBlocks.d.cts +3 -0
- package/dist/autogen/actions/debug/public/getPeerPool.d.cts +2 -0
- package/dist/autogen/actions/debug/public/getPeersInfo.d.cts +3 -0
- package/dist/autogen/actions/debug/public/importAccount.d.cts +4 -0
- package/dist/autogen/actions/debug/public/index.d.cts +29 -0
- package/dist/autogen/actions/debug/public/initReliableNodes.d.cts +4 -0
- package/dist/autogen/actions/debug/public/noArgsRets.d.cts +2 -0
- package/dist/autogen/actions/debug/public/nodeCmd.d.cts +3 -0
- package/dist/autogen/actions/debug/public/removeHoldTxs.d.cts +4 -0
- package/dist/autogen/actions/debug/public/requestVme.d.cts +4 -0
- package/dist/autogen/actions/debug/public/sendRawTransaction.d.cts +4 -0
- package/dist/autogen/actions/debug/public/setImportAccountTx.d.cts +4 -0
- package/dist/autogen/actions/debug/public/setReliableNode.d.cts +4 -0
- package/dist/autogen/actions/debug/public/viewContract.d.cts +4 -0
- package/dist/autogen/actions/debug/wallet/callContract.d.cts +4 -0
- package/dist/autogen/actions/debug/wallet/createContract.d.cts +4 -0
- package/dist/autogen/actions/debug/wallet/createSynthAccount.d.cts +4 -0
- package/dist/autogen/actions/debug/wallet/index.d.cts +4 -0
- package/dist/autogen/actions/debug/wallet/postDataToSynthAccount.d.cts +4 -0
- package/dist/autogen/actions/index.d.cts +3 -0
- package/dist/autogen/actions/public/accountHeightsToDownload.d.cts +4 -0
- package/dist/autogen/actions/public/accountHeightsToUpload.d.cts +4 -0
- package/dist/autogen/actions/public/calculateSpentByExpress.d.cts +4 -0
- package/dist/autogen/actions/public/clientMessage.d.cts +3 -0
- package/dist/autogen/actions/public/downloadAccountTxs.d.cts +4 -0
- package/dist/autogen/actions/public/echo.d.cts +2 -0
- package/dist/autogen/actions/public/findDuplicateSubscriber.d.cts +4 -0
- package/dist/autogen/actions/public/generateLatestStoredDataProof.d.cts +4 -0
- package/dist/autogen/actions/public/getAccountAssetList.d.cts +4 -0
- package/dist/autogen/actions/public/getAccountAssetObject.d.cts +4 -0
- package/dist/autogen/actions/public/getAccountDetail.d.cts +4 -0
- package/dist/autogen/actions/public/getAccountHistory.d.cts +4 -0
- package/dist/autogen/actions/public/getAccountTokenList.d.cts +4 -0
- package/dist/autogen/actions/public/getConciseNodeStatus.d.cts +3 -0
- package/dist/autogen/actions/public/getGenesisAccount.d.cts +3 -0
- package/dist/autogen/actions/public/getIdentityProof.d.cts +4 -0
- package/dist/autogen/actions/public/getInactiveTxList.d.cts +4 -0
- package/dist/autogen/actions/public/getMontInfoList.d.cts +4 -0
- package/dist/autogen/actions/public/getNodeStatus.d.cts +3 -0
- package/dist/autogen/actions/public/getOwnerBalance.d.cts +3 -0
- package/dist/autogen/actions/public/getRoundState.d.cts +4 -0
- package/dist/autogen/actions/public/getRoundStatesList.d.cts +4 -0
- package/dist/autogen/actions/public/getShardOfAccount.d.cts +4 -0
- package/dist/autogen/actions/public/getSyncState.d.cts +3 -0
- package/dist/autogen/actions/public/getTx.d.cts +4 -0
- package/dist/autogen/actions/public/getWorldRoundState.d.cts +4 -0
- package/dist/autogen/actions/public/getWorldRoundStatesList.d.cts +4 -0
- package/dist/autogen/actions/public/hasSystemToken.d.cts +4 -0
- package/dist/autogen/actions/public/index.d.cts +38 -0
- package/dist/autogen/actions/public/makeTxProof.d.cts +4 -0
- package/dist/autogen/actions/public/queryAddress.d.cts +4 -0
- package/dist/autogen/actions/public/readTxListWitness.d.cts +4 -0
- package/dist/autogen/actions/public/setHost.d.cts +3 -0
- package/dist/autogen/actions/public/subscribeAddress.d.cts +4 -0
- package/dist/autogen/actions/public/uploadAccountTxs.d.cts +3 -0
- package/dist/autogen/actions/public/verifyAndSignChallenge.d.cts +4 -0
- package/dist/autogen/actions/public/verifyIdentityProof.d.cts +4 -0
- package/dist/autogen/actions/public/verifyLatestStoredDataProof.d.cts +3 -0
- package/dist/autogen/actions/public/verifyTxListWitness.d.cts +3 -0
- package/dist/autogen/actions/wallet/acceptScript.d.cts +4 -0
- package/dist/autogen/actions/wallet/becomeGuest.d.cts +4 -0
- package/dist/autogen/actions/wallet/becomeHost.d.cts +4 -0
- package/dist/autogen/actions/wallet/changeKey.d.cts +4 -0
- package/dist/autogen/actions/wallet/changeVkey.d.cts +4 -0
- package/dist/autogen/actions/wallet/closeAccount.d.cts +4 -0
- package/dist/autogen/actions/wallet/createAssetObject.d.cts +4 -0
- package/dist/autogen/actions/wallet/createToken.d.cts +4 -0
- package/dist/autogen/actions/wallet/createVme.d.cts +4 -0
- package/dist/autogen/actions/wallet/freezeAccount.d.cts +4 -0
- package/dist/autogen/actions/wallet/freezeAccount.d.mts +4 -0
- package/dist/autogen/actions/wallet/index.d.cts +20 -0
- package/dist/autogen/actions/wallet/index.d.mts +1 -0
- package/dist/autogen/actions/wallet/lockStake.d.cts +4 -0
- package/dist/autogen/actions/wallet/openAccount.d.cts +4 -0
- package/dist/autogen/actions/wallet/postData.d.cts +4 -0
- package/dist/autogen/actions/wallet/provideScript.d.cts +4 -0
- package/dist/autogen/actions/wallet/requestDataTrade.d.cts +4 -0
- package/dist/autogen/actions/wallet/transferAssetObject.d.cts +4 -0
- package/dist/autogen/actions/wallet/transferCoin.d.cts +4 -0
- package/dist/autogen/actions/wallet/transferCoinExpress.d.cts +4 -0
- package/dist/autogen/actions/wallet/transferToken.d.cts +4 -0
- package/dist/autogen/actions/wallet/unlockStake.d.cts +4 -0
- package/dist/autogen/debugPublicActions.d.cts +47 -0
- package/dist/autogen/debugWalletActions.d.cts +11 -0
- package/dist/autogen/index.amd.js +2 -1
- package/dist/autogen/index.cjs.cjs +2 -1
- package/dist/autogen/index.d.cts +8 -8
- package/dist/autogen/index.esm.js +2 -2
- package/dist/autogen/locus-tx.d.cts +5 -0
- package/dist/autogen/publicActions.d.cts +66 -0
- package/dist/autogen/rpc-api-spec.d.cts +210 -0
- package/dist/autogen/rpc-api-spec.d.mts +2 -0
- package/dist/autogen/types/common/addr-tx-proof.d.cts +5 -0
- package/dist/autogen/types/common/asset-object-transfer.d.cts +8 -0
- package/dist/autogen/types/common/asset-object.d.cts +10 -0
- package/dist/autogen/types/common/asset-proof-objects.d.cts +5 -0
- package/dist/autogen/types/common/asset-transfer-info.d.cts +9 -0
- package/dist/autogen/types/common/base-meta.d.cts +1 -0
- package/dist/autogen/types/common/contract-exec-status.d.cts +16 -0
- package/dist/autogen/types/common/contract-transfer-info.d.cts +7 -0
- package/dist/autogen/types/common/get-peers-info.d.cts +9 -0
- package/dist/autogen/types/common/index-value-pair.d.cts +4 -0
- package/dist/autogen/types/common/index.d.cts +54 -0
- package/dist/autogen/types/common/input-params-data-transfer.d.cts +8 -0
- package/dist/autogen/types/common/key-bind-info.d.cts +4 -0
- package/dist/autogen/types/common/mont-info.d.cts +4 -0
- package/dist/autogen/types/common/object-amount-transfer.d.cts +5 -0
- package/dist/autogen/types/common/object-amount.d.cts +4 -0
- package/dist/autogen/types/common/output-download-account-txs.d.cts +4 -0
- package/dist/autogen/types/common/param-str.d.cts +3 -0
- package/dist/autogen/types/common/param-tx-data.d.cts +5 -0
- package/dist/autogen/types/common/params-token-value-pair.d.cts +4 -0
- package/dist/autogen/types/common/public-height-chunk.d.cts +4 -0
- package/dist/autogen/types/common/ref-tx-info.d.cts +5 -0
- package/dist/autogen/types/common/ref-vtx.d.cts +6 -0
- package/dist/autogen/types/common/ret-type-base.d.cts +1 -0
- package/dist/autogen/types/common/round-state-abstract.d.cts +11 -0
- package/dist/autogen/types/common/round-state-detail.d.cts +16 -0
- package/dist/autogen/types/common/rpc-account-height.d.cts +5 -0
- package/dist/autogen/types/common/rpc-accounts-balances-result.d.cts +4 -0
- package/dist/autogen/types/common/rpc-asset-list-values.d.cts +7 -0
- package/dist/autogen/types/common/rpc-data-trade-result.d.cts +5 -0
- package/dist/autogen/types/common/rpc-token-balance-pair.d.cts +4 -0
- package/dist/autogen/types/common/token-value-ab.d.cts +5 -0
- package/dist/autogen/types/common/token-value-pair.d.cts +4 -0
- package/dist/autogen/types/common/transaction-sender-index.d.cts +7 -0
- package/dist/autogen/types/common/transfer-info.d.cts +7 -0
- package/dist/autogen/types/common/tx-base.d.cts +13 -0
- package/dist/autogen/types/common/tx-hash-elements.d.cts +6 -0
- package/dist/autogen/types/common/tx-key-height-hash.d.cts +4 -0
- package/dist/autogen/types/common/tx-key-nround.d.cts +5 -0
- package/dist/autogen/types/common/tx-key.d.cts +4 -0
- package/dist/autogen/types/common/tx-meta.d.cts +2 -0
- package/dist/autogen/types/common/tx-no-signature.d.cts +1 -0
- package/dist/autogen/types/common/tx-recv-set-meta.d.cts +2 -0
- package/dist/autogen/types/common/tx-sign-key.d.cts +1 -0
- package/dist/autogen/types/common/tx-signature.d.cts +3 -0
- package/dist/autogen/types/common/tx-vsignature.d.cts +3 -0
- package/dist/autogen/types/common/vm-engine-block.d.cts +11 -0
- package/dist/autogen/types/common/vm-reward.d.cts +4 -0
- package/dist/autogen/types/common/vm-tx-state.d.cts +27 -0
- package/dist/autogen/types/common/vme-block-meta.d.cts +2 -0
- package/dist/autogen/types/common/vme-info.d.cts +3 -0
- package/dist/autogen/types/common/vme-lock-stake.d.cts +4 -0
- package/dist/autogen/types/common/vote-info-rpc.d.cts +5 -0
- package/dist/autogen/types/common/vtx-meta.d.cts +2 -0
- package/dist/autogen/types/common/wrs-validators-info.d.cts +5 -0
- package/dist/autogen/types/consts/address-class.d.cts +11 -0
- package/dist/autogen/types/consts/consts.d.cts +2 -0
- package/dist/autogen/types/consts/currency-unit.d.cts +15 -0
- package/dist/autogen/types/consts/index.d.cts +3 -0
- package/dist/autogen/types/consts/tx-type.d.cts +61 -0
- package/dist/autogen/types/consts/tx-types.d.cts +415 -0
- package/dist/autogen/types/rpc/heights-result.d.cts +4 -0
- package/dist/autogen/types/rpc/index.d.cts +107 -0
- package/dist/autogen/types/rpc/index.d.mts +1 -0
- package/dist/autogen/types/rpc/params-accept-script.d.cts +8 -0
- package/dist/autogen/types/rpc/params-account-and-index.d.cts +4 -0
- package/dist/autogen/types/rpc/params-account-heights.d.cts +5 -0
- package/dist/autogen/types/rpc/params-account-history.d.cts +5 -0
- package/dist/autogen/types/rpc/params-account.d.cts +3 -0
- package/dist/autogen/types/rpc/params-accounts.d.cts +3 -0
- package/dist/autogen/types/rpc/params-become-guest.d.cts +5 -0
- package/dist/autogen/types/rpc/params-become-host.d.cts +5 -0
- package/dist/autogen/types/rpc/params-calculate-spent-by-express.d.cts +5 -0
- package/dist/autogen/types/rpc/params-call-contract.d.cts +13 -0
- package/dist/autogen/types/rpc/params-change-key.d.cts +8 -0
- package/dist/autogen/types/rpc/params-change-vkey.d.cts +5 -0
- package/dist/autogen/types/rpc/params-close-account.d.cts +7 -0
- package/dist/autogen/types/rpc/params-contract-log.d.cts +6 -0
- package/dist/autogen/types/rpc/params-create-asset-object.d.cts +10 -0
- package/dist/autogen/types/rpc/params-create-contract.d.cts +14 -0
- package/dist/autogen/types/rpc/params-create-node.d.cts +4 -0
- package/dist/autogen/types/rpc/params-create-synth-account.d.cts +8 -0
- package/dist/autogen/types/rpc/params-create-token.d.cts +7 -0
- package/dist/autogen/types/rpc/params-create-vme.d.cts +8 -0
- package/dist/autogen/types/rpc/params-download-account-txs.d.cts +6 -0
- package/dist/autogen/types/rpc/params-find-duplicate-subscriber.d.cts +3 -0
- package/dist/autogen/types/rpc/params-freeze-account.d.cts +5 -0
- package/dist/autogen/types/rpc/params-freeze-account.d.mts +5 -0
- package/dist/autogen/types/rpc/params-game-chain-cmd.d.cts +5 -0
- package/dist/autogen/types/rpc/params-generate-latest-stored-data-proof.d.cts +4 -0
- package/dist/autogen/types/rpc/params-get-asset-list.d.cts +4 -0
- package/dist/autogen/types/rpc/params-get-asset-objects.d.cts +4 -0
- package/dist/autogen/types/rpc/params-get-home-shard.d.cts +3 -0
- package/dist/autogen/types/rpc/params-get-identity-proof.d.cts +4 -0
- package/dist/autogen/types/rpc/params-get-import-account.d.cts +3 -0
- package/dist/autogen/types/rpc/params-import-account.d.cts +7 -0
- package/dist/autogen/types/rpc/params-init-reliable-nodes.d.cts +5 -0
- package/dist/autogen/types/rpc/params-latest-stored-data-proof.d.cts +4 -0
- package/dist/autogen/types/rpc/params-lock-stake.d.cts +7 -0
- package/dist/autogen/types/rpc/params-open-account.d.cts +11 -0
- package/dist/autogen/types/rpc/params-post-data-to-synth-account.d.cts +11 -0
- package/dist/autogen/types/rpc/params-provide-script.d.cts +14 -0
- package/dist/autogen/types/rpc/params-query-address.d.cts +3 -0
- package/dist/autogen/types/rpc/params-read-tx-list.d.cts +5 -0
- package/dist/autogen/types/rpc/params-remove-hold-txs.d.cts +5 -0
- package/dist/autogen/types/rpc/params-request-data-trade.d.cts +10 -0
- package/dist/autogen/types/rpc/params-request-vme.d.cts +4 -0
- package/dist/autogen/types/rpc/params-round-list.d.cts +4 -0
- package/dist/autogen/types/rpc/params-round.d.cts +3 -0
- package/dist/autogen/types/rpc/params-rs.d.cts +4 -0
- package/dist/autogen/types/rpc/params-send-raw-transaction.d.cts +4 -0
- package/dist/autogen/types/rpc/params-set-host.d.cts +4 -0
- package/dist/autogen/types/rpc/params-set-import-account-tx.d.cts +5 -0
- package/dist/autogen/types/rpc/params-set-reliable-node.d.cts +4 -0
- package/dist/autogen/types/rpc/params-subscribe-address.d.cts +4 -0
- package/dist/autogen/types/rpc/params-transfer-asset-object.d.cts +9 -0
- package/dist/autogen/types/rpc/params-transfer-coin-express.d.cts +7 -0
- package/dist/autogen/types/rpc/params-transfer-coin.d.cts +8 -0
- package/dist/autogen/types/rpc/params-transfer-tokens.d.cts +14 -0
- package/dist/autogen/types/rpc/params-tx-list-witness.d.cts +6 -0
- package/dist/autogen/types/rpc/params-tx-list.d.cts +5 -0
- package/dist/autogen/types/rpc/params-unlock-stake.d.cts +7 -0
- package/dist/autogen/types/rpc/params-upload-account-txs.d.cts +5 -0
- package/dist/autogen/types/rpc/params-verify-and-sign-challenge.d.cts +8 -0
- package/dist/autogen/types/rpc/params-verify-identity-proof.d.cts +6 -0
- package/dist/autogen/types/rpc/result-dump-accounts.d.cts +4 -0
- package/dist/autogen/types/rpc/rpc-bool-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-calculate-spent-by-express-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-create-account-result.d.cts +7 -0
- package/dist/autogen/types/rpc/rpc-create-node-result.d.cts +5 -0
- package/dist/autogen/types/rpc/rpc-create-tx-result.d.cts +7 -0
- package/dist/autogen/types/rpc/rpc-find-duplicate-subscriber-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-game-chain-cmd-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-generate-latest-stored-data-proof-result.d.cts +4 -0
- package/dist/autogen/types/rpc/rpc-get-account-asset-list-result.d.cts +4 -0
- package/dist/autogen/types/rpc/rpc-get-account-asset-object-result.d.cts +5 -0
- package/dist/autogen/types/rpc/rpc-get-account-detail-result.d.cts +11 -0
- package/dist/autogen/types/rpc/rpc-get-account-detail-result.d.mts +1 -0
- package/dist/autogen/types/rpc/rpc-get-account-history-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-account-token-list-result.d.cts +6 -0
- package/dist/autogen/types/rpc/rpc-get-accounts-balances-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-accounts-heights-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-concise-node-status-result.d.cts +18 -0
- package/dist/autogen/types/rpc/rpc-get-contract-log-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-genesis-account-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-guests-info-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-home-shard-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-identity-proof-result.d.cts +6 -0
- package/dist/autogen/types/rpc/rpc-get-import-account-result.d.cts +10 -0
- package/dist/autogen/types/rpc/rpc-get-inactive-tx-list-result.d.cts +14 -0
- package/dist/autogen/types/rpc/rpc-get-keys-result.d.cts +7 -0
- package/dist/autogen/types/rpc/rpc-get-mont-info-list-result.d.cts +5 -0
- package/dist/autogen/types/rpc/rpc-get-node-blocks-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-node-status-result.d.cts +28 -0
- package/dist/autogen/types/rpc/rpc-get-shard-of-account-result.d.cts +4 -0
- package/dist/autogen/types/rpc/rpc-get-sync-state-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-tx-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-get-world-round-state-result.d.cts +13 -0
- package/dist/autogen/types/rpc/rpc-get-world-round-states-list-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-has-system-token-result.d.cts +4 -0
- package/dist/autogen/types/rpc/rpc-import-account-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-node-cmd-result.d.cts +5 -0
- package/dist/autogen/types/rpc/rpc-query-address-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-read-tx-list-witness-result.d.cts +6 -0
- package/dist/autogen/types/rpc/rpc-request-vme-result.d.cts +3 -0
- package/dist/autogen/types/rpc/rpc-send-raw-transaction-result.d.cts +1 -0
- package/dist/autogen/types/rpc/rpc-set-import-account-tx-result.d.cts +5 -0
- package/dist/autogen/types/rpc/rpc-subscribe-address-result.d.cts +1 -0
- package/dist/autogen/types/rpc/rpc-verify-and-sign-challenge-result.d.cts +8 -0
- package/dist/autogen/types/rpc/rpc-verify-identity-proof-result.d.cts +4 -0
- package/dist/autogen/types/rpc/rpc-view-contract-result.d.cts +3 -0
- package/dist/autogen/types/rpc/upload-heights-result.d.cts +6 -0
- package/dist/autogen/types/tx/index.d.cts +50 -0
- package/dist/autogen/types/tx/tx-accept-script-after-time-lock.d.cts +12 -0
- package/dist/autogen/types/tx/tx-accept-script.d.cts +15 -0
- package/dist/autogen/types/tx/tx-activate-all-assets.d.cts +15 -0
- package/dist/autogen/types/tx/tx-activate-asset-object.d.cts +9 -0
- package/dist/autogen/types/tx/tx-activate-call-contract.d.cts +15 -0
- package/dist/autogen/types/tx/tx-activate-coin.d.cts +9 -0
- package/dist/autogen/types/tx/tx-activate-contract-result.d.cts +18 -0
- package/dist/autogen/types/tx/tx-activate-contract-reward.d.cts +8 -0
- package/dist/autogen/types/tx/tx-activate-contract-transfer.d.cts +15 -0
- package/dist/autogen/types/tx/tx-activate-data-synth-account.d.cts +12 -0
- package/dist/autogen/types/tx/tx-activate-foundation-reserve.d.cts +7 -0
- package/dist/autogen/types/tx/tx-activate-incentive.d.cts +11 -0
- package/dist/autogen/types/tx/tx-activate-lock-stake-for-vme.d.cts +9 -0
- package/dist/autogen/types/tx/tx-activate-open-contract.d.cts +15 -0
- package/dist/autogen/types/tx/tx-activate-open-synth-account.d.cts +9 -0
- package/dist/autogen/types/tx/tx-activate-open-vm-engine.d.cts +11 -0
- package/dist/autogen/types/tx/tx-activate-token.d.cts +12 -0
- package/dist/autogen/types/tx/tx-become-guest.d.cts +10 -0
- package/dist/autogen/types/tx/tx-become-host.d.cts +7 -0
- package/dist/autogen/types/tx/tx-burn-asset-object.d.cts +8 -0
- package/dist/autogen/types/tx/tx-burn-token.d.cts +10 -0
- package/dist/autogen/types/tx/tx-call-contract.d.cts +16 -0
- package/dist/autogen/types/tx/tx-change-foundation-account.d.cts +6 -0
- package/dist/autogen/types/tx/tx-change-keypair.d.cts +10 -0
- package/dist/autogen/types/tx/tx-change-vkey.d.cts +6 -0
- package/dist/autogen/types/tx/tx-close-account.d.cts +12 -0
- package/dist/autogen/types/tx/tx-contract-blank-reward.d.cts +5 -0
- package/dist/autogen/types/tx/tx-contract-transfer-reward.d.cts +8 -0
- package/dist/autogen/types/tx/tx-create-asset-object.d.cts +10 -0
- package/dist/autogen/types/tx/tx-create-contract.d.cts +17 -0
- package/dist/autogen/types/tx/tx-create-synth-account.d.cts +7 -0
- package/dist/autogen/types/tx/tx-create-token.d.cts +10 -0
- package/dist/autogen/types/tx/tx-create-vm-engine.d.cts +8 -0
- package/dist/autogen/types/tx/tx-dummy.d.cts +3 -0
- package/dist/autogen/types/tx/tx-finalize.d.cts +6 -0
- package/dist/autogen/types/tx/tx-freeze-account.d.cts +5 -0
- package/dist/autogen/types/tx/tx-genesis-account.d.cts +11 -0
- package/dist/autogen/types/tx/tx-lead-vtx.d.cts +9 -0
- package/dist/autogen/types/tx/tx-lock-stake-for-vme.d.cts +7 -0
- package/dist/autogen/types/tx/tx-open-account.d.cts +18 -0
- package/dist/autogen/types/tx/tx-post-data-synth-account.d.cts +9 -0
- package/dist/autogen/types/tx/tx-post-data.d.cts +11 -0
- package/dist/autogen/types/tx/tx-provide-script.d.cts +16 -0
- package/dist/autogen/types/tx/tx-revoke.d.cts +16 -0
- package/dist/autogen/types/tx/tx-transfer-asset-object.d.cts +8 -0
- package/dist/autogen/types/tx/tx-transfer-coin-express.d.cts +8 -0
- package/dist/autogen/types/tx/tx-transfer-coin.d.cts +7 -0
- package/dist/autogen/types/tx/tx-transfer-token.d.cts +11 -0
- package/dist/autogen/types/tx/tx-unlock-stake.d.cts +7 -0
- package/dist/autogen/types/tx/tx-vm-engine-block.d.cts +6 -0
- package/dist/autogen/types/wasm/grant-consume-result.d.cts +4 -0
- package/dist/autogen/types/wasm/index.d.cts +26 -0
- package/dist/autogen/types/wasm/library-versions.d.cts +6 -0
- package/dist/autogen/types/wasm/param-calculate-tx-link-hash.d.cts +3 -0
- package/dist/autogen/types/wasm/param-code-core-script.d.cts +3 -0
- package/dist/autogen/types/wasm/param-convert-currency.d.cts +5 -0
- package/dist/autogen/types/wasm/param-create-account-and-keystore.d.cts +6 -0
- package/dist/autogen/types/wasm/param-create-master-keystore.d.cts +6 -0
- package/dist/autogen/types/wasm/param-create-normal-key.d.cts +4 -0
- package/dist/autogen/types/wasm/param-create-normal-keystore.d.cts +8 -0
- package/dist/autogen/types/wasm/param-derive-keys-from-mnemonic-and-path.d.cts +4 -0
- package/dist/autogen/types/wasm/param-derive-keys-from-mnemonic.d.cts +6 -0
- package/dist/autogen/types/wasm/param-encode-tx-currency.d.cts +3 -0
- package/dist/autogen/types/wasm/param-encode-tx-number.d.cts +4 -0
- package/dist/autogen/types/wasm/param-generate-mnemonic-by-seed.d.cts +3 -0
- package/dist/autogen/types/wasm/param-generate-mnemonic.d.cts +3 -0
- package/dist/autogen/types/wasm/param-get-home-shard.d.cts +4 -0
- package/dist/autogen/types/wasm/param-hash.d.cts +4 -0
- package/dist/autogen/types/wasm/param-load-keystore.d.cts +4 -0
- package/dist/autogen/types/wasm/param-make-currency.d.cts +4 -0
- package/dist/autogen/types/wasm/param-sign-by-master-key.d.cts +4 -0
- package/dist/autogen/types/wasm/param-sign-key-bind.d.cts +5 -0
- package/dist/autogen/types/wasm/param-sign.d.cts +4 -0
- package/dist/autogen/types/wasm/param-test-core-script.d.cts +7 -0
- package/dist/autogen/types/wasm/param-txs.d.cts +3 -0
- package/dist/autogen/types/wasm/param-verify-merkle-proof.d.cts +5 -0
- package/dist/autogen/types/wasm/param-verify.d.cts +5 -0
- package/dist/autogen/walletActions.d.cts +43 -0
- package/dist/autogen/walletActions.d.mts +2 -0
- package/dist/autogen/wasm/crypto_aimer.d.cts +2 -0
- package/dist/autogen/wasm/crypto_haetae.d.cts +2 -0
- package/dist/autogen/wasm/crypto_smaugt.d.cts +2 -0
- package/dist/autogen/wasm/lclib.wasm +0 -0
- package/dist/autogen/wasm.d.cts +72 -0
- package/dist/chunks/{debugWalletActions-D5-Ds7Hl.js → debugWalletActions-B96f4kZc.js} +11 -1
- package/dist/chunks/{debugWalletActions-BDz-h2tl.js → debugWalletActions-BfX1doiz.js} +11 -0
- package/dist/chunks/{debugWalletActions-6qjkZVq9.cjs → debugWalletActions-iCZ1H6xc.cjs} +11 -0
- package/dist/chunks/ethers.esm.min-BBQs5Urm.cjs +10217 -0
- package/dist/chunks/ethers.esm.min-CiOJmj8w.js +10215 -0
- package/dist/chunks/ethers.esm.min-wXex1HuX.js +10217 -0
- package/dist/clients/createClient.d.cts +8 -0
- package/dist/clients/createLocusPublicClient.d.cts +100 -0
- package/dist/clients/createLocusWalletClient.d.cts +57 -0
- package/dist/clients/createLocusWalletClient.d.mts +1 -0
- package/dist/clients/createPublicClient.d.cts +6 -0
- package/dist/clients/createWalletClient.d.cts +8 -0
- package/dist/clients/index.amd.js +1 -1
- package/dist/clients/index.cjs.cjs +1 -1
- package/dist/clients/index.d.cts +6 -6
- package/dist/clients/index.esm.js +1 -1
- package/dist/clients/types.d.cts +21 -0
- package/dist/clients/types.d.mts +2 -0
- package/dist/constant/index.d.cts +2 -2
- package/dist/contracts/abis/erc20.d.cts +174 -0
- package/dist/contracts/abis/index.d.cts +1 -0
- package/dist/contracts/getContract.d.cts +33 -0
- package/dist/contracts/index.amd.js +2 -10214
- package/dist/contracts/index.cjs.cjs +2 -10213
- package/dist/contracts/index.d.cts +2 -2
- package/dist/contracts/index.esm.js +1 -10212
- package/dist/errors/account.d.cts +45 -0
- package/dist/errors/base.d.cts +13 -0
- package/dist/errors/index.d.cts +4 -4
- package/dist/errors/rpc.d.cts +21 -0
- package/dist/errors/transport.d.cts +21 -0
- package/dist/index.amd.js +1 -1
- package/dist/index.cjs.cjs +2 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.esm.js +2 -1
- package/dist/transports/http.d.cts +9 -0
- package/dist/transports/index.d.cts +2 -2
- package/dist/transports/types.d.cts +38 -0
- package/dist/transports/types.d.mts +2 -0
- package/dist/types/index.d.cts +5 -5
- package/dist/types/primitives.d.cts +5 -0
- package/dist/utils/abi.d.cts +88 -0
- package/dist/utils/abi.d.mts +88 -0
- package/dist/utils/index.amd.js +146 -1
- package/dist/utils/index.cjs.cjs +146 -0
- package/dist/utils/index.d.cts +5 -4
- package/dist/utils/index.d.mts +1 -0
- package/dist/utils/index.esm.js +140 -3
- package/dist/utils/keystore.d.cts +87 -0
- package/dist/utils/lclib.d.cts +2 -0
- package/dist/utils/locus-wasm-bridge.d.cts +1 -0
- package/dist/utils/tx-validator.d.cts +28 -0
- package/dist/utils/types.d.cts +15 -0
- package/dist/utils/wasm-fetch.d.cts +6 -0
- package/package.json +2 -2
package/dist/utils/index.cjs.cjs
CHANGED
|
@@ -3,11 +3,148 @@
|
|
|
3
3
|
var addressClass = require('../chunks/address-class-Cjy48Uqk.cjs');
|
|
4
4
|
var wasm = require('../chunks/wasm-BYOKRR31.cjs');
|
|
5
5
|
var keystore = require('../chunks/keystore-BUskzeOs.cjs');
|
|
6
|
+
var ethers_esm_min = require('../chunks/ethers.esm.min-BBQs5Urm.cjs');
|
|
6
7
|
var lclib = require('../chunks/lclib-rGyKpClJ.cjs');
|
|
7
8
|
require('../chunks/base-Cy5SSYLF.cjs');
|
|
8
9
|
require('../chunks/account-BAsiKnSL.cjs');
|
|
9
10
|
require('../chunks/tslib.es6-Cfi3-HmA.cjs');
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* ABI 코덱 + vendored ethers v5 namespace re-export.
|
|
14
|
+
*
|
|
15
|
+
* `support/erc20-helper/abi.mts` 가 lib 0.2.0 의 viem-style 리팩토링 때 사라졌으나,
|
|
16
|
+
* locus-wallet-extension / locuschain-explorer-suite 가 동일 API 셰입에 의존하고
|
|
17
|
+
* 있어 같은 셰입을 lib 안에 다시 둔다 (양쪽 사이트의 자체 locus-ethers.ts 중복
|
|
18
|
+
* 해소가 목적).
|
|
19
|
+
*
|
|
20
|
+
* 이 모듈은 vendored ethers v5 (`libs/ethers.js-5.5.4-20bytes-addr/ethers.esm.min.js`)
|
|
21
|
+
* 만 사용. `getContract.mts` 와 동일한 import 경로 — 외부 사용자는 자체 `ethers`
|
|
22
|
+
* 패키지를 dep 으로 가질 필요 없다.
|
|
23
|
+
*
|
|
24
|
+
* 주소 길이는 20바이트(이더리움 표준). ABI 32바이트 슬롯의 마지막 40 hex 만 사용.
|
|
25
|
+
*/
|
|
26
|
+
// @ts-ignore — vendored JS, no .d.ts. tsconfig.json 에서 src/libs 가 exclude 되어
|
|
27
|
+
// allowJs 가 적용되지 않는다. 외부 노출 namespace 이므로 `any` 로 받아 사용.
|
|
28
|
+
/**
|
|
29
|
+
* vendored ethers v5 namespace. 호출자가 `LocusEthers.BigNumber`, `LocusEthers.utils.id`
|
|
30
|
+
* 등 namespace 함수를 자유롭게 쓸 수 있게 re-export. `import { ethers } from 'ethers'`
|
|
31
|
+
* 를 외부 dep 으로 따로 갖지 않아도 lib 한 곳에서 가져갈 수 있다.
|
|
32
|
+
*
|
|
33
|
+
* vendored ethers 는 .d.ts 가 없어 type 위치 (`let x: LocusEthers.BigNumber`) 에
|
|
34
|
+
* 쓰이려면 namespace declaration 이 필요하다. declaration merging 으로 같은 이름의
|
|
35
|
+
* value (vendored ethers runtime) 와 namespace (type alias) 를 함께 export.
|
|
36
|
+
*/
|
|
37
|
+
const LocusEthers = ethers_esm_min.ethers;
|
|
38
|
+
const removeHexPrefix = (s) => {
|
|
39
|
+
if (!s)
|
|
40
|
+
return s;
|
|
41
|
+
return s.toLowerCase().startsWith('0x') ? s.substring(2) : s;
|
|
42
|
+
};
|
|
43
|
+
const convertJsonToFuncString = (item) => {
|
|
44
|
+
const inputString = item.inputs.map(x => `${x.type}`).join(',');
|
|
45
|
+
return item.name ? `${item.name}(${inputString})` : `constructor(${inputString})`;
|
|
46
|
+
};
|
|
47
|
+
/** ABI 배열에서 이름으로 function 항목 찾기. 못 찾으면 undefined. */
|
|
48
|
+
const findAbiFunction = (abi, name) => {
|
|
49
|
+
return abi.find(item => item.type === 'function' && item.name === name);
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 함수 selector. '0x' prefix 포함 10자 (4-byte hex + '0x').
|
|
53
|
+
* ethers v5 `Interface.getSighash(name)` 의 직접 동등.
|
|
54
|
+
*/
|
|
55
|
+
const getFuncSelector = (abiItem) => {
|
|
56
|
+
try {
|
|
57
|
+
const iface = new ethers_esm_min.ethers.utils.Interface([abiItem]);
|
|
58
|
+
return iface.getSighash(abiItem.name);
|
|
59
|
+
}
|
|
60
|
+
catch (_a) {
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Locus chain `func` 필드용 base64-encoded data.
|
|
66
|
+
* selector(0x 제외) + 선택적 args hex(0x 제외) 를 이어 붙여 `convertHexToData`.
|
|
67
|
+
*/
|
|
68
|
+
const getFunc = (abiItem, args) => {
|
|
69
|
+
const sel = getFuncSelector(abiItem);
|
|
70
|
+
if (!sel)
|
|
71
|
+
return '';
|
|
72
|
+
let hex = removeHexPrefix(sel);
|
|
73
|
+
if (args)
|
|
74
|
+
hex += removeHexPrefix(args);
|
|
75
|
+
try {
|
|
76
|
+
return wasm.convertHexToData(hex);
|
|
77
|
+
}
|
|
78
|
+
catch (_a) {
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* ABI 인자 인코드. '0x' prefix 포함. address 타입 입력이 locus 주소 형식
|
|
84
|
+
* (base32) 이면 `convertAddressToHex` 로 변환 후 전달. 이미 '0x' 로 시작하는
|
|
85
|
+
* hex 면 그대로 사용.
|
|
86
|
+
*
|
|
87
|
+
* `args` 가 생략되면 각 input 의 `value` 필드에서 값을 가져온다 — UI 측이
|
|
88
|
+
* `{ ...inputAbi, value: <user-input> }` 형태로 augmented 한 inputs 를
|
|
89
|
+
* 그대로 넘기는 호출 패턴 (explorer-suite abi-item 등) 호환.
|
|
90
|
+
*/
|
|
91
|
+
const encodeArgHex = (inputs, args) => {
|
|
92
|
+
const paramTypes = [];
|
|
93
|
+
const paramValues = [];
|
|
94
|
+
inputs.forEach((input, idx) => {
|
|
95
|
+
let value = args ? args[idx] : input.value;
|
|
96
|
+
if (input.type === 'address' && typeof value === 'string' && !value.startsWith('0x')) {
|
|
97
|
+
const hex = wasm.convertAddressToHex(value);
|
|
98
|
+
if (hex != null)
|
|
99
|
+
value = '0x' + hex;
|
|
100
|
+
}
|
|
101
|
+
paramTypes.push(input.type);
|
|
102
|
+
paramValues.push(value);
|
|
103
|
+
});
|
|
104
|
+
if (paramTypes.length === 0)
|
|
105
|
+
return '';
|
|
106
|
+
return ethers_esm_min.ethers.utils.defaultAbiCoder.encode(paramTypes, paramValues);
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Locus chain `func` 응답 디코드. 결과는 `{ value, name?, type }[]`.
|
|
110
|
+
* - address: locus 주소 문자열로 변환
|
|
111
|
+
* - BigNumber: 10진 string 으로 변환
|
|
112
|
+
*
|
|
113
|
+
* `result` 는 base64-encoded chain data. 빈 결과 (`''`, `'0x'`) 는 `[]` 반환.
|
|
114
|
+
*/
|
|
115
|
+
const decodeResult = (func, result) => {
|
|
116
|
+
var _a;
|
|
117
|
+
if (!result || result === '0x')
|
|
118
|
+
return [];
|
|
119
|
+
const hexString = wasm.convertDataToHex(result);
|
|
120
|
+
const iface = new ethers_esm_min.ethers.utils.Interface([func]);
|
|
121
|
+
const decoded = iface.decodeFunctionResult(func.name, hexString.startsWith('0x') ? hexString : `0x${hexString}`);
|
|
122
|
+
const resultObj = JSON.parse(JSON.stringify(decoded));
|
|
123
|
+
const outputs = (_a = func === null || func === void 0 ? void 0 : func.outputs) !== null && _a !== void 0 ? _a : [];
|
|
124
|
+
return outputs.map((output, i) => {
|
|
125
|
+
let value = resultObj[i];
|
|
126
|
+
if (output.type === 'address' && typeof value === 'string') {
|
|
127
|
+
value = wasm.convertHexToAddress(value.toLowerCase());
|
|
128
|
+
}
|
|
129
|
+
else if (value && typeof value === 'object' && value.type === 'BigNumber') {
|
|
130
|
+
value = ethers_esm_min.ethers.BigNumber.from(value).toString();
|
|
131
|
+
}
|
|
132
|
+
return { value, name: output.name, type: output.type };
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* ERC20 `transfer(address,uint256)` call data 에서 to/amount 추출.
|
|
137
|
+
* `funcData` 는 base64-encoded chain data. 4바이트 selector + 32바이트 to slot
|
|
138
|
+
* + 32바이트 amount slot. to 는 슬롯의 마지막 20바이트 (이더리움 표준 주소).
|
|
139
|
+
*/
|
|
140
|
+
const getTransferFuncArgs = (funcData) => {
|
|
141
|
+
let hex = wasm.convertDataToHex(funcData);
|
|
142
|
+
hex = hex.startsWith('0x') ? hex : `0x${hex}`;
|
|
143
|
+
const to = wasm.convertHexToAddress(hex.slice(10, 74).slice(-40));
|
|
144
|
+
const amount = BigInt(hex.slice(74, 138)).toString();
|
|
145
|
+
return { to, amount };
|
|
146
|
+
};
|
|
147
|
+
|
|
11
148
|
class TxValidator {
|
|
12
149
|
constructor() {
|
|
13
150
|
this.verifyTxParams = (rpcResult, params, options) => {
|
|
@@ -349,11 +486,20 @@ exports.splitKeystoreBundle = keystore.splitKeystoreBundle;
|
|
|
349
486
|
exports.unlockKeystoreBundle = keystore.unlockKeystoreBundle;
|
|
350
487
|
exports.unlockMasterKeystore = keystore.unlockMasterKeystore;
|
|
351
488
|
exports.unlockNormalKeystore = keystore.unlockNormalKeystore;
|
|
489
|
+
exports.LocusEthers = LocusEthers;
|
|
352
490
|
exports.checkAddressType = checkAddressType;
|
|
491
|
+
exports.convertJsonToFuncString = convertJsonToFuncString;
|
|
492
|
+
exports.decodeResult = decodeResult;
|
|
493
|
+
exports.encodeArgHex = encodeArgHex;
|
|
494
|
+
exports.findAbiFunction = findAbiFunction;
|
|
495
|
+
exports.getFunc = getFunc;
|
|
496
|
+
exports.getFuncSelector = getFuncSelector;
|
|
497
|
+
exports.getTransferFuncArgs = getTransferFuncArgs;
|
|
353
498
|
exports.isAccount = isAccount;
|
|
354
499
|
exports.isContract = isContract;
|
|
355
500
|
exports.isSystemToken = isSystemToken;
|
|
356
501
|
exports.isToken = isToken;
|
|
357
502
|
exports.loadLocusWasm = loadLocusWasm;
|
|
503
|
+
exports.removeHexPrefix = removeHexPrefix;
|
|
358
504
|
exports.txValidator = txValidator;
|
|
359
505
|
exports.verifyTxParams = verifyTxParams;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from '../autogen/wasm.
|
|
2
|
-
export * from './keystore.
|
|
3
|
-
|
|
1
|
+
export * from '../autogen/wasm.cjs';
|
|
2
|
+
export * from './keystore.cjs';
|
|
3
|
+
export * from './abi.cjs';
|
|
4
|
+
import { TxValidator } from './tx-validator.cjs';
|
|
4
5
|
/**
|
|
5
6
|
* `loadLocusWasm` 의 옵션.
|
|
6
7
|
*
|
|
@@ -33,7 +34,7 @@ export declare const verifyTxParams: (rpcResult: {
|
|
|
33
34
|
tx: any;
|
|
34
35
|
}, params: any, options: {
|
|
35
36
|
targetTxHash?: string | false;
|
|
36
|
-
}) => import("./tx-validator.
|
|
37
|
+
}) => import("./tx-validator.cjs").IntegrityCheckResult;
|
|
37
38
|
export declare const checkAddressType: (address: string) => number;
|
|
38
39
|
export declare const isAccount: (addressType: number) => true | 3;
|
|
39
40
|
export declare const isContract: (addressType: number) => addressType is 2;
|
package/dist/utils/index.d.mts
CHANGED
package/dist/utils/index.esm.js
CHANGED
|
@@ -1,12 +1,149 @@
|
|
|
1
1
|
import { A as AddressClass } from '../chunks/address-class-CHAZYhdZ.js';
|
|
2
|
-
import {
|
|
3
|
-
export { b as calculateTxLinkHash, e as convertAddressToData, g as convertBase32ToData, h as convertBase32ToHex, i as convertCurrency, j as convertDataTo, k as convertDataToAddress, m as convertDataToBase32,
|
|
2
|
+
import { n as convertDataToHex, p as convertHexToAddress, f as convertAddressToHex, r as convertHexToData, T as verifyTx, d as compileCoreScript } from '../chunks/wasm-CLXJDrJA.js';
|
|
3
|
+
export { b as calculateTxLinkHash, e as convertAddressToData, g as convertBase32ToData, h as convertBase32ToHex, i as convertCurrency, j as convertDataTo, k as convertDataToAddress, m as convertDataToBase32, o as convertDataToString, q as convertHexToBase32, s as convertStringToData, t as convertToData, c as createAccountAndKeystore, u as createMasterKeystore, v as createNormalKey, w as createNormalKeystore, x as decodeTxs, y as deriveKeysFromMnemonic, z as deriveKeysFromMnemonicAndPath, A as disCompileCoreScript, B as encodeTxCurrency, C as encodeTxNumber, D as generateMnemonic, E as generateMnemonicBySeed, F as getDefFromCoreScript, G as getHomeShard, H as getLibraryVersions, I as gzipAndEncode, J as hash, K as isGrantConsumingTx, l as loadMasterKeystore, a as loadNormalKeystore, L as makeCurrency, M as sign, N as signByMasterKey, O as signKeyBind, P as testCoreScript, Q as verify, R as verifyByMasterKey, S as verifyMerkleProof } from '../chunks/wasm-CLXJDrJA.js';
|
|
4
4
|
export { c as createKeystoreBundle, s as splitKeystoreBundle, u as unlockKeystoreBundle, a as unlockMasterKeystore, b as unlockNormalKeystore } from '../chunks/keystore-B86UzV8A.js';
|
|
5
|
+
import { e as ethers } from '../chunks/ethers.esm.min-CiOJmj8w.js';
|
|
5
6
|
import { l as load } from '../chunks/lclib-j2x9RvDY.js';
|
|
6
7
|
import '../chunks/base-BQXfRsuw.js';
|
|
7
8
|
import '../chunks/account-FZT9LH_s.js';
|
|
8
9
|
import '../chunks/tslib.es6-WQS2tr1v.js';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* ABI 코덱 + vendored ethers v5 namespace re-export.
|
|
13
|
+
*
|
|
14
|
+
* `support/erc20-helper/abi.mts` 가 lib 0.2.0 의 viem-style 리팩토링 때 사라졌으나,
|
|
15
|
+
* locus-wallet-extension / locuschain-explorer-suite 가 동일 API 셰입에 의존하고
|
|
16
|
+
* 있어 같은 셰입을 lib 안에 다시 둔다 (양쪽 사이트의 자체 locus-ethers.ts 중복
|
|
17
|
+
* 해소가 목적).
|
|
18
|
+
*
|
|
19
|
+
* 이 모듈은 vendored ethers v5 (`libs/ethers.js-5.5.4-20bytes-addr/ethers.esm.min.js`)
|
|
20
|
+
* 만 사용. `getContract.mts` 와 동일한 import 경로 — 외부 사용자는 자체 `ethers`
|
|
21
|
+
* 패키지를 dep 으로 가질 필요 없다.
|
|
22
|
+
*
|
|
23
|
+
* 주소 길이는 20바이트(이더리움 표준). ABI 32바이트 슬롯의 마지막 40 hex 만 사용.
|
|
24
|
+
*/
|
|
25
|
+
// @ts-ignore — vendored JS, no .d.ts. tsconfig.json 에서 src/libs 가 exclude 되어
|
|
26
|
+
// allowJs 가 적용되지 않는다. 외부 노출 namespace 이므로 `any` 로 받아 사용.
|
|
27
|
+
/**
|
|
28
|
+
* vendored ethers v5 namespace. 호출자가 `LocusEthers.BigNumber`, `LocusEthers.utils.id`
|
|
29
|
+
* 등 namespace 함수를 자유롭게 쓸 수 있게 re-export. `import { ethers } from 'ethers'`
|
|
30
|
+
* 를 외부 dep 으로 따로 갖지 않아도 lib 한 곳에서 가져갈 수 있다.
|
|
31
|
+
*
|
|
32
|
+
* vendored ethers 는 .d.ts 가 없어 type 위치 (`let x: LocusEthers.BigNumber`) 에
|
|
33
|
+
* 쓰이려면 namespace declaration 이 필요하다. declaration merging 으로 같은 이름의
|
|
34
|
+
* value (vendored ethers runtime) 와 namespace (type alias) 를 함께 export.
|
|
35
|
+
*/
|
|
36
|
+
const LocusEthers = ethers;
|
|
37
|
+
const removeHexPrefix = (s) => {
|
|
38
|
+
if (!s)
|
|
39
|
+
return s;
|
|
40
|
+
return s.toLowerCase().startsWith('0x') ? s.substring(2) : s;
|
|
41
|
+
};
|
|
42
|
+
const convertJsonToFuncString = (item) => {
|
|
43
|
+
const inputString = item.inputs.map(x => `${x.type}`).join(',');
|
|
44
|
+
return item.name ? `${item.name}(${inputString})` : `constructor(${inputString})`;
|
|
45
|
+
};
|
|
46
|
+
/** ABI 배열에서 이름으로 function 항목 찾기. 못 찾으면 undefined. */
|
|
47
|
+
const findAbiFunction = (abi, name) => {
|
|
48
|
+
return abi.find(item => item.type === 'function' && item.name === name);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 함수 selector. '0x' prefix 포함 10자 (4-byte hex + '0x').
|
|
52
|
+
* ethers v5 `Interface.getSighash(name)` 의 직접 동등.
|
|
53
|
+
*/
|
|
54
|
+
const getFuncSelector = (abiItem) => {
|
|
55
|
+
try {
|
|
56
|
+
const iface = new ethers.utils.Interface([abiItem]);
|
|
57
|
+
return iface.getSighash(abiItem.name);
|
|
58
|
+
}
|
|
59
|
+
catch (_a) {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Locus chain `func` 필드용 base64-encoded data.
|
|
65
|
+
* selector(0x 제외) + 선택적 args hex(0x 제외) 를 이어 붙여 `convertHexToData`.
|
|
66
|
+
*/
|
|
67
|
+
const getFunc = (abiItem, args) => {
|
|
68
|
+
const sel = getFuncSelector(abiItem);
|
|
69
|
+
if (!sel)
|
|
70
|
+
return '';
|
|
71
|
+
let hex = removeHexPrefix(sel);
|
|
72
|
+
if (args)
|
|
73
|
+
hex += removeHexPrefix(args);
|
|
74
|
+
try {
|
|
75
|
+
return convertHexToData(hex);
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* ABI 인자 인코드. '0x' prefix 포함. address 타입 입력이 locus 주소 형식
|
|
83
|
+
* (base32) 이면 `convertAddressToHex` 로 변환 후 전달. 이미 '0x' 로 시작하는
|
|
84
|
+
* hex 면 그대로 사용.
|
|
85
|
+
*
|
|
86
|
+
* `args` 가 생략되면 각 input 의 `value` 필드에서 값을 가져온다 — UI 측이
|
|
87
|
+
* `{ ...inputAbi, value: <user-input> }` 형태로 augmented 한 inputs 를
|
|
88
|
+
* 그대로 넘기는 호출 패턴 (explorer-suite abi-item 등) 호환.
|
|
89
|
+
*/
|
|
90
|
+
const encodeArgHex = (inputs, args) => {
|
|
91
|
+
const paramTypes = [];
|
|
92
|
+
const paramValues = [];
|
|
93
|
+
inputs.forEach((input, idx) => {
|
|
94
|
+
let value = args ? args[idx] : input.value;
|
|
95
|
+
if (input.type === 'address' && typeof value === 'string' && !value.startsWith('0x')) {
|
|
96
|
+
const hex = convertAddressToHex(value);
|
|
97
|
+
if (hex != null)
|
|
98
|
+
value = '0x' + hex;
|
|
99
|
+
}
|
|
100
|
+
paramTypes.push(input.type);
|
|
101
|
+
paramValues.push(value);
|
|
102
|
+
});
|
|
103
|
+
if (paramTypes.length === 0)
|
|
104
|
+
return '';
|
|
105
|
+
return ethers.utils.defaultAbiCoder.encode(paramTypes, paramValues);
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Locus chain `func` 응답 디코드. 결과는 `{ value, name?, type }[]`.
|
|
109
|
+
* - address: locus 주소 문자열로 변환
|
|
110
|
+
* - BigNumber: 10진 string 으로 변환
|
|
111
|
+
*
|
|
112
|
+
* `result` 는 base64-encoded chain data. 빈 결과 (`''`, `'0x'`) 는 `[]` 반환.
|
|
113
|
+
*/
|
|
114
|
+
const decodeResult = (func, result) => {
|
|
115
|
+
var _a;
|
|
116
|
+
if (!result || result === '0x')
|
|
117
|
+
return [];
|
|
118
|
+
const hexString = convertDataToHex(result);
|
|
119
|
+
const iface = new ethers.utils.Interface([func]);
|
|
120
|
+
const decoded = iface.decodeFunctionResult(func.name, hexString.startsWith('0x') ? hexString : `0x${hexString}`);
|
|
121
|
+
const resultObj = JSON.parse(JSON.stringify(decoded));
|
|
122
|
+
const outputs = (_a = func === null || func === void 0 ? void 0 : func.outputs) !== null && _a !== void 0 ? _a : [];
|
|
123
|
+
return outputs.map((output, i) => {
|
|
124
|
+
let value = resultObj[i];
|
|
125
|
+
if (output.type === 'address' && typeof value === 'string') {
|
|
126
|
+
value = convertHexToAddress(value.toLowerCase());
|
|
127
|
+
}
|
|
128
|
+
else if (value && typeof value === 'object' && value.type === 'BigNumber') {
|
|
129
|
+
value = ethers.BigNumber.from(value).toString();
|
|
130
|
+
}
|
|
131
|
+
return { value, name: output.name, type: output.type };
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* ERC20 `transfer(address,uint256)` call data 에서 to/amount 추출.
|
|
136
|
+
* `funcData` 는 base64-encoded chain data. 4바이트 selector + 32바이트 to slot
|
|
137
|
+
* + 32바이트 amount slot. to 는 슬롯의 마지막 20바이트 (이더리움 표준 주소).
|
|
138
|
+
*/
|
|
139
|
+
const getTransferFuncArgs = (funcData) => {
|
|
140
|
+
let hex = convertDataToHex(funcData);
|
|
141
|
+
hex = hex.startsWith('0x') ? hex : `0x${hex}`;
|
|
142
|
+
const to = convertHexToAddress(hex.slice(10, 74).slice(-40));
|
|
143
|
+
const amount = BigInt(hex.slice(74, 138)).toString();
|
|
144
|
+
return { to, amount };
|
|
145
|
+
};
|
|
146
|
+
|
|
10
147
|
class TxValidator {
|
|
11
148
|
constructor() {
|
|
12
149
|
this.verifyTxParams = (rpcResult, params, options) => {
|
|
@@ -297,4 +434,4 @@ const isToken = (addressType) => addressType === AddressClass.UserToken ||
|
|
|
297
434
|
addressType === AddressClass.AssetNFT;
|
|
298
435
|
const isSystemToken = (addressType) => addressType === AddressClass.UserToken || addressType === AddressClass.ContractToken;
|
|
299
436
|
|
|
300
|
-
export { checkAddressType, compileCoreScript, convertAddressToHex, isAccount, isContract, isSystemToken, isToken, loadLocusWasm, txValidator, verifyTx, verifyTxParams };
|
|
437
|
+
export { LocusEthers, checkAddressType, compileCoreScript, convertAddressToHex, convertDataToHex, convertHexToAddress, convertHexToData, convertJsonToFuncString, decodeResult, encodeArgHex, findAbiFunction, getFunc, getFuncSelector, getTransferFuncArgs, isAccount, isContract, isSystemToken, isToken, loadLocusWasm, removeHexPrefix, txValidator, verifyTx, verifyTxParams };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Address } from '../types/primitives.cjs';
|
|
2
|
+
/** `loadMasterKeystore` 가 반환하는 파싱된 master keystore payload. */
|
|
3
|
+
export type MasterKeyInfo = {
|
|
4
|
+
address: Address;
|
|
5
|
+
mkeyAlgorithm: string;
|
|
6
|
+
msecretKey: string;
|
|
7
|
+
mpublicKey: string;
|
|
8
|
+
};
|
|
9
|
+
/** `loadNormalKeystore` 가 반환하는 파싱된 normal keystore payload. */
|
|
10
|
+
export type NormalKeyInfo = {
|
|
11
|
+
address: Address;
|
|
12
|
+
nkeyAlgorithm: string;
|
|
13
|
+
nsecretKey: string;
|
|
14
|
+
npublicKey: string;
|
|
15
|
+
keyBind: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** 평탄화된 키 자료 — `keysToAccount` 가 받는 형태. */
|
|
18
|
+
export type UnlockedKeyPair = {
|
|
19
|
+
address: Address;
|
|
20
|
+
msk: string;
|
|
21
|
+
mpk: string;
|
|
22
|
+
nsk: string;
|
|
23
|
+
npk: string;
|
|
24
|
+
};
|
|
25
|
+
export type CreateKeystoreBundleArgs = {
|
|
26
|
+
passwordMaster: string;
|
|
27
|
+
passwordNormal: string;
|
|
28
|
+
/** 비어 있으면 WASM 헬퍼가 내부적으로 'FALCON+ED25519' 를 기본값으로 쓴다. */
|
|
29
|
+
algoMaster?: string;
|
|
30
|
+
/** 비어 있으면 WASM 헬퍼가 내부적으로 'ED25519' 를 기본값으로 쓴다. */
|
|
31
|
+
algoNormal?: string;
|
|
32
|
+
};
|
|
33
|
+
export type AccountKeystoreBundle = {
|
|
34
|
+
/** 원본 JSON array 문자열 — 영속화에 적합. */
|
|
35
|
+
raw: string;
|
|
36
|
+
/** master / normal 두 반쪽의 개별 JSON 문자열. */
|
|
37
|
+
masterKsJson: string;
|
|
38
|
+
normalKsJson: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 새 dual-key keystore 를 만들고 결과 JSON array 를 master / normal 두
|
|
42
|
+
* 반쪽으로 분리한다. 각 반쪽은 독립적으로 영속화한 뒤 unlockMasterKeystore
|
|
43
|
+
* / unlockNormalKeystore 로 다시 unlock 할 수 있다.
|
|
44
|
+
*
|
|
45
|
+
* WASM 의 `createAccountAndKeystore` 에 대한 얇은 래퍼다. `utils/index.mts`
|
|
46
|
+
* 가 raw WASM export 도 함께 re-export 하므로 충돌을 피하려고 이름을
|
|
47
|
+
* 새로 붙였다.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createKeystoreBundle(args: CreateKeystoreBundleArgs): AccountKeystoreBundle;
|
|
50
|
+
/**
|
|
51
|
+
* WASM `createAccountAndKeystore` 헬퍼가 반환한 `[master, normal]` keystore
|
|
52
|
+
* 배열을 두 JSON 문자열로 분리한다.
|
|
53
|
+
*/
|
|
54
|
+
export declare function splitKeystoreBundle(bundleJson: string): {
|
|
55
|
+
masterKsJson: string;
|
|
56
|
+
normalKsJson: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* master keystore JSON 을 password 로 복호화한다.
|
|
60
|
+
*
|
|
61
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `mkeyAlgorithm`,
|
|
62
|
+
* `msecretKey`, `mpublicKey`) 를 그대로 반환한다.
|
|
63
|
+
*/
|
|
64
|
+
export declare function unlockMasterKeystore(args: {
|
|
65
|
+
ksJson: string;
|
|
66
|
+
password: string;
|
|
67
|
+
}): MasterKeyInfo;
|
|
68
|
+
/**
|
|
69
|
+
* normal keystore JSON 을 password 로 복호화한다.
|
|
70
|
+
*
|
|
71
|
+
* WASM 헬퍼가 emit 하는 lowercase-camelCase 필드 (`address`, `nkeyAlgorithm`,
|
|
72
|
+
* `nsecretKey`, `npublicKey`, `keyBind`) 를 그대로 반환한다.
|
|
73
|
+
*/
|
|
74
|
+
export declare function unlockNormalKeystore(args: {
|
|
75
|
+
ksJson: string;
|
|
76
|
+
password: string;
|
|
77
|
+
}): NormalKeyInfo;
|
|
78
|
+
/**
|
|
79
|
+
* one-shot 헬퍼: 전체 `[master, normal]` keystore JSON 과 두 password 를
|
|
80
|
+
* 받아 `keysToAccount` 가 소비하는 평탄한 (address, msk, mpk, nsk, npk)
|
|
81
|
+
* tuple 을 반환한다.
|
|
82
|
+
*/
|
|
83
|
+
export declare function unlockKeystoreBundle(args: {
|
|
84
|
+
ksJsonBundle: string | AccountKeystoreBundle;
|
|
85
|
+
passwordMaster: string;
|
|
86
|
+
passwordNormal: string;
|
|
87
|
+
}): UnlockedKeyPair;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function loadCryptoWasm(opts?: {}): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type IntegrityCheckResult = {
|
|
2
|
+
result: boolean | string;
|
|
3
|
+
reason: string;
|
|
4
|
+
field?: string;
|
|
5
|
+
txHash?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class TxValidator {
|
|
8
|
+
verifyTxParams: (rpcResult: {
|
|
9
|
+
hash: string;
|
|
10
|
+
tx: any;
|
|
11
|
+
}, params: any, options: {
|
|
12
|
+
targetTxHash?: string | false;
|
|
13
|
+
}) => IntegrityCheckResult;
|
|
14
|
+
private logAndFail;
|
|
15
|
+
private getByPathIgnoreCase;
|
|
16
|
+
private getByPath;
|
|
17
|
+
private isDeepEqual;
|
|
18
|
+
/**
|
|
19
|
+
* params 객체와 tx 객체의 필드를 주어진 매핑에 따라 비교합니다.
|
|
20
|
+
* @param params 파라미터 객체.
|
|
21
|
+
* @param tx 검증할 트랜잭션 객체.
|
|
22
|
+
* @param mapping 키는 `params`의 속성 경로, 값은 `tx`의 속성 경로인 객체.
|
|
23
|
+
* @param optional mapping과 동일한 구조이나, `params` 값이 있을경우만 체크합니다. string은 빈문자열이 아닌 문자열, number는 0을 없다고 판단합니다
|
|
24
|
+
* @returns 모든 필드가 일치하면 `true`, 실패 시 `IntegrityCheckResult` 객체를 반환합니다.
|
|
25
|
+
*/
|
|
26
|
+
private checkFields;
|
|
27
|
+
private checkComplexField;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ParamTxData {
|
|
2
|
+
round: number;
|
|
3
|
+
height: number;
|
|
4
|
+
args: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface MerkleProof {
|
|
7
|
+
Positions: number[];
|
|
8
|
+
Siblings: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LibraryVersions {
|
|
11
|
+
LibraryVersion: number;
|
|
12
|
+
KeystoreVersion: number;
|
|
13
|
+
KeystoreVersionMin: number;
|
|
14
|
+
GoBuildVersion: string;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locuschain/lib",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "bloomtechnology",
|
|
6
6
|
"license": "MIT",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
},
|
|
143
143
|
"scripts": {
|
|
144
144
|
"generate-code": "./generate-code.sh",
|
|
145
|
-
"build": "rm -rf dist && rollup -c rollup.config.mjs && node -
|
|
145
|
+
"build": "rm -rf dist && rollup -c rollup.config.mjs && node scripts/emit-d-cts.mjs",
|
|
146
146
|
"gen-build-publish": "npm run generate-code && npm run build && npm publish --access public"
|
|
147
147
|
}
|
|
148
148
|
}
|