
Research
Security News
Malicious npm Packages Target BSC and Ethereum to Drain Crypto Wallets
Socket uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
@lit-protocol/contracts-sdk
Advanced tools
ContractsSDK is a bundled package that allows you to make calls to Lit Protocol smart contracts. Some contracts come with additional abstracted functions that can be accessed by appending `Util` to the contract variable name, for example, `pkpNftContract`
ContractsSDK is a bundled package that allows you to make calls to Lit Protocol smart contracts. Some contracts come with additional abstracted functions that can be accessed by appending Util
to the contract variable name, for example, pkpNftContract
becomes pkpNftContractUtil
.
Demo: https://demo-contracts-sdk-react.vercel.app/
yarn add @lit-protocol/contracts-sdk
<script src="https://cdn.jsdelivr.net/npm/@lit-protocol/contracts-sdk-vanilla/contracts-sdk.js"></script>
<script>
(async () => {
const { LitContracts } = LitJsSdk_contractsSdk;
const litContracts = new LitContracts();
await litContracts.connect();
})();
</script>
We provide several ways to initialize an LitContracts instance, you can pass in your private key, ask itself to randomly generate one, your own signer, a PKP signer, etc.
// Most common way. Using your Metamask/Brave or any other third party wallet
const litContracts = new LitContracts();
// use a random private key
const litContracts = new LitContracts({ randomPrivatekey: true });
// use a random private key and store it in the local storage
const litContracts = new LitContracts({
randomPrivatekey: true,
options: {
storeOrUseStorageKey: true,
},
});
// use private key from local storage
const litContracts = new LitContracts({
options: {
storeOrUseStorageKey: true,
},
});
// use custom private key
const litContracts = new LitContracts({
privateKey: TEST_FUNDED_PRIVATE_KEY,
});
// custom signer
const privateKey = TEST_FUNDED_PRIVATE_KEY;
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
const signer = new ethers.Wallet(privateKey, provider);
const litContracts = new LitContracts({ signer });
// with a pkp wallet
// see more in https://github.com/LIT-Protocol/pkp-ethers
const pkpWallet = new PKPWallet({
pkpPubKey: PKP_PUBKEY,
controllerAuthSig: CONTROLLER_AUTHSIG,
provider: 'https://rpc-mumbai.maticvigil.com',
});
await pkpWallet.init();
const litContracts = new LitContracts({ signer: pkpWallet });
They can can be accessed from litContracts.
lit-contracts.config.json
If the directory structures have been changed on the LitNodeContracts repo, you will need to edit the config file.
{
"root": "https://raw.githubusercontent.com/LIT-Protocol/LitNodeContracts/main/",
"contracts": "deployed_contracts_serrano.json",
"abis": {
"dir": "deployments/mumbai_80001/",
"ignoreProperties": ["metadata", "bytecode", "deployedBytecode"]
}
}
node ./packages/contracts-sdk/tools.mjs --update
This script automatically generates a contracts-sdk.ts
. It does this by reading the file names from a specified directory, generating import statements and declarations based on those file names, and replacing certain sections of the contracts-sdk.ts file with the generated content.
node ./packages/contracts-sdk/tools.mjs --gen
FAQs
ContractsSDK is a bundled package that allows you to make calls to Lit Protocol smart contracts. Some contracts come with additional abstracted functions that can be accessed by appending `Util` to the contract variable name, for example, `pkpNftContract`
The npm package @lit-protocol/contracts-sdk receives a total of 3,232 weekly downloads. As such, @lit-protocol/contracts-sdk popularity was classified as popular.
We found that @lit-protocol/contracts-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers 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.
Research
Security News
Socket uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
Security News
TC39 advances 9 JavaScript proposals, including Array.fromAsync, Error.isError, and Explicit Resource Management, which are now headed into the ECMAScript spec.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.