Running on Version 81.0.4004.0 (Developer Build) (64-bit) chromium. Also tried on latest stable chrome, and chromium. On Ubuntu 18.0.4.
With chrome://flags/#enable-experimental-webassembly-features for BigInt support for i64 types
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
</head>
<body>
<script>
// Source C++ file for .wasm build:
// https://github.com/theblockstalk/eosio-sovereign-contract-poc/tree/b726b0bc7f1881704f8c39ed40e623e39ff661da/contract
//
// This is compiled to wasm using the eosio.cdt tool. The eosio team has reported that the resulting wasm file is compatible with the wasm standard
// https://github.com/EOSIO/eosio.cdt
// This needs to be served over http. Source
// https://github.com/theblockstalk/eosio-sovereign-contract-poc/blob/b726b0bc7f1881704f8c39ed40e623e39ff661da/build/sovereign.wasm
const CONTRACT_WASM_FILE = fetch('../build/sovereign.wasm');
let importObject = {
env: {
memoryBase: 0,
memory: new WebAssembly.Memory({
initial: 256
}),
action_data_size: function() {
console.log('action_data_size');
const i32a = 11;
return i32a;
},
eosio_assert: function(i32a, i32b) {
console.log('eosio_assert');
console.log(i32a);
console.log(i32b);
},
memset: function(i32a, i32b, i32c) {
console.log('memset');
console.log(i32a);
console.log(i32b);
console.log(i32c);
const i32d = 12;
return i32d;
},
read_action_data: function(i32a, i32b) {
console.log('read_action_data');
console.log(i32a);
console.log(i32b);
const i32c = 13;
return i32c;
},
eosio_assert_code: function(condition /*i32*/, error_code /*i64*/) {
console.log('eosio_assert_code');
console.log(condition);
console.log(error_code);
}
}
};
const typedArray = new Uint8Array(CONTRACT_WASM_FILE);
WebAssembly.instantiate(typedArray, importObject).then(module => {
module.instance.exports.apply(
Uint8Array("sovereign"),
Uint8Array("dablockstalk"),
Uint8Array("hi")
);
});
</script>
</body>
</html>
I'm not sure where the BigInt is being parsed as I cannot see any references to my code, or chromium code.