constructContractOriginationOperation static method
OperationModel
constructContractOriginationOperation(
- KeyStoreModel keyStore,
- int amount,
- String delegate,
- String code,
- String storage,
- TezosParameterFormat codeFormat,
- int counter,
Implementation
static OperationModel constructContractOriginationOperation(
KeyStoreModel keyStore,
int amount,
String delegate,
String code,
String storage,
TezosParameterFormat codeFormat,
int counter) {
var parsedCode;
var parsedStorage;
if (codeFormat == TezosParameterFormat.Michelson) {
parsedCode = jsonDecode(
TezosLanguageUtil.translateMichelsonScriptToMicheline(code)!);
parsedStorage = jsonDecode(
TezosLanguageUtil.translateMichelsonExpressionToMicheline(storage)!);
} else if (codeFormat == TezosParameterFormat.Micheline) {
parsedCode = jsonDecode(code);
parsedStorage = jsonDecode(storage);
}
return OperationModel(
kind: 'origination',
source: keyStore.publicKeyHash,
counter: counter,
amount: amount.toString(),
delegate: delegate,
script: {
'code': parsedCode,
'storage': parsedStorage,
},
);
}