Skip to content

Commit

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

* breaking change to create a v4

* update examples

* fix erros

* fix version

---------

Co-authored-by: Kiln Bot <[email protected]>
Co-authored-by: Martin Saldinger <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent 0ddb8a3 commit 140c3d0
Show file tree
Hide file tree
Showing 10 changed files with 716 additions and 348 deletions.
4 changes: 2 additions & 2 deletions examples/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const vault: Integration = {
try {
console.log('crafting...');
const tx = await k.client.POST(
'/v1/eth/transaction/stake',
'/eth/transaction/stake',
{
body: {
account_id: process.env.KILN_ACCOUNT_ID,
Expand All @@ -40,7 +40,7 @@ try {
console.log('signing...');
const signResponse = await k.fireblocks.signEthTx(vault, tx.data.data, "ETH_TEST6");
console.log('broadcasting...');
const broadcastedTx = await k.client.POST("/v1/eth/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/eth/transaction/broadcast", {
body: {
tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
}
Expand Down
4 changes: 2 additions & 2 deletions examples/kava.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const vault: FireblocksIntegration = {
try {
console.log('crafting...');
const tx = await k.client.POST(
'/v1/kava/transaction/stake',
'/kava/transaction/stake',
{
body: {
account_id: process.env.KILN_ACCOUNT_ID as string,
Expand All @@ -36,7 +36,7 @@ try {
const signResponse = await k.fireblocks.signKavaTx(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("/v1/kava/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/kava/transaction/broadcast", {
body: {
tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
}
Expand Down
8 changes: 4 additions & 4 deletions examples/near.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Kiln } from "../src/kiln";
import type { Integration } from "../lib/types/integrations";
import type { FireblocksIntegration } from "../src/fireblocks";
import fs from "node:fs";
import 'dotenv/config'

Expand All @@ -11,7 +11,7 @@ const k = new Kiln({
apiToken: process.env.KILN_API_KEY,
});

const vault: Integration = {
const vault: FireblocksIntegration = {
provider: 'fireblocks',
fireblocksApiKey: process.env.FIREBLOCKS_API_KEY,
fireblocksSecretKey: apiSecret,
Expand All @@ -21,7 +21,7 @@ const vault: Integration = {
try {
console.log('crafting...');
const tx = await k.client.POST(
'/v1/near/transaction/stake',
'/near/transaction/stake',
{
body: {
account_id: 'd3f1b917-72b1-4982-a4dd-93fce579a708',
Expand All @@ -34,7 +34,7 @@ try {
console.log('signing...');
const signResponse = await k.fireblocks.signNearTx(vault, tx.data.data, "NEAR_TEST");
console.log('broadcasting...');
const broadcastedTx = await k.client.POST("/v1/near/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/near/transaction/broadcast", {
body: {
signed_tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
}
Expand Down
4 changes: 2 additions & 2 deletions examples/noble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ try {
// });
// console.log(getCosmosAddress('02d92b48d3e9ef34f2016eac7857a02768c88e30aea7a2366bc5ba032a22eceb8b', 'noble'));
const tx = await k.client.POST(
'/v1/noble/transaction/burn-usdc',
'/noble/transaction/burn-usdc',
{
body: {
pubkey: '02d92b48d3e9ef34f2016eac7857a02768c88e30aea7a2366bc5ba032a22eceb8b',
Expand All @@ -44,7 +44,7 @@ try {
const signResponse = await k.fireblocks.signNobleTx(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("/v1/noble/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/noble/transaction/broadcast", {
body: {
tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
}
Expand Down
4 changes: 2 additions & 2 deletions examples/sol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const vault: FireblocksIntegration = {
try {
console.log('crafting...');
const tx = await k.client.POST(
'/v1/sol/transaction/stake',
'/sol/transaction/stake',
{
body: {
account_id: 'd3f1b917-72b1-4982-a4dd-93fce579a708',
Expand All @@ -36,7 +36,7 @@ try {
const signResponse = await k.fireblocks.signSolTx(vault, tx.data.data, "SOL_TEST");
if(!signResponse.signed_tx?.data.signed_tx_serialized) throw new Error('No signed_tx in response');
console.log('broadcasting...');
const broadcastedTx = await k.client.POST("/v1/sol/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/sol/transaction/broadcast", {
body: {
tx_serialized: signResponse.signed_tx.data.signed_tx_serialized
}
Expand Down
4 changes: 2 additions & 2 deletions examples/ton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const vault: FireblocksIntegration = {
try {
console.log('crafting...');
const tx = await k.client.POST(
'/v1/ton/transaction/stake-ton-whales-pool',
'/ton/transaction/stake-ton-whales-pool',
{
body: {
account_id: process.env.KILN_ACCOUNT_ID as string,
Expand All @@ -48,7 +48,7 @@ try {
const signResponse = await k.fireblocks.signTonTx(vault, tx.data.data, "TON");
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("/v1/ton/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/ton/transaction/broadcast", {
body: {
tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
}
Expand Down
4 changes: 2 additions & 2 deletions examples/xtz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const vault: FireblocksIntegration = {
try {
console.log('crafting...');
const tx = await k.client.POST(
'/v1/xtz/transaction/delegate',
'/xtz/transaction/delegate',
{
body: {
account_id: 'd3f1b917-72b1-4982-a4dd-93fce579a708',
Expand All @@ -35,7 +35,7 @@ try {
const signResponse = await k.fireblocks.signXtzTx(vault, tx.data.data, "XTZ_TEST");
if(!signResponse.signed_tx?.data.signed_tx_serialized) throw new Error('No signed_tx in response');
console.log('broadcasting...');
const broadcastedTx = await k.client.POST("/v1/xtz/transaction/broadcast", {
const broadcastedTx = await k.client.POST("/xtz/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": "3.1.24",
"version": "4.0.0",
"autor": "Kiln <[email protected]> (https://kiln.fi)",
"license": "BUSL-1.1",
"description": "JavaScript sdk for Kiln API",
Expand Down
36 changes: 18 additions & 18 deletions src/fireblocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/sol/transaction/prepare', {
const preparedTx = await this.client.POST('/sol/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signatures: signatures,
Expand Down Expand Up @@ -166,7 +166,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/ada/transaction/prepare', {
const preparedTx = await this.client.POST('/ada/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signed_messages: signedMessages,
Expand Down Expand Up @@ -218,7 +218,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/atom/transaction/prepare', {
const preparedTx = await this.client.POST('/atom/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -271,7 +271,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/dydx/transaction/prepare', {
const preparedTx = await this.client.POST('/dydx/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -326,7 +326,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/fet/transaction/prepare', {
const preparedTx = await this.client.POST('/fet/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -379,7 +379,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/inj/transaction/prepare', {
const preparedTx = await this.client.POST('/inj/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -434,7 +434,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/kava/transaction/prepare', {
const preparedTx = await this.client.POST('/kava/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -489,7 +489,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/noble/transaction/prepare', {
const preparedTx = await this.client.POST('/noble/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -542,7 +542,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/osmo/transaction/prepare', {
const preparedTx = await this.client.POST('/osmo/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -595,7 +595,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/tia/transaction/prepare', {
const preparedTx = await this.client.POST('/tia/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -650,7 +650,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/zeta/transaction/prepare', {
const preparedTx = await this.client.POST('/zeta/transaction/prepare', {
body: {
pubkey: tx.pubkey,
tx_body: tx.tx_body,
Expand Down Expand Up @@ -695,7 +695,7 @@ export class FireblocksService {
const fbTx = await fbSigner.sign(payload, 'DOT', fbNote);
const signature = `0x00${fbTx.signedMessages?.[0]?.signature.fullSig}`;

const preparedTx = await this.client.POST('/v1/dot/transaction/prepare', {
const preparedTx = await this.client.POST('/dot/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signature: signature,
Expand Down Expand Up @@ -738,7 +738,7 @@ export class FireblocksService {
const fbTx = await fbSigner.sign(payload, 'KSM', fbNote);
const signature = `0x00${fbTx.signedMessages?.[0]?.signature.fullSig}`;

const preparedTx = await this.client.POST('/v1/ksm/transaction/prepare', {
const preparedTx = await this.client.POST('/ksm/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signature: signature,
Expand Down Expand Up @@ -791,7 +791,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/eth/transaction/prepare', {
const preparedTx = await this.client.POST('/eth/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
r: `0x${signature.r}`,
Expand Down Expand Up @@ -867,7 +867,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/pol/transaction/prepare', {
const preparedTx = await this.client.POST('/pol/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
r: `0x${signature.r}`,
Expand Down Expand Up @@ -938,7 +938,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/ton/transaction/prepare', {
const preparedTx = await this.client.POST('/ton/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signature: signature,
Expand Down Expand Up @@ -987,7 +987,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/xtz/transaction/prepare', {
const preparedTx = await this.client.POST('/xtz/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signature: signature,
Expand Down Expand Up @@ -1035,7 +1035,7 @@ export class FireblocksService {
throw new Error('Fireblocks signature is missing');
}

const preparedTx = await this.client.POST('/v1/near/transaction/prepare', {
const preparedTx = await this.client.POST('/near/transaction/prepare', {
body: {
unsigned_tx_serialized: tx.unsigned_tx_serialized,
signature: signature,
Expand Down
Loading

0 comments on commit 140c3d0

Please sign in to comment.