Created
April 7, 2020 22:30
-
-
Save vgrichina/5aeb86b25643c390b126f341bee12834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function deploy(options) { | |
const configPath = process.cwd() + '/src/config'; | |
const config = require(configPath)(process.env.NODE_ENV || 'development'); | |
const near = await nearlib.connect({...config, deps: { keyStore: new UnencryptedFileSystemKeyStore('./neardev') } }); | |
const contractData = [...fs.readFileSync(options.wasmFile)]; | |
const account = await near.account(options.accountId); | |
await account.signAndSendTransaction(options.accountId, [ | |
deployContract(contractData), | |
// TODO: Use whatever actual params need to be for functionCall or include any other actions as well | |
functionCall(methodName, Buffer.from(JSON.stringify(args)), gas || DEFAULT_FUNC_CALL_GAS, amount), | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment