Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public string(): string {
// @ts-ignore
const grouped = bech32.toWords(this.payload);
return bech32.encode(AddressV1.prefix(), grouped);
}
/**
* (C) Copyright 2019
* Caleb James DeLisle
*
* SPDX-License-Identifier: (LGPL-2.1-only OR LGPL-3.0-only)
*/
const Bech32 = require('bech32');
const addr = process.argv.pop();
try {
const b = Bech32.decode(addr);
if (b.prefix === 'bc') {
console.log(Bech32.encode('pkt', b.words));
} else if (b.prefix === 'pkt') {
console.log(Bech32.encode('bc', b.words));
} else {
console.log("I don't understand prefix: [" + b.prefix + "]");
}
} catch (e) {
console.log(e);
console.log("Usage: ptc2pkt ");
console.log("prints the equivilent pkt address");
}
MsgBeginRedelegate.prototype.GetSignBytes = function () {
let msg = {
delegator_address: BECH32.encode(Config.cosmos.bech32.accAddr,this.DelegatorAddress),
validator_src_address: BECH32.encode(Config.cosmos.bech32.valAddr,this.ValidatorSrcAddress),
validator_dst_address: BECH32.encode(Config.cosmos.bech32.valAddr,this.ValidatorDstAddress),
amount: this.Amount
};
let sortMsg = Utils.sortObjectKeys(msg);
return Amino.MarshalJSON(this.type, sortMsg)
};
function bech32ify(address, prefix) {
const words = bech32.toWords(address)
return bech32.encode(prefix, words)
}
return (words) => ({
tagCode: parseInt(tagCode),
words: bech32.encode('unknown', words, Number.MAX_SAFE_INTEGER)
})
}
MsgDelegate.prototype.GetSignBytes = function () {
let msg = {
delegator_address: BECH32.encode(Config.cosmos.bech32.accAddr,this.DelegatorAddress),
validator_address: BECH32.encode(Config.cosmos.bech32.valAddr,this.ValidatorAddress),
amount: this.Amount
};
let sortMsg = Utils.sortObjectKeys(msg);
return Amino.MarshalJSON(this.type, sortMsg)
};
function toBech32(data, version, prefix) {
const words = bech32.toWords(data);
words.unshift(version);
return bech32.encode(prefix, words);
}
exports.toBech32 = toBech32;
static toBech32(prefix, str) {
let strByte = BECH32.toWords(Buffer.from(str, 'hex'));
return BECH32.encode(prefix, strByte)
}
MsgWithdrawDelegatorReward.prototype.GetDisplayContent = function (){
let delegatorAddress = BECH32.encode(Config.cosmos.bech32.accAddr,this.DelegatorAddress);
let validatorAddress = BECH32.encode(Config.cosmos.bech32.valAddr,this.ValidatorAddress);
return {
i18n_tx_type:"i18n_withdraw_delegation_reward",
i18n_delegator_addr:delegatorAddress,
i18n_validator_addr:validatorAddress,
}
};
lazy.prop(o, 'address', () => {
if (!o.hash) return;
const words = bech32.toWords(o.hash);
words.unshift(0x00);
return bech32.encode(network!.bech32, words);
});
lazy.prop(o, 'hash', () => {