Skip to content

Commit

Permalink
Update OpenAPI schema (#183)
Browse files Browse the repository at this point in the history
* Update OpenAPI schema

* rename MANTRA -> OM

* bump version

* fix example

---------

Co-authored-by: Kiln Bot <[email protected]>
Co-authored-by: Martin Saldinger <[email protected]>
  • Loading branch information
3 people authored Jan 3, 2025
1 parent 47264ea commit f580c09
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 192 deletions.
6 changes: 3 additions & 3 deletions examples/mantra.ts → examples/om.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const vault: FireblocksIntegration = {

try {
console.log('crafting...');
const tx = await k.client.POST('/mantra/transaction/stake', {
const tx = await k.client.POST('/om/transaction/stake', {
body: {
account_id: process.env.KILN_ACCOUNT_ID as string,
pubkey: '028dfa6f41c655e38a0f8f2e3f3aa3e1246907a9bb299933f11996e2a345a21e10',
Expand All @@ -32,10 +32,10 @@ try {
console.log(tx);
console.log('signing...');
if (!tx.data?.data) throw new Error('No data in response');
const signResponse = await k.fireblocks.signMantraTx(vault, tx.data.data);
const signResponse = await k.fireblocks.signOmTx(vault, tx.data.data);
console.log('broadcasting...');
if (!signResponse.signed_tx?.data?.signed_tx_serialized) throw new Error('No signed_tx in response');
const broadcastedTx = await k.client.POST('/mantra/transaction/broadcast', {
const broadcastedTx = await k.client.POST('/om/transaction/broadcast', {
body: {
tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kilnfi/sdk",
"version": "4.0.5",
"version": "4.0.6",
"autor": "Kiln <[email protected]> (https://kiln.fi)",
"license": "BUSL-1.1",
"description": "JavaScript sdk for Kiln API",
Expand Down
12 changes: 6 additions & 6 deletions src/fireblocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,14 @@ export class FireblocksService {
}

/**
* Sign a MANTRA transaction on Fireblocks
* Sign a OM transaction on Fireblocks
*/
async signMantraTx(
async signOmTx(
integration: FireblocksIntegration,
tx: components['schemas']['MANTRAUnsignedTx'] | components['schemas']['MANTRAStakeUnsignedTx'],
tx: components['schemas']['OMUnsignedTx'] | components['schemas']['OMStakeUnsignedTx'],
note?: string,
): Promise<{
signed_tx: { data: components['schemas']['MANTRASignedTx'] };
signed_tx: { data: components['schemas']['OMSignedTx'] };
fireblocks_tx: TransactionResponse;
}> {
const payload = {
Expand All @@ -372,15 +372,15 @@ export class FireblocksService {
};

const fbSigner = this.getSigner(integration);
const fbNote = note ? note : 'MANTRA tx from @kilnfi/sdk';
const fbNote = note ? note : 'OM tx from @kilnfi/sdk';
const fbTx = await fbSigner.sign(payload, undefined, fbNote);
const signature = fbTx.signedMessages?.[0]?.signature.fullSig;

if (!signature) {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/mantra/transaction/prepare', {
const preparedTx = await this.client.POST('/om/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down
Loading

0 comments on commit f580c09

Please sign in to comment.