@gobob/bob-sdk 4.3.6 → 4.3.8
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/gateway/base-client.d.ts +4 -0
- package/dist/gateway/base-client.js +29 -0
- package/dist/gateway/base-client.js.map +1 -0
- package/dist/gateway/client.d.ts +4 -11
- package/dist/gateway/client.js +9 -28
- package/dist/gateway/client.js.map +1 -1
- package/dist/gateway/index.d.ts +4 -4
- package/dist/gateway/index.js +9 -7
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/layerzero.d.ts +12 -17
- package/dist/gateway/layerzero.js +270 -70
- package/dist/gateway/layerzero.js.map +1 -1
- package/dist/gateway/tokens.d.ts +1 -1
- package/dist/gateway/tokens.js +16 -3
- package/dist/gateway/tokens.js.map +1 -1
- package/dist/gateway/types/bitcoin.d.ts +10 -0
- package/dist/gateway/types/bitcoin.js +3 -0
- package/dist/gateway/types/bitcoin.js.map +1 -0
- package/dist/gateway/types/crosschain-swap.d.ts +34 -0
- package/dist/gateway/types/crosschain-swap.js +3 -0
- package/dist/gateway/types/crosschain-swap.js.map +1 -0
- package/dist/gateway/types/defiLlama.d.ts +11 -0
- package/dist/gateway/types/defiLlama.js +3 -0
- package/dist/gateway/types/defiLlama.js.map +1 -0
- package/dist/gateway/types/index.d.ts +11 -0
- package/dist/gateway/types/index.js +28 -0
- package/dist/gateway/types/index.js.map +1 -0
- package/dist/gateway/types/layerzero.d.ts +90 -0
- package/dist/gateway/types/layerzero.js +3 -0
- package/dist/gateway/types/layerzero.js.map +1 -0
- package/dist/gateway/types/offramp.d.ts +96 -0
- package/dist/gateway/types/offramp.js +3 -0
- package/dist/gateway/types/offramp.js.map +1 -0
- package/dist/gateway/types/onramp.d.ts +96 -0
- package/dist/gateway/types/onramp.js +3 -0
- package/dist/gateway/types/onramp.js.map +1 -0
- package/dist/gateway/types/order.d.ts +77 -0
- package/dist/gateway/types/order.js +10 -0
- package/dist/gateway/types/order.js.map +1 -0
- package/dist/gateway/types/quote.d.ts +34 -0
- package/dist/gateway/{types.js → types/quote.js} +1 -1
- package/dist/gateway/types/quote.js.map +1 -0
- package/dist/gateway/types/strategy.d.ts +64 -0
- package/dist/gateway/types/strategy.js +3 -0
- package/dist/gateway/types/strategy.js.map +1 -0
- package/dist/gateway/types/token.d.ts +24 -0
- package/dist/gateway/types/token.js +3 -0
- package/dist/gateway/types/token.js.map +1 -0
- package/dist/gateway/types/utils.d.ts +1 -0
- package/dist/gateway/types/utils.js +3 -0
- package/dist/gateway/types/utils.js.map +1 -0
- package/dist/gateway/{utils.d.ts → utils/common.d.ts} +3 -4
- package/dist/gateway/{utils.js → utils/common.js} +11 -12
- package/dist/gateway/utils/common.js.map +1 -0
- package/dist/gateway/utils/index.d.ts +2 -0
- package/dist/gateway/utils/index.js +19 -0
- package/dist/gateway/utils/index.js.map +1 -0
- package/dist/gateway/utils/layerzero.d.ts +3 -0
- package/dist/gateway/utils/layerzero.js +27 -0
- package/dist/gateway/utils/layerzero.js.map +1 -0
- package/package.json +1 -1
- package/dist/gateway/types.d.ts +0 -379
- package/dist/gateway/types.js.map +0 -1
- package/dist/gateway/utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defiLlama.js","sourceRoot":"","sources":["../../../src/gateway/types/defiLlama.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './bitcoin';
|
|
2
|
+
export * from './crosschain-swap';
|
|
3
|
+
export * from './defiLlama';
|
|
4
|
+
export * from './layerzero';
|
|
5
|
+
export * from './offramp';
|
|
6
|
+
export * from './onramp';
|
|
7
|
+
export * from './order';
|
|
8
|
+
export * from './quote';
|
|
9
|
+
export * from './strategy';
|
|
10
|
+
export * from './token';
|
|
11
|
+
export * from './utils';
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bitcoin"), exports);
|
|
18
|
+
__exportStar(require("./crosschain-swap"), exports);
|
|
19
|
+
__exportStar(require("./defiLlama"), exports);
|
|
20
|
+
__exportStar(require("./layerzero"), exports);
|
|
21
|
+
__exportStar(require("./offramp"), exports);
|
|
22
|
+
__exportStar(require("./onramp"), exports);
|
|
23
|
+
__exportStar(require("./order"), exports);
|
|
24
|
+
__exportStar(require("./quote"), exports);
|
|
25
|
+
__exportStar(require("./strategy"), exports);
|
|
26
|
+
__exportStar(require("./token"), exports);
|
|
27
|
+
__exportStar(require("./utils"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gateway/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,8CAA4B;AAC5B,8CAA4B;AAC5B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
interface LayerZeroMessagePathway {
|
|
3
|
+
srcEid: number;
|
|
4
|
+
dstEid: number;
|
|
5
|
+
sender: LayerZeroMessageSender;
|
|
6
|
+
receiver: LayerZeroMessageReceiver;
|
|
7
|
+
id: string;
|
|
8
|
+
nonce: number;
|
|
9
|
+
}
|
|
10
|
+
interface LayerZeroMessageSender {
|
|
11
|
+
address: string;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
chain: string;
|
|
15
|
+
}
|
|
16
|
+
interface LayerZeroMessageReceiver {
|
|
17
|
+
address: string;
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
chain: string;
|
|
21
|
+
}
|
|
22
|
+
interface LayerZeroMessageSource {
|
|
23
|
+
status: string;
|
|
24
|
+
tx: LayerZeroMessageTx;
|
|
25
|
+
}
|
|
26
|
+
export interface LayerZeroLzCompose {
|
|
27
|
+
status: string;
|
|
28
|
+
}
|
|
29
|
+
interface LayerZeroMessageDestination {
|
|
30
|
+
tx: LayerZeroMessageTx;
|
|
31
|
+
status: string;
|
|
32
|
+
lzCompose: LayerZeroLzCompose;
|
|
33
|
+
}
|
|
34
|
+
interface LayerZeroMessageTx {
|
|
35
|
+
txHash: string;
|
|
36
|
+
blockHash: string;
|
|
37
|
+
blockNumber: string;
|
|
38
|
+
blockTimestamp: number;
|
|
39
|
+
from: string;
|
|
40
|
+
payload: string;
|
|
41
|
+
readinessTimestamp: number;
|
|
42
|
+
}
|
|
43
|
+
export type LayerZeroMessageWallet = {
|
|
44
|
+
pathway: LayerZeroMessagePathway;
|
|
45
|
+
source: LayerZeroMessageSource;
|
|
46
|
+
destination: LayerZeroMessageDestination;
|
|
47
|
+
};
|
|
48
|
+
export type LayerZeroMessagesWalletResponse = {
|
|
49
|
+
data: Array<LayerZeroMessageWallet>;
|
|
50
|
+
};
|
|
51
|
+
export type LayerZeroSendParam = {
|
|
52
|
+
dstEid: number;
|
|
53
|
+
to: Hex;
|
|
54
|
+
amountLD: bigint;
|
|
55
|
+
minAmountLD: bigint;
|
|
56
|
+
extraOptions: Hex;
|
|
57
|
+
composeMsg: Hex;
|
|
58
|
+
oftCmd: Hex;
|
|
59
|
+
};
|
|
60
|
+
export type LayerZeroChainInfo = {
|
|
61
|
+
name: string;
|
|
62
|
+
eid?: string;
|
|
63
|
+
oftAddress: string;
|
|
64
|
+
nativeChainId?: number;
|
|
65
|
+
};
|
|
66
|
+
export type LayerZeroDeploymentsMetadataResponse = {
|
|
67
|
+
[chainKey: string]: {
|
|
68
|
+
deployments?: [
|
|
69
|
+
{
|
|
70
|
+
version: number;
|
|
71
|
+
eid: string;
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
chainKey: string;
|
|
75
|
+
chainDetails?: {
|
|
76
|
+
nativeChainId: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export type LayerZeroTokenDeploymentsResponse = {
|
|
81
|
+
[chainKey: string]: {
|
|
82
|
+
address: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export interface LayerZeroQuoteParamsExt {
|
|
86
|
+
l0ChainId?: number | null;
|
|
87
|
+
l0OriginFinalityBuffer?: number | bigint;
|
|
88
|
+
l0DestinationFinalityBuffer?: number | bigint;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layerzero.js","sourceRoot":"","sources":["../../../src/gateway/types/layerzero.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { offrampCaller } from '../abi';
|
|
3
|
+
import { BaseExecuteQuoteParams } from './quote';
|
|
4
|
+
import { GatewayOrderType } from './order';
|
|
5
|
+
export type OfframpGatewayCreateQuoteResponse = {
|
|
6
|
+
amountToLock: string;
|
|
7
|
+
minimumFeesToPay: string;
|
|
8
|
+
gateway: Address;
|
|
9
|
+
};
|
|
10
|
+
export type OfframpOrderStatus = 'Active' | 'Accepted' | 'Processed' | 'Refunded';
|
|
11
|
+
export interface OfframpFeeBreakdown {
|
|
12
|
+
overallFeeSats: number;
|
|
13
|
+
inclusionFeeSats: number;
|
|
14
|
+
protocolFeeSats: number;
|
|
15
|
+
affiliateFeeSats: number;
|
|
16
|
+
fastestFeeRate: number;
|
|
17
|
+
gasFee?: bigint;
|
|
18
|
+
}
|
|
19
|
+
export interface OfframpQuote {
|
|
20
|
+
amountLockInSat: number;
|
|
21
|
+
amountReceiveInSat: number;
|
|
22
|
+
deadline: number;
|
|
23
|
+
registryAddress: Address;
|
|
24
|
+
token: Address;
|
|
25
|
+
feeBreakdown: OfframpFeeBreakdown;
|
|
26
|
+
}
|
|
27
|
+
export interface OfframpLiquidity {
|
|
28
|
+
token: Address;
|
|
29
|
+
maxOrderAmount: bigint;
|
|
30
|
+
totalOfframpLiquidity: bigint;
|
|
31
|
+
}
|
|
32
|
+
export type OfframpCreateOrderParams = {
|
|
33
|
+
quote: OfframpQuote;
|
|
34
|
+
feeBreakdown: OfframpFeeBreakdown;
|
|
35
|
+
offrampABI: typeof offrampCaller;
|
|
36
|
+
offrampFunctionName: 'createOrder';
|
|
37
|
+
offrampArgs: [
|
|
38
|
+
{
|
|
39
|
+
satAmountToLock: bigint;
|
|
40
|
+
satFeesMax: bigint;
|
|
41
|
+
creationDeadline: bigint;
|
|
42
|
+
outputScript: `0x${string}`;
|
|
43
|
+
token: Address;
|
|
44
|
+
owner: Address;
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
};
|
|
48
|
+
export type OfframpOrder = {
|
|
49
|
+
orderId: bigint;
|
|
50
|
+
token: Address;
|
|
51
|
+
satAmountLocked: bigint;
|
|
52
|
+
satFeesMax: bigint;
|
|
53
|
+
status: OfframpOrderStatus;
|
|
54
|
+
orderTimestamp: number;
|
|
55
|
+
submitOrderEvmTx: string | null;
|
|
56
|
+
refundedEvmTx: string | null;
|
|
57
|
+
btcTx: string | null;
|
|
58
|
+
shouldFeesBeBumped: boolean;
|
|
59
|
+
canOrderBeUnlocked: boolean;
|
|
60
|
+
offrampRegistryAddress: Address;
|
|
61
|
+
};
|
|
62
|
+
export type OnchainOfframpOrderDetails = {
|
|
63
|
+
orderId: bigint;
|
|
64
|
+
token: Address;
|
|
65
|
+
satAmountLocked: bigint;
|
|
66
|
+
satFeesMax: bigint;
|
|
67
|
+
owner: Address;
|
|
68
|
+
solverOwner: Address | null;
|
|
69
|
+
solverRecipient: Address | null;
|
|
70
|
+
outputScript: string;
|
|
71
|
+
status: OfframpOrderStatus;
|
|
72
|
+
orderTimestamp: number;
|
|
73
|
+
};
|
|
74
|
+
export interface OfframpRawOrder {
|
|
75
|
+
orderId: string;
|
|
76
|
+
token: string;
|
|
77
|
+
satAmountLocked: string;
|
|
78
|
+
satFeesMax: string;
|
|
79
|
+
status: string;
|
|
80
|
+
orderTimestamp: string;
|
|
81
|
+
btcTx: string | null;
|
|
82
|
+
submitOrderEvmTx: string | null;
|
|
83
|
+
shouldFeesBeBumped: boolean;
|
|
84
|
+
refundedEvmTx: string | null;
|
|
85
|
+
}
|
|
86
|
+
export type OfframpExecuteQuoteParams<T = {}> = BaseExecuteQuoteParams<T> & {
|
|
87
|
+
type: GatewayOrderType.Offramp;
|
|
88
|
+
data: OfframpQuote;
|
|
89
|
+
};
|
|
90
|
+
export interface BumpFeeParams {
|
|
91
|
+
orderId: bigint;
|
|
92
|
+
}
|
|
93
|
+
export interface UnlockOrderParams {
|
|
94
|
+
orderId: bigint;
|
|
95
|
+
receiver: Address;
|
|
96
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offramp.js","sourceRoot":"","sources":["../../../src/gateway/types/offramp.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { EsploraClient } from '../../esplora';
|
|
3
|
+
import { GatewayOrderType, OrderDetails, OrderDetailsRaw } from './order';
|
|
4
|
+
import { GatewayTokensInfo, Token } from './token';
|
|
5
|
+
import { BaseExecuteQuoteParams } from './quote';
|
|
6
|
+
export interface OnrampFeeBreakdownRaw {
|
|
7
|
+
overallFeeSats: number;
|
|
8
|
+
protocolFeeSats: number;
|
|
9
|
+
affiliateFeeSats: number;
|
|
10
|
+
executionFeeWei: string;
|
|
11
|
+
l1DataFeeWei: string;
|
|
12
|
+
}
|
|
13
|
+
export type OnrampFeeBreakdown = Omit<OnrampFeeBreakdownRaw, 'executionFeeWei' | 'l1DataFeeWei'> & {
|
|
14
|
+
executionFeeWei: bigint;
|
|
15
|
+
l1DataFeeWei: bigint;
|
|
16
|
+
};
|
|
17
|
+
export type OnrampQuote = {
|
|
18
|
+
gatewayAddress: Address;
|
|
19
|
+
baseTokenAddress: Address;
|
|
20
|
+
dustThreshold: number;
|
|
21
|
+
satoshis: number;
|
|
22
|
+
outputSatoshis: number;
|
|
23
|
+
fee: number;
|
|
24
|
+
bitcoinAddress: string;
|
|
25
|
+
txProofDifficultyFactor: number;
|
|
26
|
+
strategyAddress?: Address;
|
|
27
|
+
orderDetails: OrderDetails;
|
|
28
|
+
feeBreakdown: OnrampFeeBreakdown;
|
|
29
|
+
};
|
|
30
|
+
interface TokenReceived {
|
|
31
|
+
amount: string;
|
|
32
|
+
tokenAddress: Address;
|
|
33
|
+
}
|
|
34
|
+
export interface OnrampOrderResponse {
|
|
35
|
+
gatewayAddress: Address;
|
|
36
|
+
baseTokenAddress: Address;
|
|
37
|
+
txid: string;
|
|
38
|
+
status: boolean;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
tokens: string;
|
|
41
|
+
satoshis: number;
|
|
42
|
+
fee: number;
|
|
43
|
+
txProofDifficultyFactor: number;
|
|
44
|
+
strategyAddress: Address | null;
|
|
45
|
+
satsToConvertToEth: number;
|
|
46
|
+
outputEthAmount: string | null;
|
|
47
|
+
outputTokenAddress: Address | null;
|
|
48
|
+
outputTokenAmount: string | null;
|
|
49
|
+
txHash: string | null;
|
|
50
|
+
orderDetails: OrderDetailsRaw | null;
|
|
51
|
+
layerzeroDstEid: number | null;
|
|
52
|
+
tokensReceived: TokenReceived[] | null;
|
|
53
|
+
strategyFailed: boolean | null;
|
|
54
|
+
}
|
|
55
|
+
export type OnrampOrderStatusData = {
|
|
56
|
+
confirmations: number;
|
|
57
|
+
};
|
|
58
|
+
export type OnrampOrderStatus = {
|
|
59
|
+
confirmed: false;
|
|
60
|
+
pending?: never;
|
|
61
|
+
success?: never;
|
|
62
|
+
data: OnrampOrderStatusData;
|
|
63
|
+
} | {
|
|
64
|
+
confirmed?: never;
|
|
65
|
+
pending: true;
|
|
66
|
+
success?: never;
|
|
67
|
+
data: OnrampOrderStatusData;
|
|
68
|
+
} | {
|
|
69
|
+
confirmed?: never;
|
|
70
|
+
pending?: never;
|
|
71
|
+
success: boolean;
|
|
72
|
+
data: OnrampOrderStatusData;
|
|
73
|
+
};
|
|
74
|
+
export type OnrampOrder = Omit<OnrampOrderResponse, 'satsToConvertToEth' | 'orderDetails' | 'tokensReceived' | 'outputTokenAddress' | 'outputTokenAmount'> & {
|
|
75
|
+
gasRefill: number;
|
|
76
|
+
orderDetails?: OrderDetails;
|
|
77
|
+
} & {
|
|
78
|
+
getTokenAddress(): string | undefined;
|
|
79
|
+
getToken(): Token | undefined;
|
|
80
|
+
getTokenAmount(): string | number | null;
|
|
81
|
+
getConfirmations(esploraClient: EsploraClient, latestHeight?: number): Promise<number>;
|
|
82
|
+
getStatus(esploraClient: EsploraClient, latestHeight?: number): Promise<OnrampOrderStatus>;
|
|
83
|
+
getOutputTokens(): {
|
|
84
|
+
amount: string;
|
|
85
|
+
token: Token;
|
|
86
|
+
}[];
|
|
87
|
+
getTokens(): {
|
|
88
|
+
amount: string | number;
|
|
89
|
+
token: Token;
|
|
90
|
+
}[];
|
|
91
|
+
} & GatewayTokensInfo;
|
|
92
|
+
export type OnrampExecuteQuoteParams<T = {}> = BaseExecuteQuoteParams<T> & {
|
|
93
|
+
type: GatewayOrderType.Onramp;
|
|
94
|
+
data: OnrampQuote & GatewayTokensInfo;
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onramp.js","sourceRoot":"","sources":["../../../src/gateway/types/onramp.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
import { OnrampOrder } from './onramp';
|
|
3
|
+
import { OfframpOrder } from './offramp';
|
|
4
|
+
import { CrossChainOrder } from './crosschain-swap';
|
|
5
|
+
export type OrderDetailsRaw = {
|
|
6
|
+
version: string;
|
|
7
|
+
data: {
|
|
8
|
+
ethAmountToReceive: string;
|
|
9
|
+
satsToSwapToEth: number;
|
|
10
|
+
ethTransferGasLimit: string;
|
|
11
|
+
strategyGasLimit: string;
|
|
12
|
+
totalUserGasLimit: string;
|
|
13
|
+
userGasPriceLimit: string;
|
|
14
|
+
l1DataFee: string;
|
|
15
|
+
extraSatsFee: string | null;
|
|
16
|
+
extraSatsFeeRecipient: Address | null;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type OrderDetails = {
|
|
20
|
+
version: string;
|
|
21
|
+
data: {
|
|
22
|
+
ethAmountToReceive: bigint;
|
|
23
|
+
satsToSwapToEth: number;
|
|
24
|
+
ethTransferGasLimit: bigint;
|
|
25
|
+
strategyGasLimit: bigint;
|
|
26
|
+
totalUserGasLimit: bigint;
|
|
27
|
+
userGasPriceLimit: bigint;
|
|
28
|
+
l1DataFee: bigint;
|
|
29
|
+
extraSatsFee: bigint | null;
|
|
30
|
+
extraSatsFeeRecipient: Address | null;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type GatewayCreateOrderRequest = {
|
|
34
|
+
gatewayAddress: Address;
|
|
35
|
+
strategyAddress?: Address;
|
|
36
|
+
satsToConvertToEth: number;
|
|
37
|
+
userAddress: Address;
|
|
38
|
+
gatewayExtraData?: Hex;
|
|
39
|
+
strategyExtraData?: Hex;
|
|
40
|
+
satoshis: number;
|
|
41
|
+
campaignId?: string;
|
|
42
|
+
orderDetails?: OrderDetails;
|
|
43
|
+
};
|
|
44
|
+
export type GatewayCreateOrderRequestPayload = {
|
|
45
|
+
gatewayAddress: Address;
|
|
46
|
+
strategyAddress?: Address;
|
|
47
|
+
userAddress: Address;
|
|
48
|
+
gatewayExtraData?: Hex;
|
|
49
|
+
strategyExtraData?: Hex;
|
|
50
|
+
satoshis: number;
|
|
51
|
+
campaignId?: string;
|
|
52
|
+
orderDetails?: OrderDetailsRaw;
|
|
53
|
+
};
|
|
54
|
+
export type GatewayCreateOrderResponse = {
|
|
55
|
+
uuid: string;
|
|
56
|
+
opReturnHash: string;
|
|
57
|
+
};
|
|
58
|
+
export type GatewayStartOrder = GatewayCreateOrderResponse & {
|
|
59
|
+
bitcoinAddress: string;
|
|
60
|
+
satoshis: number;
|
|
61
|
+
psbtBase64?: string;
|
|
62
|
+
};
|
|
63
|
+
export declare enum GatewayOrderType {
|
|
64
|
+
Onramp = "onramp",
|
|
65
|
+
Offramp = "offramp",
|
|
66
|
+
CrossChainSwap = "crosschain-swap"
|
|
67
|
+
}
|
|
68
|
+
export type GatewayOrder = {
|
|
69
|
+
type: GatewayOrderType.Onramp;
|
|
70
|
+
order: OnrampOrder;
|
|
71
|
+
} | {
|
|
72
|
+
type: GatewayOrderType.Offramp;
|
|
73
|
+
order: OfframpOrder;
|
|
74
|
+
} | {
|
|
75
|
+
type: GatewayOrderType.CrossChainSwap;
|
|
76
|
+
order: CrossChainOrder;
|
|
77
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GatewayOrderType = void 0;
|
|
4
|
+
var GatewayOrderType;
|
|
5
|
+
(function (GatewayOrderType) {
|
|
6
|
+
GatewayOrderType["Onramp"] = "onramp";
|
|
7
|
+
GatewayOrderType["Offramp"] = "offramp";
|
|
8
|
+
GatewayOrderType["CrossChainSwap"] = "crosschain-swap";
|
|
9
|
+
})(GatewayOrderType || (exports.GatewayOrderType = GatewayOrderType = {}));
|
|
10
|
+
//# sourceMappingURL=order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/gateway/types/order.ts"],"names":[],"mappings":";;;AAkFA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;IACnB,sDAAkC,CAAA;AACtC,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
import { Optional } from './utils';
|
|
3
|
+
import { OnrampExecuteQuoteParams } from './onramp';
|
|
4
|
+
import { OfframpExecuteQuoteParams } from './offramp';
|
|
5
|
+
import { CrossChainSwapQuoteParams } from './crosschain-swap';
|
|
6
|
+
type ChainSlug = string | number;
|
|
7
|
+
type TokenSymbol = string;
|
|
8
|
+
export interface GatewayQuoteParams {
|
|
9
|
+
fromChain: ChainSlug;
|
|
10
|
+
toChain: ChainSlug;
|
|
11
|
+
fromToken: TokenSymbol;
|
|
12
|
+
toToken: TokenSymbol;
|
|
13
|
+
fromUserAddress: string;
|
|
14
|
+
toUserAddress: string;
|
|
15
|
+
amount: number | string | bigint;
|
|
16
|
+
maxSlippage?: number;
|
|
17
|
+
affiliateId?: string;
|
|
18
|
+
type?: 'swap' | 'deposit' | 'withdraw' | 'claim';
|
|
19
|
+
fee?: number;
|
|
20
|
+
feeRate?: number;
|
|
21
|
+
gasRefill?: bigint;
|
|
22
|
+
fromUserPublicKey?: string;
|
|
23
|
+
strategyAddress?: string;
|
|
24
|
+
campaignId?: string;
|
|
25
|
+
message?: Hex;
|
|
26
|
+
}
|
|
27
|
+
export type GetQuoteParams<T = {}> = Optional<GatewayQuoteParams & T, 'fromUserAddress'>;
|
|
28
|
+
export type BaseExecuteQuoteParams<T = {}> = {
|
|
29
|
+
finalOutputSats: number;
|
|
30
|
+
finalFeeSats: number;
|
|
31
|
+
params: GetQuoteParams;
|
|
32
|
+
} & T;
|
|
33
|
+
export type ExecuteQuoteParams<T = {}> = OnrampExecuteQuoteParams<T> | OfframpExecuteQuoteParams<T> | CrossChainSwapQuoteParams<T>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../../src/gateway/types/quote.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
interface GatewayToken {
|
|
3
|
+
symbol: string;
|
|
4
|
+
address: string;
|
|
5
|
+
logo: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
chain: string;
|
|
8
|
+
}
|
|
9
|
+
type GatewayIntegrationType = 'bridge' | 'dex' | 'staking' | 'lending';
|
|
10
|
+
interface GatewayIntegration {
|
|
11
|
+
type: GatewayIntegrationType;
|
|
12
|
+
slug: string;
|
|
13
|
+
name: string;
|
|
14
|
+
logo: string;
|
|
15
|
+
monetization: boolean;
|
|
16
|
+
}
|
|
17
|
+
type GatewayStrategyType = 'deposit' | 'withdraw' | 'claim' | 'router' | 'bridge';
|
|
18
|
+
type GatewayChainType = 'evm' | 'ibc' | 'solana' | 'multiversx' | 'bitcoin' | 'ton' | 'tron';
|
|
19
|
+
interface GatewayChain {
|
|
20
|
+
id: string;
|
|
21
|
+
chainId: number;
|
|
22
|
+
slug: string;
|
|
23
|
+
name: string;
|
|
24
|
+
logo: string;
|
|
25
|
+
type: GatewayChainType;
|
|
26
|
+
singleChainSwap: boolean;
|
|
27
|
+
singleChainStaking: boolean;
|
|
28
|
+
nativeToken?: GatewayToken;
|
|
29
|
+
txExplorer?: string;
|
|
30
|
+
tokenExplorer?: string;
|
|
31
|
+
rpcUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface GatewayStrategyContract {
|
|
34
|
+
id: string;
|
|
35
|
+
type: GatewayStrategyType;
|
|
36
|
+
address: Address;
|
|
37
|
+
method: string;
|
|
38
|
+
chain: GatewayChain;
|
|
39
|
+
integration: GatewayIntegration;
|
|
40
|
+
inputToken: GatewayToken;
|
|
41
|
+
outputToken: GatewayToken | null;
|
|
42
|
+
}
|
|
43
|
+
export type StrategyParams = {
|
|
44
|
+
strategyAddress: Address;
|
|
45
|
+
token: Address;
|
|
46
|
+
sender: Address;
|
|
47
|
+
receiver: Address;
|
|
48
|
+
amount: bigint;
|
|
49
|
+
amountOutMin: bigint;
|
|
50
|
+
};
|
|
51
|
+
export interface GatewayStrategy {
|
|
52
|
+
strategyAddress: string;
|
|
53
|
+
strategyName: string;
|
|
54
|
+
strategyType: 'staking' | 'lending';
|
|
55
|
+
projectName: string;
|
|
56
|
+
projectLogo?: string;
|
|
57
|
+
inputTokenAddress: string;
|
|
58
|
+
outputTokenAddress?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface StrategyAssetState {
|
|
61
|
+
address: Address | 'usd';
|
|
62
|
+
totalUnderlying: bigint;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../src/gateway/types/strategy.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
export interface Token {
|
|
3
|
+
chainId: number;
|
|
4
|
+
address: Address;
|
|
5
|
+
name: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
decimals: number;
|
|
8
|
+
logoURI: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PointsIncentive {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
export interface EnrichedToken extends Token {
|
|
15
|
+
tvl: number;
|
|
16
|
+
apyBase: number;
|
|
17
|
+
apyReward: number;
|
|
18
|
+
rewardTokens: Token[];
|
|
19
|
+
points: PointsIncentive[];
|
|
20
|
+
}
|
|
21
|
+
export type GatewayTokensInfo = {
|
|
22
|
+
baseToken: Token;
|
|
23
|
+
outputToken?: Token;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/gateway/types/token.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/gateway/types/utils.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Chain as ViemChain } from 'viem';
|
|
2
|
-
import { GatewayCreateOrderRequest, OfframpOrderStatus, OnrampFeeBreakdown, OnrampFeeBreakdownRaw, OrderDetails, OrderDetailsRaw } from './types';
|
|
3
|
-
import { Address, Hex } from 'viem';
|
|
4
1
|
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
+
import { Address, Hex, Chain as ViemChain } from 'viem';
|
|
3
|
+
import { GatewayCreateOrderRequest, OfframpOrderStatus, OnrampFeeBreakdown, OnrampFeeBreakdownRaw, OrderDetails, OrderDetailsRaw } from '../types';
|
|
5
4
|
export declare function calculateOpReturnHash(req: GatewayCreateOrderRequest): `0x${string}`;
|
|
6
5
|
export declare function toHexScriptPubKey(userAddress: string, network: bitcoin.Network): string;
|
|
7
6
|
export declare function isHexPrefixed(str: string): boolean;
|
|
@@ -6893,5 +6892,5 @@ export declare function convertOnrampFeeBreakdown(order: OnrampFeeBreakdownRaw):
|
|
|
6893
6892
|
export declare function parseBtc(btc: string): bigint;
|
|
6894
6893
|
export declare function formatBtc(btc: bigint): string;
|
|
6895
6894
|
export declare function getChainConfig(fromChain: string | number): ViemChain;
|
|
6896
|
-
export declare function computeAllowanceSlot(
|
|
6895
|
+
export declare function computeAllowanceSlot(owner: Address, spender: Address, tokenAllowanceSlot: bigint): Hex;
|
|
6897
6896
|
export declare function computeBalanceSlot(user: Address, balancesMappingSlot: bigint): Hex;
|