Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
meta-contract-debug
Advanced tools
This sdk helps you to interact with MVC meta contracts
Please read the documentation for more.
npm install meta-contract --save
const { FT } = require('meta-contract')
const { signers, signerSelecteds } = await FT.selectSigners()
const ft = new FT({
network: 'testnet', //mainnet or testnet
purse: '', //the wif of a mvc address to offer transaction fees
feeb: 0.5,
signers,
signerSelecteds,
})
Define a token with name,symbol,decimal number. You should save the returned values.(genesis、codehash、sensibleId)
let { txid, genesis, codehash, sensibleId } = await ft.genesis({
genesisWif: CoffeeShop.wif,
tokenName: 'COFFEE COIN',
tokenSymbol: 'CC',
decimalNum: 3,
})
Issue 1000000000000 tokens
let { txid } = await ft.issue({
genesis: genesis,
codehash: codehash,
sensibleId: sensibleId,
genesisWif: CoffeeShop.wif,
receiverAddress: CoffeeShop.address,
tokenAmount: '1000000000000',
allowIncreaseIssues: false, //if true then you can issue again
})
Transfer from CoffeShop to Alice and Bob
let { txid } = await ft.transfer({
senderWif: CoffeeShop.wif,
receivers: [
{
address: Alice.address,
amount: '5000000',
},
{
address: Bob.address,
amount: '5000000',
},
],
codehash: codehash,
genesis: genesis,
})
Query token's balance
let { balance, pendingBalance, utxoCount, decimal } = await ft.getBalanceDetail({
codehash,
genesis,
address: Alice.address,
})
import {API_NET, API_TARGET, mvc, NftManager} from "meta-contract"
// Generate new seed , need to memorize this mnemonic or use your own
// let mnemonic = mvc.Mnemonic.fromString(cute siren parrot merit swamp plate federal buddy sing tourist family tragic)
let mnemonic = mvc.Mnemonic.fromRandom()
console.log(mnemonic.toString())
let hdPrivateKey = mnemonic.toHDPrivateKey("", "testnet").deriveChild("m/44'/0'/0'");
console.log(hdPrivateKey.publicKey.toAddress("testnet").toString())
console.log(mnemonic.toHDPrivateKey("", "testnet").deriveChild("m/44'/0'/0'").privateKey.toString());
// use this private key to sign txs later
const privKey = mnemonic.toHDPrivateKey("", "testnet").deriveChild("m/44'/0'/0'").privateKey.toString()
const nftManager = new NftManager({apiTarget: API_TARGET.MVC, network: API_NET.TEST, purse: privKey});
// todo remove authorize in the future
nftManager.api.authorize({authorization: "METASV_KEY"})
Define the NFT with totalSupply You should save the returned values.(genesis、codehash、sensibleId)
const result = await nftManager.genesis({totalSupply: "10"})
console.log(result)
Mint a NFT to CoffeeShop's address metaTxId is created by metaid which stands for NFT State
// todo generate metaId tx before mint
const mintResult = await nftManager.mint({
metaOutputIndex: 0,
metaTxId: "0000000000000000000000000000000000000000000000000000000000000000",
sensibleId: result.sensibleID
});
console.log(mintResult)
Transfer #1 NFT from CoffeShop to Alice
const result = await nftManager.transfer({
codehash: "48d6118692b459fabfc2910105f38dda0645fb57",
genesis: "4920af2eb18493255e662b07d1d80610de7cb2e3",
receiverAddress: "mymqKrpZjY31ABhPXfXjfVcUd78L1LCHEv",
senderWif: privKey,
tokenIndex: "1"
});
console.log(result)
Sell #1 NFT
let { sellTx, tx } = await nft.sell({
codehash,
genesis,
sellerWif: Alice.wif,
tokenIndex: '1',
satoshisPrice: 2000,
})
Cancel Sell #1 NFT
let { unlockCheckTx, tx } = await nft.cancelSell({
codehash,
genesis,
tokenIndex: '1',
sellerWif: Alice.wif,
})
Buy #1 NFT
let { unlockCheckTx, tx } = await nft.buy({
codehash,
genesis,
tokenIndex: '1',
buyerWif: Bob.wif,
})
FAQs
Meta Contract SDK
We found that meta-contract-debug 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.