![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
cosmos-crypto
Advanced tools
JavaScript crypto library supporting cosmos light client in react-native app(also can use in brower). It mainly provides account generation, transaction construction and offline signing functions of cosmos. You can install this library in the following ways
npm install -s cosmos-crypto
then config env(only in react-native)
npm i --save react-native-crypto
//install peer deps
npm i --save react-native-randombytes
react-native link react-native-randombytes
//install latest rn-nodeify
npm i --save-dev tradle/rn-nodeify
//install node core shims and recursively hack package.json files
//in ./node_modules to add/update the "browser"/"react-native" field with relevant mappings
./node_modules/.bin/rn-nodeify --hack --install
//next
rn-nodeify will create a shim.js in the project root directory
// index.ios.js or index.android.js
// make sure you use `import` and not require!
import './shim.js'
import crypto from 'crypto'
// ...the rest of your code
import {Crypto,Builder} from 'cosmos-crypto';
let account = Crypto.create('your language');
// account: {"address":"faa1e4y8urzgjd82447ydlw9tszsm2lxfwdr5hxj4a","phrase":"carbon when squeeze ginger rather science taxi disagree safe season mango teach trust open baby immune nephew youth nothing afraid sick prefer daughter throw","privateKey":"436EB1ACE1D9D8F4EA519D050FF16ADD4B9CAF3D6D0917411857318259022EFF","publicKey":"fap1addwnpepqw36efnhzgurxaq3mxsgf4fjm280dehh20w03u3726arm0deagne5u254g2"}
The create method has a parameter:language,Used to specify the generated mnemonic language.The default is 'english'.You have the following options to choose from:
We recommend choosing 'english'
via mnemonic
let account = Crypto.recover('your seed','your language');
or via privateKey
let account = Crypto.import('your privateKey');
const contractHexString = Crypto.splice("contract",[param1,param2])
The difference between the above two is that the latter does not return the mnemonic of the account.
/**
* @privatekey The msg you should encrypto/decrypto
* @pwd The encrypto password
* /
const encryptoPrivatekey = Crypto.encrypto(privatekey,pwd)
const decryptoPrivatekey = Crypto.decrypto(privatekey,pwd)
Construct a transaction and sign
let stdTx = Builder.buildAndSignTx('your request', 'your privateKey');
let postTx = stdTx.GetData();
let hash = stdTx.Hash();
buildAndSignTx has two parameters:
msg:{
ToAddress:{
value:'contract139rv6v6p7ewqv85wlqtfvk23x5aufxl8r0qaxc', //type of contract address
type:'contract'
},
FromAddress:{
value:test.address, //type of user address
type:'address'
},
Amount:'1',
Sequence:sequence,
Data:{
value:'ecc2a9a0', //type of base64
type:'base64'
},
GasLimit:'4294967295',
GasPrice:'0',
GameName:'twentyOne',
GameType:'classical',
ChipRange:'1',
ContractKey:'ToAddress' //指定合约读取的key 当部署或调用合约时需指定合约地址的key
}
GetData will return the constructed and signed transaction,you can call lcd's 'tx/broadcast'(cosmos:/txs) to send the transaction.
Hash is used to calculate the hash of the transaction,prevent server response from being unavailable due to timeout. You can use hash to confirm if the transaction was successful. contact me
FAQs
crypto for cosmos in react-native
The npm package cosmos-crypto receives a total of 0 weekly downloads. As such, cosmos-crypto popularity was classified as not popular.
We found that cosmos-crypto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.