This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
btcsecp256k1 "github.com/btcsuite/btcd/btcec" | |
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | |
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" | |
) | |
func BytesToPublicKey(bytes []byte) (cryptotypes.PubKey, error) { | |
pk, err := btcsecp256k1.ParsePubKey(bytes, btcsecp256k1.S256()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { u8aToHex } from '@polkadot/util'; | |
import { getRegistry, methods } from '@substrate/txwrapper-polkadot'; | |
async constructTransaction(from: string, to: string, value: string, tip: number): Promise<{ signingPayload: string }> { | |
const { block } = await rpcToLocalNode('chain_getBlock'); | |
const blockHash = await rpcToLocalNode('chain_getBlockHash'); | |
const genesisHash = await rpcToLocalNode('chain_getBlockHash', [0]); | |
const metadataRpc = await rpcToLocalNode('state_getMetadata'); | |
const { specVersion, transactionVersion, specName } = await rpcToLocalNode( |