RAW signing via fireblocks API
See original GitHub issueHello, I’m trying to sign a delegate transaction via the fireblocks RAW signing API.
Their method takes the transaction serialized in hexadecimal.
Here is my code on how to build the transaction:
import { FireblocksSDK, PeerType, TransactionOperation } from 'fireblocks-sdk';
import { coin } from "@cosmjs/proto-signing";
import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { toHex } from "@cosmjs/encoding";
import { makeSignDoc, serializeSignDoc } from "@cosmjs/amino";
const fs = require('fs');
const apiSecret = fs.readFileSync('./fireblocks_secret.key', 'utf8');
const apiKey = 'xxx';
const fireblocks = new FireblocksSDK(apiSecret, apiKey);
(async () => {
const vault = await fireblocks.getVaultAccountsWithPageInfo({
namePrefix: 'account name',
});
const vaultId = vault.accounts[0].id;
try {
const msg = MsgDelegate.fromPartial({
delegatorAddress: 'cosmos19c9fdh488vqjclltwp68jm50ydwyh36jqeatev',
validatorAddress: 'cosmosvaloper178h4s6at5v9cd8m9n7ew3hg7k9eh0s6wptxpcn',
amount: coin('5000', "uatom"),
});
const memo = "Use your power wisely";
const feeAmount = coin(5193, "uatom");
const sendMsg = {
type: "/cosmos.staking.v1beta1.MsgDelegate",
value: msg,
};
const fee = {
amount: [feeAmount],
gas: '300000',
};
const accountNumber = 698081;
const sequence = 0;
const doc = makeSignDoc(
[sendMsg],
fee,
'theta-testnet-001',
memo,
accountNumber,
sequence,
);
const encoded = toHex(serializeSignDoc(doc));
const res = await fireblocks.createTransaction({
assetId: 'ATOM_COS_TEST',
note: 'Automated ATOM staking transaction',
source: {
type: PeerType.VAULT_ACCOUNT,
id: vaultId,
},
operation: TransactionOperation.RAW,
extraParameters: {
rawMessageData: {
messages: [
{
content: encoded,
},
],
},
},
});
console.log('success:', res);
} catch (err) {
console.log(err);
}
})();
Do you see any issue with this code? When submitting this, the transaction is “submitted” for signing but marked as “failed” in fireblocks.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Introduction – Fireblocks API Reference
You can submit transfers via the API and receive real-time insights on transfers; sign all transaction types and messages securely with Raw Signing; ......
Read more >Fireblocks API - Blockdata
You can submit transfers via the API and receive real-time insights on transfers; sign all transaction types and messages securely with Raw Transaction ......
Read more >How to Easily Stake Polkadot DOT via Fireblocks - Blockdaemon
It's easy to stake your DOT tokens to Blockdaemon using Fireblocks. ... allows you to stake DOT via the Fireblocks system using the...
Read more >Fireblocks API - Developer docs, APIs, SDKs, and auth.
Fireblocks API specs, API docs, OpenAPI support, SDKs, GraphQL, developer docs, CLI, IDE plugins, API pricing, developer experience, authentication, ...
Read more >lib.rs - source - Docs.rs
Note: Using FireblocksSigner as a signer WILL NOT take advantage of Fireblock's contextual /// policy engine and will only use the RAW signing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice!
And congratz to ourself for designing this great interface 😄
Yeah I did, we are keeping our repo private for the moment unfortunately.