Documentation
¶
Index ¶
- func Bit2Byte(bits []uint) []byte
- func Byte2Bit(data []byte) []uint
- func ChunkStringToByte(s string) []byte
- func CreateRawTx(actionTy int32, tokenId uint64, amount string, toEthAddress string, ...) ([]byte, error)
- func GenerateKeyCompat(r io.Reader) (*eddsa.PrivateKey, error)
- func GetContractToTreeMsg(payload *zt.ZkContractToTree) *zt.ZkMsg
- func GetDepositMsg(payload *zt.ZkDeposit) *zt.ZkMsg
- func GetFullExitMsg(payload *zt.ZkFullExit) *zt.ZkMsg
- func GetLayer2PrivateKeySeed(privateKey, exchangeAddr, nonce string) ([]byte, error)
- func GetMintNFTMsg(payload *zt.ZkMintNFT) *zt.ZkMsg
- func GetMsgHash(msg *zt.ZkMsg) []byte
- func GetProxyExitMsg(payload *zt.ZkProxyExit) *zt.ZkMsg
- func GetSetPubKeyMsg(payload *zt.ZkSetPubKey) *zt.ZkMsg
- func GetTransferMsg(payload *zt.ZkTransfer) *zt.ZkMsg
- func GetTransferNFTMsg(payload *zt.ZkTransferNFT) *zt.ZkMsg
- func GetTransferToNewMsg(payload *zt.ZkTransferToNew) *zt.ZkMsg
- func GetTreeToContractMsg(payload *zt.ZkTreeToContract) *zt.ZkMsg
- func GetWithdrawMsg(payload *zt.ZkWithdraw) *zt.ZkMsg
- func GetWithdrawNFTMsg(payload *zt.ZkWithdrawNFT) *zt.ZkMsg
- func New() wcom.WalletBizPolicy
- func SignTx(msg *zt.ZkMsg, privateKey *eddsa.PrivateKey) (*zt.ZkSignature, error)
- func StringToByte(s string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChunkStringToByte ¶
func CreateRawTx ¶
func GenerateKeyCompat ¶ added in v1.70.0
func GenerateKeyCompat(r io.Reader) (*eddsa.PrivateKey, error)
GenerateKeyCompat 生成与 gnark-crypto v0.5.3 兼容的 eddsa 密钥对。
gnark-crypto v0.5.3 的 eddsa.GenerateKey 在标量字节反转时循环边界写为 j=sizeFr(标准实现为 j=sizeFr-1),导致把 blake2b 输出的第 33 字节 h[32] 混入标量、丢失 h[0]。v0.12.1 修正为标准派生,同一 seed 生成的密钥对不再一致。
zksync 的 layer2 地址(mimc(pubkey))已按 v0.5.3 的派生固化在链上 (leaf.Chain33Addr),升级后若改用新派生会导致历史用户 SetPubKey 校验失败、 资产不可操作。为保持历史兼容,此处复刻 v0.5.3 的标量构造逻辑,再通过 v0.12.1 的 PrivateKey.SetBytes 构造密钥对象(Sign/Verify 跨版本一致)。
func GetContractToTreeMsg ¶
func GetContractToTreeMsg(payload *zt.ZkContractToTree) *zt.ZkMsg
func GetFullExitMsg ¶
func GetFullExitMsg(payload *zt.ZkFullExit) *zt.ZkMsg
func GetLayer2PrivateKeySeed ¶ added in v1.67.4
GetLayer2PrivateKeySeed 通过用户secp256k1私钥对特定信息的签名的hash产生layer2的eddsa签名的私钥种子来产生用户layer2的私钥 在memtamask或钱包app可以不暴露用户私钥而只是内部签名的方式来产生layer2私钥,更加安全 refer to https://blogs.loopring.org/new-approach-to-generating-layer-2-account-keys-cn/
func GetMsgHash ¶
func GetProxyExitMsg ¶ added in v1.67.4
func GetProxyExitMsg(payload *zt.ZkProxyExit) *zt.ZkMsg
func GetSetPubKeyMsg ¶
func GetSetPubKeyMsg(payload *zt.ZkSetPubKey) *zt.ZkMsg
func GetTransferMsg ¶
func GetTransferMsg(payload *zt.ZkTransfer) *zt.ZkMsg
func GetTransferNFTMsg ¶ added in v1.67.4
func GetTransferNFTMsg(payload *zt.ZkTransferNFT) *zt.ZkMsg
func GetTransferToNewMsg ¶
func GetTransferToNewMsg(payload *zt.ZkTransferToNew) *zt.ZkMsg
func GetTreeToContractMsg ¶
func GetTreeToContractMsg(payload *zt.ZkTreeToContract) *zt.ZkMsg
func GetWithdrawMsg ¶
func GetWithdrawMsg(payload *zt.ZkWithdraw) *zt.ZkMsg
func GetWithdrawNFTMsg ¶ added in v1.67.4
func GetWithdrawNFTMsg(payload *zt.ZkWithdrawNFT) *zt.ZkMsg
func SignTx ¶
func SignTx(msg *zt.ZkMsg, privateKey *eddsa.PrivateKey) (*zt.ZkSignature, error)
func StringToByte ¶
Types ¶
This section is empty.