@hot-pot/hotpot-sdk-ts 0.0.1 → 0.0.2
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/dist/apiClient.d.ts +3 -2
- package/dist/apiClient.js +3 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/apiClient.ts +4 -0
- package/src/types.ts +2 -0
package/dist/apiClient.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import type { CreateIntentData, IntentStatus, Network, PaginatedResponse, PublicSwapWithAdditionalInfo, Quote, SignedApproval, SwapType, Token } from './types';
|
|
2
|
+
import type { CreateIntentData, DepositType, IntentStatus, Network, PaginatedResponse, PublicSwapWithAdditionalInfo, Quote, SignedApproval, SwapType, Token } from './types';
|
|
3
3
|
export declare class HotPotApiClient {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(apiUrl: string, apiKey: string, axiosInstance?: AxiosInstance, config?: AxiosRequestConfig);
|
|
@@ -13,9 +13,10 @@ export declare class HotPotApiClient {
|
|
|
13
13
|
* @param slippageBps The slippage in basis points
|
|
14
14
|
* @param swapType The type of swap
|
|
15
15
|
* @param retailUserId Optional retail user ID
|
|
16
|
+
* @param depositType The type of deposit to perform (escrowed/direct)
|
|
16
17
|
* @returns A promise that resolves to the Quote object
|
|
17
18
|
*/
|
|
18
|
-
getQuote(sourceChain: number, sourceToken: string, destChain: number, destToken: string, amount: number, slippageBps: bigint, swapType: SwapType, retailUserId
|
|
19
|
+
getQuote(sourceChain: number, sourceToken: string, destChain: number, destToken: string, amount: number, slippageBps: bigint, swapType: SwapType, retailUserId: string | null | undefined, depositType: DepositType): Promise<Quote>;
|
|
19
20
|
/**
|
|
20
21
|
* Creates a new swap intent with the provided details
|
|
21
22
|
* @param quoteId The quote ID to use for the intent
|
package/dist/apiClient.js
CHANGED
|
@@ -22,9 +22,10 @@ export class HotPotApiClient {
|
|
|
22
22
|
* @param slippageBps The slippage in basis points
|
|
23
23
|
* @param swapType The type of swap
|
|
24
24
|
* @param retailUserId Optional retail user ID
|
|
25
|
+
* @param depositType The type of deposit to perform (escrowed/direct)
|
|
25
26
|
* @returns A promise that resolves to the Quote object
|
|
26
27
|
*/
|
|
27
|
-
async getQuote(sourceChain, sourceToken, destChain, destToken, amount, slippageBps, swapType, retailUserId = null) {
|
|
28
|
+
async getQuote(sourceChain, sourceToken, destChain, destToken, amount, slippageBps, swapType, retailUserId = null, depositType) {
|
|
28
29
|
const response = await this.client.post('/quotes/best', {
|
|
29
30
|
source_chain: sourceChain,
|
|
30
31
|
source_token: sourceToken,
|
|
@@ -34,6 +35,7 @@ export class HotPotApiClient {
|
|
|
34
35
|
slippage_bps: slippageBps.toString(),
|
|
35
36
|
swap_type: swapType,
|
|
36
37
|
retail_user_id: retailUserId,
|
|
38
|
+
deposit_type: depositType,
|
|
37
39
|
});
|
|
38
40
|
return response.data;
|
|
39
41
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface Quote {
|
|
|
40
40
|
slippage_bps: string;
|
|
41
41
|
expiry: number;
|
|
42
42
|
swap_type: SwapType;
|
|
43
|
+
deposit_type: DepositType;
|
|
43
44
|
}
|
|
44
45
|
export interface CreateIntentData {
|
|
45
46
|
intent_id: string;
|
|
@@ -49,6 +50,7 @@ export interface CreateIntentData {
|
|
|
49
50
|
params_to_sign: Permit2ApprovalToSign | HtlcApprovalToSign | CosignApprovalToSign;
|
|
50
51
|
}
|
|
51
52
|
export type ApprovalType = 'permit2' | 'psbt' | 'cosign';
|
|
53
|
+
export type DepositType = 'escrowed' | 'direct';
|
|
52
54
|
export interface CosignData {
|
|
53
55
|
transaction: string;
|
|
54
56
|
user_address: string;
|
package/package.json
CHANGED
package/src/apiClient.ts
CHANGED
|
@@ -3,6 +3,7 @@ import axios from 'axios';
|
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
5
|
CreateIntentData,
|
|
6
|
+
DepositType,
|
|
6
7
|
IntentStatus,
|
|
7
8
|
Network,
|
|
8
9
|
PaginatedResponse,
|
|
@@ -43,6 +44,7 @@ export class HotPotApiClient {
|
|
|
43
44
|
* @param slippageBps The slippage in basis points
|
|
44
45
|
* @param swapType The type of swap
|
|
45
46
|
* @param retailUserId Optional retail user ID
|
|
47
|
+
* @param depositType The type of deposit to perform (escrowed/direct)
|
|
46
48
|
* @returns A promise that resolves to the Quote object
|
|
47
49
|
*/
|
|
48
50
|
async getQuote(
|
|
@@ -54,6 +56,7 @@ export class HotPotApiClient {
|
|
|
54
56
|
slippageBps: bigint,
|
|
55
57
|
swapType: SwapType,
|
|
56
58
|
retailUserId: string | null = null,
|
|
59
|
+
depositType: DepositType,
|
|
57
60
|
): Promise<Quote> {
|
|
58
61
|
const response: AxiosResponse<Quote> = await this.client.post('/quotes/best', {
|
|
59
62
|
source_chain: sourceChain,
|
|
@@ -64,6 +67,7 @@ export class HotPotApiClient {
|
|
|
64
67
|
slippage_bps: slippageBps.toString(),
|
|
65
68
|
swap_type: swapType,
|
|
66
69
|
retail_user_id: retailUserId,
|
|
70
|
+
deposit_type: depositType,
|
|
67
71
|
});
|
|
68
72
|
|
|
69
73
|
return response.data;
|
package/src/types.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface Quote {
|
|
|
43
43
|
slippage_bps: string;
|
|
44
44
|
expiry: number;
|
|
45
45
|
swap_type: SwapType;
|
|
46
|
+
deposit_type: DepositType;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export interface CreateIntentData {
|
|
@@ -54,6 +55,7 @@ export interface CreateIntentData {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
export type ApprovalType = 'permit2' | 'psbt' | 'cosign';
|
|
58
|
+
export type DepositType = 'escrowed' | 'direct';
|
|
57
59
|
|
|
58
60
|
export interface CosignData {
|
|
59
61
|
transaction: string;
|