-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
With cennznet 2.1.0 type definitions are no longer necessary (except for backwards compatibility and possibly TS definition generation)
using @polkadot/api latest & this snippet is enough to read and sign transactions successfully on CENNZnet:
await ApiPromise.create({
provider,
signedExtensions: {
'ChargeTransactionPayment': {
extrinsic: {
tip: 'Compact<Balance>',
feeExchange: 'Option<u32>',
},
payload: {},
}
}
}additionally, this function should be added to convert Ethereum addresses to CENNZnet 32 byte format
function cvmToAddress(evmAddress) {
var message = utils.stringToU8a('cvm:');
message = utils.u8aConcat(message, new Array(7).fill(0), utils.hexToU8a(evmAddress));
let checkSum = message.reduce((a, b) => a ^ b, 0);
message = utils.u8aConcat(message, new Array(1).fill(checkSum));
return utilCrypto.encodeAddress(message, 42);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels