@continuumdao/ctm-mpc-defi 0.2.59 → 0.2.60
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/agent/catalog.cjs +1 -1
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.js +1 -1
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/railgun/SKILL.md +2 -2
- package/dist/protocols/evm/railgun/index.cjs +13 -1
- package/dist/protocols/evm/railgun/index.cjs.map +1 -1
- package/dist/protocols/evm/railgun/index.d.ts +3 -1
- package/dist/protocols/evm/railgun/index.js +14 -3
- package/dist/protocols/evm/railgun/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAddress, parseAbi, zeroAddress, encodeFunctionData, defineChain, createPublicClient, parseGwei, serializeTransaction,
|
|
1
|
+
import { getAddress, parseAbi, zeroAddress, keccak256, encodeFunctionData, defineChain, createPublicClient, parseGwei, serializeTransaction, hashMessage, stringToHex, http } from 'viem';
|
|
2
2
|
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
3
3
|
import { TXIDVersion, calculateGasPrice, ChainType, EVMGasType, RailgunWalletBalanceBucket } from '@railgun-community/shared-models';
|
|
4
4
|
|
|
@@ -659,6 +659,16 @@ async function shieldSignatureMessage() {
|
|
|
659
659
|
const wallet = await import('@railgun-community/wallet');
|
|
660
660
|
return wallet.getShieldPrivateKeySignatureMessage();
|
|
661
661
|
}
|
|
662
|
+
function shieldPrivateKeyFromSignature(signature) {
|
|
663
|
+
const hex = signature.startsWith("0x") ? signature : `0x${signature}`;
|
|
664
|
+
if (!/^0x[0-9a-fA-F]+$/.test(hex) || (hex.length - 2) % 2 !== 0) {
|
|
665
|
+
throw new Error("Shield-key signature must be hex.");
|
|
666
|
+
}
|
|
667
|
+
if ((hex.length - 2) / 2 !== 65) {
|
|
668
|
+
throw new Error("Shield-key signature must be the 65-byte personal_sign of RAILGUN_SHIELD.");
|
|
669
|
+
}
|
|
670
|
+
return keccak256(hex);
|
|
671
|
+
}
|
|
662
672
|
function personalSignBody(args, message) {
|
|
663
673
|
const executor = getAddress(args.executorAddress);
|
|
664
674
|
const digest = hashMessage(message);
|
|
@@ -739,6 +749,7 @@ async function buildEvmMultisignBodyRailgunShield(args) {
|
|
|
739
749
|
if (!signature) {
|
|
740
750
|
return personalSignBody(args, await shieldSignatureMessage());
|
|
741
751
|
}
|
|
752
|
+
const shieldPrivateKey = shieldPrivateKeyFromSignature(signature);
|
|
742
753
|
const network = await railgunNetworkByChainId(args.chainId);
|
|
743
754
|
if (!network) throw new Error("Railgun is not deployed on this chain.");
|
|
744
755
|
const tokenAddress = getAddress(args.tokenAddress);
|
|
@@ -790,7 +801,7 @@ async function buildEvmMultisignBodyRailgunShield(args) {
|
|
|
790
801
|
const populated = await populate(
|
|
791
802
|
TXIDVersion.V2_PoseidonMerkle,
|
|
792
803
|
networkName,
|
|
793
|
-
|
|
804
|
+
shieldPrivateKey,
|
|
794
805
|
[{ tokenAddress, amount, recipientAddress: args.railgunAddress.trim() }],
|
|
795
806
|
[],
|
|
796
807
|
railgunGasDetails(args.chainDetail, 1200000n)
|
|
@@ -1221,6 +1232,6 @@ var railgunProtocolModule = {
|
|
|
1221
1232
|
};
|
|
1222
1233
|
registerProtocolModule(railgunProtocolModule);
|
|
1223
1234
|
|
|
1224
|
-
export { RAILGUN_CTM_DISABLED_MESSAGE, RAILGUN_CTM_ENABLED, RAILGUN_POPULAR_ASSET_LIMIT, RAILGUN_PROTOCOL_ID, RAILGUN_WALLET_LOCKED_MESSAGE, assertRailgunCtmAllowed, buildEvmMultisignBodyRailgunShield, buildEvmMultisignBodyWethUnwrap, clearRailgunNetworkCache, clearRailgunPopularAssetCache, clearRailgunPrivateBalanceSnapshots, commitmentsFromShieldIndex, createRailgunBrowserWallet, discardRailgunWallet, getRailgunWalletSession, loadRailgunNetworks, loadRailgunPopularAssets, loadRailgunSupportedChainIds, openRailgunViewOnlyWallet, publishRailgunPrivateBalanceSnapshot, railgunAddressIsValid, railgunFetchPopularAssets, railgunFetchPrivateBalances, railgunFetchPrivateBalancesSummary, railgunNetworkByChainId, railgunPrivateTransfer, railgunProtocolModule, railgunShareableViewingKey, railgunUnshield, rankPopularShieldTokens, readRailgunPrivateBalanceSnapshot, requireRailgunWalletSession, scanRailgunPrivateBalances, selectRailgunNetworks, setRailgunAllowanceReaderForTests, setRailgunPopulateShieldForTests, setRailgunShieldLogReaderForTests, setRailgunWalletSession, shieldIndexEndpoint, unlockRailgunBrowserWallet, utxoScanTerminalStatus };
|
|
1235
|
+
export { RAILGUN_CTM_DISABLED_MESSAGE, RAILGUN_CTM_ENABLED, RAILGUN_POPULAR_ASSET_LIMIT, RAILGUN_PROTOCOL_ID, RAILGUN_WALLET_LOCKED_MESSAGE, assertRailgunCtmAllowed, buildEvmMultisignBodyRailgunShield, buildEvmMultisignBodyWethUnwrap, clearRailgunNetworkCache, clearRailgunPopularAssetCache, clearRailgunPrivateBalanceSnapshots, commitmentsFromShieldIndex, createRailgunBrowserWallet, discardRailgunWallet, getRailgunWalletSession, loadRailgunNetworks, loadRailgunPopularAssets, loadRailgunSupportedChainIds, openRailgunViewOnlyWallet, publishRailgunPrivateBalanceSnapshot, railgunAddressIsValid, railgunFetchPopularAssets, railgunFetchPrivateBalances, railgunFetchPrivateBalancesSummary, railgunNetworkByChainId, railgunPrivateTransfer, railgunProtocolModule, railgunShareableViewingKey, railgunUnshield, rankPopularShieldTokens, readRailgunPrivateBalanceSnapshot, requireRailgunWalletSession, scanRailgunPrivateBalances, selectRailgunNetworks, setRailgunAllowanceReaderForTests, setRailgunPopulateShieldForTests, setRailgunShieldLogReaderForTests, setRailgunWalletSession, shieldIndexEndpoint, shieldPrivateKeyFromSignature, unlockRailgunBrowserWallet, utxoScanTerminalStatus };
|
|
1225
1236
|
//# sourceMappingURL=index.js.map
|
|
1226
1237
|
//# sourceMappingURL=index.js.map
|