@kimafinance/kima-transaction-api 1.5.12 → 1.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,10 +19,25 @@ yarn add @kimafinance/kima-transaction-api
19
19
  import {
20
20
  submitKimaTransferTransaction,
21
21
  submitKimaSwapTransaction,
22
- SupportNetworks,
22
+ SupportedNetworks,
23
23
  CurrencyOptions,
24
+ SubmitOptionsPayload,
24
25
  } from "@kimafinance/kima-transaction-api";
25
26
 
27
+ const transferOptions: SubmitOptionsPayload = {
28
+ signature: "", // approval message signature
29
+ feeId: "", // fee id from fee quote
30
+ chargeFeeAtTarget: false,
31
+ transactionIdSeed: "",
32
+ transactionIdSignature: "",
33
+ permit2: {
34
+ r: "0x...",
35
+ s: "0x...",
36
+ v: 27,
37
+ deadline: 1735689600,
38
+ },
39
+ };
40
+
26
41
  const txResult = await submitKimaTransferTransaction({
27
42
  originAddress: "0x1234123412341234123412341234123412341234",
28
43
  originChain: "ETH",
@@ -37,13 +52,8 @@ const txResult = await submitKimaTransferTransaction({
37
52
  htlcExpirationTimestamp: "",
38
53
  htlcVersion: "",
39
54
  senderPubKey: "",
40
- options: {
41
- signature: "", // required: generated signature from the approval message
42
- feeId: "", // required: id returned from calculated fee in fcs
43
- chargeFeeAtTarget: false // required: wether to deduct fees from origin or target
44
- transactionIdSeed: "", // optional: used in fiat on ramp payments
45
- transactionIdSignature: "", // optional: used to validate transaction idempotency
46
- }
55
+ // Runtime wire format stays a serialized JSON string
56
+ options: JSON.stringify(transferOptions),
47
57
  });
48
58
 
49
59
 
@@ -59,10 +69,16 @@ const txResult = await submitKimaSwapTransaction({
59
69
  fee: "0.3",
60
70
  dex: "uniswap", // required to send empty strings for now
61
71
  slippage: "0.05",
62
- options: {
63
- signature: "", // required: generated signature from the approval message
64
- feeId: "", // required: id returned from calculated fee in fcs
65
- }
72
+ options: JSON.stringify({
73
+ signature: "",
74
+ feeId: "",
75
+ permit2: {
76
+ r: "0x...",
77
+ s: "0x...",
78
+ v: 28,
79
+ deadline: 1735689600,
80
+ },
81
+ } satisfies SubmitOptionsPayload),
66
82
  });
67
83
  ```
68
84
 
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { RequestHtlcReclaimProps, RequestHtlcLockProps, HtlcLockingTransactionResponse, QueryHtlcLockingTransactionParams, RequestTransferTxProps, RequestSwapTxProps, RequestExternalTxProps } from "./types";
2
+ export * from "./types";
2
3
  export declare function getHtlcLockingTransactions({ baseUrl, limit, offset, paginationKey, }: QueryHtlcLockingTransactionParams): Promise<HtlcLockingTransactionResponse>;
3
4
  export declare function HtlcReclaim({ senderAddress, txHash, }: RequestHtlcReclaimProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
4
5
  export declare function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }: RequestHtlcLockProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
package/build/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
@@ -9,6 +23,7 @@ const http_1 = __importDefault(require("http"));
9
23
  const https_1 = __importDefault(require("https"));
10
24
  const url_1 = require("url");
11
25
  const common_1 = require("./kima/common");
26
+ __exportStar(require("./types"), exports);
12
27
  const requestJson = async (url) => {
13
28
  return new Promise((resolve, reject) => {
14
29
  const parsed = new url_1.URL(url);
package/build/types.d.ts CHANGED
@@ -25,6 +25,21 @@ export declare enum CurrencyOptions {
25
25
  EUR = "EUR",
26
26
  USD = "USD"
27
27
  }
28
+ export interface Permit2SubmitOptions {
29
+ r: string;
30
+ s: string;
31
+ v: number;
32
+ deadline: number;
33
+ }
34
+ export interface SubmitOptionsPayload {
35
+ signature?: string;
36
+ feeId?: string;
37
+ chargeFeeAtTarget?: boolean;
38
+ transactionIdSeed?: string;
39
+ transactionIdSignature?: string;
40
+ permit2?: Permit2SubmitOptions;
41
+ [key: string]: unknown;
42
+ }
28
43
  export interface RequestHtlcReclaimProps {
29
44
  senderAddress: string;
30
45
  txHash: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimafinance/kima-transaction-api",
3
- "version": "1.5.12",
3
+ "version": "1.5.13",
4
4
  "description": "A wrapper around Kima's API, enabling sending and monitoring transactions (Beta version)",
5
5
  "repository": "https://github.com/kima-finance/kima-transaction-api",
6
6
  "author": "",
package/src/index.ts CHANGED
@@ -24,6 +24,8 @@ import {
24
24
  RequestExternalTxProps,
25
25
  } from "./types";
26
26
 
27
+ export * from "./types";
28
+
27
29
  const requestJson = async <T>(url: string): Promise<T> => {
28
30
  return new Promise((resolve, reject) => {
29
31
  const parsed = new URL(url);
package/src/types.ts CHANGED
@@ -28,6 +28,23 @@ export enum CurrencyOptions {
28
28
  USD = "USD",
29
29
  }
30
30
 
31
+ export interface Permit2SubmitOptions {
32
+ r: string;
33
+ s: string;
34
+ v: number; // 27 | 28
35
+ deadline: number; // unix timestamp (seconds)
36
+ }
37
+
38
+ export interface SubmitOptionsPayload {
39
+ signature?: string;
40
+ feeId?: string;
41
+ chargeFeeAtTarget?: boolean;
42
+ transactionIdSeed?: string;
43
+ transactionIdSignature?: string;
44
+ permit2?: Permit2SubmitOptions;
45
+ [key: string]: unknown;
46
+ }
47
+
31
48
  export interface RequestHtlcReclaimProps {
32
49
  senderAddress: string;
33
50
  txHash: string;
@@ -56,6 +73,7 @@ export interface RequestTransferTxProps {
56
73
  htlcExpirationTimestamp?: string;
57
74
  htlcVersion?: string;
58
75
  senderPubKey?: Uint8Array;
76
+ // JSON-serialized SubmitOptionsPayload
59
77
  options: string;
60
78
  }
61
79
 
@@ -76,6 +94,7 @@ export interface RequestSwapTxProps {
76
94
  htlcCreationVout?: number;
77
95
  htlcVersion?: string;
78
96
  senderPubKey?: Uint8Array;
97
+ // JSON-serialized SubmitOptionsPayload
79
98
  options: string;
80
99
  }
81
100
 
@@ -88,6 +107,7 @@ export interface RequestExternalTxProps {
88
107
  targetSymbol: CurrencyOptions;
89
108
  amount: string;
90
109
  fee: string;
110
+ // JSON-serialized SubmitOptionsPayload
91
111
  options: string;
92
112
  }
93
113