Copy const nearAPI = require ( 'near-api-js' )
const main = async () => {
const config = {
networkId : 'testnet' ,
nodeUrl : 'https://rpc.testnet.near.org' ,
walletUrl : 'https://wallet.testnet.near.org' ,
appName : 'Paras Testnet' ,
contractName : `paras-token-v2.testnet`
}
try {
// Initializing nearAPI
// Login and init contract
const keyStore = new nearAPI . keyStores .UnencryptedFileSystemKeyStore (
` ${ process . env . HOME } /.near-credentials/`
)
const connection = await nearAPI .connect ({
deps : {
keyStore : keyStore ,
} ,
... config ,
})
const account_id = 'orang.testnet'
const account = await connection .account (account_id)
const contract = await new nearAPI .Contract (
account ,
config .contractName ,
{
changeMethods : [
'nft_create_series'
] ,
}
)
const formattedParams = {
token_metadata : {
title : 'Dark' ,
media : 'bafybeifdbvb6yzajogbe4dbn3bgxoli3sp7ol7upfmu2givpvbwufydthu' ,
reference : 'bafybeifvzitvju4ftwnkf7w7yakz7i5colcey223uk2ui4t5z3ss7l2od4' ,
copies : 100
} ,
price : null ,
royalty : {
[account_id] : 1000
}
}
const ret = await contract .nft_create_series (
formattedParams ,
300000000000000 , // attached GAS
"8540000000000000000000"
)
console .log (ret)
} catch (err) {
throw err
}
}
main ()