I wish to be able to create a smart contract taking input from a UI to supply parameters pubKey , prvKey , pubHash for the deployment and minAmount and maxTime to influence the Michelson.

I have the following JS:

function deploy(input_dict){ const tezosNode='https://rpcalpha.tzbeta.net/'; const conseilServer={url:'https://conseil-dev.cryptonomic-infra.tech:443',apiKey:'foo',network:'babylonnet'}; async function contract() { const keystore = { publicKey:input_dict['pubKey'], privateKey:input_dict['prvKey'], publicKeyHash:input_dict['tz1-address'], seed:'', storeType:conseiljs.StoreType.Fundraiser }; const michelson=`parameter (or (or (nat %divisor) (unit %double)) (nat %value)); storage (nat %storedValue); code { DUP; CDR; SWAP; CAR; IF_LEFT { IF_LEFT { PAIR; DUP; CAR; PUSH nat 5; SWAP; COMPARE; GT; IF { } { PUSH string "WrongCondition: params.divisor > 5"; FAILWITH; }; DUP; CDR; DUUP; CAR; EDIV; IF_SOME { CAR; } { PUSH string "division by zero"; FAILWITH; }; SWAP; DROP; NIL operation; PAIR; } { PAIR; DUP; CDR; PUSH nat 2; MUL; SWAP; DROP; NIL operation; PAIR; }; } { PAIR; DUP; CAR; SWAP; DROP; NIL operation; PAIR; }; }`; const storage='"Sample"'; const nodeResult = await conseiljs.TezosNodeWriter.sendContractOriginationOperation(tezosNode, keystore, 0, undefined, false, true, 100000, '', 1000, 100000, michelson, storage, conseiljs.TezosParameterFormat.Michelson); const groupid = nodeResult['operationGroupID'].replace(/\"/g, '').replace(/

/, ''); // clean up RPC output console.log(`Injected operation group id ${groupid}`); const conseilResult = await conseiljs.TezosConseilClient.awaitOperationConfirmation(conseilServer, 'alphanet', groupid, 5); console.log(`Originated contract at ${conseilResult[0].originated_accounts}`); } contract();

Currently when run it produces the following errors:

GET https://rpcalpha.tzbeta.net//chains/main/blocks/head/context/contracts/foo/counter 403 Access to fetch at 'https://rpcalpha.tzbeta.net//chains/main/blocks/head/context/contracts/foo/counter' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. Uncaught (in promise) TypeError: Failed to fetch

However, these I'm sure are less relevant as the code is obviously incorrect in its current form.

This code is heavily derived from the docs of Cryptonomic but I am still left unsure about many elements:

is seed:'' correct?

correct? is storeType:conseiljs.StoreType.Fundraiser correct?

correct? what is the value of const storage='"Sample"' for?

In relation to interacting with the Michelson. It was generated and prettified with SmartPy.io and in the test cases there are inputs supplied which influence storage within the smart contract:

def __init__(self,pubHash,minAmount,maxTime): self.init(fund=sp.bigMap(tkey=sp.TAddress,tvalue=sp.TMutez), owner=pubHash,minAmount=minAmount,maxTime=maxTime,balance=sp.tez(0))

How is this same interaction performed with the Michelson that is statically represented in the JS?

Any help is much appreciated!