Skip to content

Instantly share code, notes, and snippets.

@vgrichina
Created April 7, 2020 22:30
Show Gist options
  • Save vgrichina/5aeb86b25643c390b126f341bee12834 to your computer and use it in GitHub Desktop.
Save vgrichina/5aeb86b25643c390b126f341bee12834 to your computer and use it in GitHub Desktop.
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