genius-intents 0.1.4
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/CHANGELOG.md +45 -0
- package/LICENSE +21 -0
- package/README.md +376 -0
- package/dist/src/index.d.ts +27 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +62 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/intents-protocols.d.ts +69 -0
- package/dist/src/intents-protocols.d.ts.map +1 -0
- package/dist/src/intents-protocols.js +371 -0
- package/dist/src/intents-protocols.js.map +1 -0
- package/dist/src/interfaces/intent-protocol.d.ts +21 -0
- package/dist/src/interfaces/intent-protocol.d.ts.map +1 -0
- package/dist/src/interfaces/intent-protocol.js +3 -0
- package/dist/src/interfaces/intent-protocol.js.map +1 -0
- package/dist/src/protocols/aftermath/aftermath.service.d.ts +28 -0
- package/dist/src/protocols/aftermath/aftermath.service.d.ts.map +1 -0
- package/dist/src/protocols/aftermath/aftermath.service.js +162 -0
- package/dist/src/protocols/aftermath/aftermath.service.js.map +1 -0
- package/dist/src/protocols/aftermath/aftermath.types.d.ts +100 -0
- package/dist/src/protocols/aftermath/aftermath.types.d.ts.map +1 -0
- package/dist/src/protocols/aftermath/aftermath.types.js +3 -0
- package/dist/src/protocols/aftermath/aftermath.types.js.map +1 -0
- package/dist/src/protocols/aftermath/index.d.ts +3 -0
- package/dist/src/protocols/aftermath/index.d.ts.map +1 -0
- package/dist/src/protocols/aftermath/index.js +7 -0
- package/dist/src/protocols/aftermath/index.js.map +1 -0
- package/dist/src/protocols/debridge/debridge.service.d.ts +157 -0
- package/dist/src/protocols/debridge/debridge.service.d.ts.map +1 -0
- package/dist/src/protocols/debridge/debridge.service.js +462 -0
- package/dist/src/protocols/debridge/debridge.service.js.map +1 -0
- package/dist/src/protocols/debridge/debridge.types.d.ts +82 -0
- package/dist/src/protocols/debridge/debridge.types.d.ts.map +1 -0
- package/dist/src/protocols/debridge/debridge.types.js +3 -0
- package/dist/src/protocols/debridge/debridge.types.js.map +1 -0
- package/dist/src/protocols/debridge/index.d.ts +3 -0
- package/dist/src/protocols/debridge/index.d.ts.map +1 -0
- package/dist/src/protocols/debridge/index.js +7 -0
- package/dist/src/protocols/debridge/index.js.map +1 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.service.d.ts +36 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.service.d.ts.map +1 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.service.js +312 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.service.js.map +1 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.types.d.ts +100 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.types.d.ts.map +1 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.types.js +3 -0
- package/dist/src/protocols/genius-bridge/genius-bridge.types.js.map +1 -0
- package/dist/src/protocols/genius-bridge/index.d.ts +3 -0
- package/dist/src/protocols/genius-bridge/index.d.ts.map +1 -0
- package/dist/src/protocols/genius-bridge/index.js +7 -0
- package/dist/src/protocols/genius-bridge/index.js.map +1 -0
- package/dist/src/protocols/jupiter/index.d.ts +3 -0
- package/dist/src/protocols/jupiter/index.d.ts.map +1 -0
- package/dist/src/protocols/jupiter/index.js +7 -0
- package/dist/src/protocols/jupiter/index.js.map +1 -0
- package/dist/src/protocols/jupiter/jupiter.service.d.ts +37 -0
- package/dist/src/protocols/jupiter/jupiter.service.d.ts.map +1 -0
- package/dist/src/protocols/jupiter/jupiter.service.js +188 -0
- package/dist/src/protocols/jupiter/jupiter.service.js.map +1 -0
- package/dist/src/protocols/jupiter/jupiter.types.d.ts +272 -0
- package/dist/src/protocols/jupiter/jupiter.types.d.ts.map +1 -0
- package/dist/src/protocols/jupiter/jupiter.types.js +3 -0
- package/dist/src/protocols/jupiter/jupiter.types.js.map +1 -0
- package/dist/src/protocols/kyberswap/index.d.ts +3 -0
- package/dist/src/protocols/kyberswap/index.d.ts.map +1 -0
- package/dist/src/protocols/kyberswap/index.js +7 -0
- package/dist/src/protocols/kyberswap/index.js.map +1 -0
- package/dist/src/protocols/kyberswap/kyberswap.service.d.ts +34 -0
- package/dist/src/protocols/kyberswap/kyberswap.service.d.ts.map +1 -0
- package/dist/src/protocols/kyberswap/kyberswap.service.js +218 -0
- package/dist/src/protocols/kyberswap/kyberswap.service.js.map +1 -0
- package/dist/src/protocols/kyberswap/kyberswap.types.d.ts +114 -0
- package/dist/src/protocols/kyberswap/kyberswap.types.d.ts.map +1 -0
- package/dist/src/protocols/kyberswap/kyberswap.types.js +3 -0
- package/dist/src/protocols/kyberswap/kyberswap.types.js.map +1 -0
- package/dist/src/protocols/odos/index.d.ts +3 -0
- package/dist/src/protocols/odos/index.d.ts.map +1 -0
- package/dist/src/protocols/odos/index.js +7 -0
- package/dist/src/protocols/odos/index.js.map +1 -0
- package/dist/src/protocols/odos/odos.service.d.ts +39 -0
- package/dist/src/protocols/odos/odos.service.d.ts.map +1 -0
- package/dist/src/protocols/odos/odos.service.js +207 -0
- package/dist/src/protocols/odos/odos.service.js.map +1 -0
- package/dist/src/protocols/odos/odos.types.d.ts +114 -0
- package/dist/src/protocols/odos/odos.types.d.ts.map +1 -0
- package/dist/src/protocols/odos/odos.types.js +3 -0
- package/dist/src/protocols/odos/odos.types.js.map +1 -0
- package/dist/src/protocols/okx/index.d.ts +3 -0
- package/dist/src/protocols/okx/index.d.ts.map +1 -0
- package/dist/src/protocols/okx/index.js +7 -0
- package/dist/src/protocols/okx/index.js.map +1 -0
- package/dist/src/protocols/okx/okx.service.d.ts +36 -0
- package/dist/src/protocols/okx/okx.service.d.ts.map +1 -0
- package/dist/src/protocols/okx/okx.service.js +281 -0
- package/dist/src/protocols/okx/okx.service.js.map +1 -0
- package/dist/src/protocols/okx/okx.types.d.ts +119 -0
- package/dist/src/protocols/okx/okx.types.d.ts.map +1 -0
- package/dist/src/protocols/okx/okx.types.js +4 -0
- package/dist/src/protocols/okx/okx.types.js.map +1 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.service.d.ts +1 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.service.d.ts.map +1 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.service.js +2 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.service.js.map +1 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.types.d.ts +1 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.types.d.ts.map +1 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.types.js +2 -0
- package/dist/src/protocols/okx-bridge/okx-bridge.types.js.map +1 -0
- package/dist/src/protocols/openocean/index.d.ts +3 -0
- package/dist/src/protocols/openocean/index.d.ts.map +1 -0
- package/dist/src/protocols/openocean/index.js +7 -0
- package/dist/src/protocols/openocean/index.js.map +1 -0
- package/dist/src/protocols/openocean/openocean.service.d.ts +29 -0
- package/dist/src/protocols/openocean/openocean.service.d.ts.map +1 -0
- package/dist/src/protocols/openocean/openocean.service.js +181 -0
- package/dist/src/protocols/openocean/openocean.service.js.map +1 -0
- package/dist/src/protocols/openocean/openocean.types.d.ts +68 -0
- package/dist/src/protocols/openocean/openocean.types.d.ts.map +1 -0
- package/dist/src/protocols/openocean/openocean.types.js +3 -0
- package/dist/src/protocols/openocean/openocean.types.js.map +1 -0
- package/dist/src/protocols/pumpfun/index.d.ts +3 -0
- package/dist/src/protocols/pumpfun/index.d.ts.map +1 -0
- package/dist/src/protocols/pumpfun/index.js +7 -0
- package/dist/src/protocols/pumpfun/index.js.map +1 -0
- package/dist/src/protocols/pumpfun/pumpfun.service.d.ts +45 -0
- package/dist/src/protocols/pumpfun/pumpfun.service.d.ts.map +1 -0
- package/dist/src/protocols/pumpfun/pumpfun.service.js +217 -0
- package/dist/src/protocols/pumpfun/pumpfun.service.js.map +1 -0
- package/dist/src/protocols/pumpfun/pumpfun.types.d.ts +14 -0
- package/dist/src/protocols/pumpfun/pumpfun.types.d.ts.map +1 -0
- package/dist/src/protocols/pumpfun/pumpfun.types.js +3 -0
- package/dist/src/protocols/pumpfun/pumpfun.types.js.map +1 -0
- package/dist/src/protocols/raydium/index.d.ts +3 -0
- package/dist/src/protocols/raydium/index.d.ts.map +1 -0
- package/dist/src/protocols/raydium/index.js +7 -0
- package/dist/src/protocols/raydium/index.js.map +1 -0
- package/dist/src/protocols/raydium/raydium-v2.service.d.ts +35 -0
- package/dist/src/protocols/raydium/raydium-v2.service.d.ts.map +1 -0
- package/dist/src/protocols/raydium/raydium-v2.service.js +301 -0
- package/dist/src/protocols/raydium/raydium-v2.service.js.map +1 -0
- package/dist/src/protocols/raydium/raydium-v2.types.d.ts +96 -0
- package/dist/src/protocols/raydium/raydium-v2.types.d.ts.map +1 -0
- package/dist/src/protocols/raydium/raydium-v2.types.js +3 -0
- package/dist/src/protocols/raydium/raydium-v2.types.js.map +1 -0
- package/dist/src/protocols/zeroX/index.d.ts +3 -0
- package/dist/src/protocols/zeroX/index.d.ts.map +1 -0
- package/dist/src/protocols/zeroX/index.js +7 -0
- package/dist/src/protocols/zeroX/index.js.map +1 -0
- package/dist/src/protocols/zeroX/zeroX.service.d.ts +37 -0
- package/dist/src/protocols/zeroX/zeroX.service.d.ts.map +1 -0
- package/dist/src/protocols/zeroX/zeroX.service.js +209 -0
- package/dist/src/protocols/zeroX/zeroX.service.js.map +1 -0
- package/dist/src/protocols/zeroX/zeroX.types.d.ts +120 -0
- package/dist/src/protocols/zeroX/zeroX.types.d.ts.map +1 -0
- package/dist/src/protocols/zeroX/zeroX.types.js +3 -0
- package/dist/src/protocols/zeroX/zeroX.types.js.map +1 -0
- package/dist/src/types/enums.d.ts +42 -0
- package/dist/src/types/enums.d.ts.map +1 -0
- package/dist/src/types/enums.js +49 -0
- package/dist/src/types/enums.js.map +1 -0
- package/dist/src/types/intents-protocols.d.ts +89 -0
- package/dist/src/types/intents-protocols.d.ts.map +1 -0
- package/dist/src/types/intents-protocols.js +3 -0
- package/dist/src/types/intents-protocols.js.map +1 -0
- package/dist/src/types/price-response.d.ts +26 -0
- package/dist/src/types/price-response.d.ts.map +1 -0
- package/dist/src/types/price-response.js +3 -0
- package/dist/src/types/price-response.js.map +1 -0
- package/dist/src/types/quote-response.d.ts +31 -0
- package/dist/src/types/quote-response.d.ts.map +1 -0
- package/dist/src/types/quote-response.js +3 -0
- package/dist/src/types/quote-response.js.map +1 -0
- package/dist/src/utils/address-validation.d.ts +9 -0
- package/dist/src/utils/address-validation.d.ts.map +1 -0
- package/dist/src/utils/address-validation.js +42 -0
- package/dist/src/utils/address-validation.js.map +1 -0
- package/dist/src/utils/address.d.ts +9 -0
- package/dist/src/utils/address.d.ts.map +1 -0
- package/dist/src/utils/address.js +74 -0
- package/dist/src/utils/address.js.map +1 -0
- package/dist/src/utils/base64-to-base58.d.ts +2 -0
- package/dist/src/utils/base64-to-base58.d.ts.map +1 -0
- package/dist/src/utils/base64-to-base58.js +22 -0
- package/dist/src/utils/base64-to-base58.js.map +1 -0
- package/dist/src/utils/chain-id-name.d.ts +3 -0
- package/dist/src/utils/chain-id-name.d.ts.map +1 -0
- package/dist/src/utils/chain-id-name.js +23 -0
- package/dist/src/utils/chain-id-name.js.map +1 -0
- package/dist/src/utils/check-vm.d.ts +8 -0
- package/dist/src/utils/check-vm.d.ts.map +1 -0
- package/dist/src/utils/check-vm.js +39 -0
- package/dist/src/utils/check-vm.js.map +1 -0
- package/dist/src/utils/constants.d.ts +7 -0
- package/dist/src/utils/constants.d.ts.map +1 -0
- package/dist/src/utils/constants.js +10 -0
- package/dist/src/utils/constants.js.map +1 -0
- package/dist/src/utils/create-error-message.d.ts +5 -0
- package/dist/src/utils/create-error-message.d.ts.map +1 -0
- package/dist/src/utils/create-error-message.js +42 -0
- package/dist/src/utils/create-error-message.js.map +1 -0
- package/dist/src/utils/fetch-spl-metadata.d.ts +4 -0
- package/dist/src/utils/fetch-spl-metadata.d.ts.map +1 -0
- package/dist/src/utils/fetch-spl-metadata.js +108 -0
- package/dist/src/utils/fetch-spl-metadata.js.map +1 -0
- package/dist/src/utils/is-native.d.ts +2 -0
- package/dist/src/utils/is-native.d.ts.map +1 -0
- package/dist/src/utils/is-native.js +23 -0
- package/dist/src/utils/is-native.js.map +1 -0
- package/dist/src/utils/logger.d.ts +56 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +108 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/throw-error.d.ts +3 -0
- package/dist/src/utils/throw-error.d.ts.map +1 -0
- package/dist/src/utils/throw-error.js +8 -0
- package/dist/src/utils/throw-error.js.map +1 -0
- package/dist/tests/core/intent-protocol-suite.test.d.ts +2 -0
- package/dist/tests/core/intent-protocol-suite.test.d.ts.map +1 -0
- package/dist/tests/core/intent-protocol-suite.test.js +485 -0
- package/dist/tests/core/intent-protocol-suite.test.js.map +1 -0
- package/dist/tests/core/intents-protocols.test.d.ts +2 -0
- package/dist/tests/core/intents-protocols.test.d.ts.map +1 -0
- package/dist/tests/core/intents-protocols.test.js +307 -0
- package/dist/tests/core/intents-protocols.test.js.map +1 -0
- package/dist/tests/core/protocol-test-runner.d.ts +62 -0
- package/dist/tests/core/protocol-test-runner.d.ts.map +1 -0
- package/dist/tests/core/protocol-test-runner.js +260 -0
- package/dist/tests/core/protocol-test-runner.js.map +1 -0
- package/dist/tests/core/setup.test.d.ts +1 -0
- package/dist/tests/core/setup.test.d.ts.map +1 -0
- package/dist/tests/core/setup.test.js +13 -0
- package/dist/tests/core/setup.test.js.map +1 -0
- package/dist/tests/fixtures/test-data.d.ts +84 -0
- package/dist/tests/fixtures/test-data.d.ts.map +1 -0
- package/dist/tests/fixtures/test-data.js +142 -0
- package/dist/tests/fixtures/test-data.js.map +1 -0
- package/dist/tests/integration/cross-chain.test.d.ts +2 -0
- package/dist/tests/integration/cross-chain.test.d.ts.map +1 -0
- package/dist/tests/integration/cross-chain.test.js +44 -0
- package/dist/tests/integration/cross-chain.test.js.map +1 -0
- package/dist/tests/protocols/simple-protocol.test.d.ts +2 -0
- package/dist/tests/protocols/simple-protocol.test.d.ts.map +1 -0
- package/dist/tests/protocols/simple-protocol.test.js +77 -0
- package/dist/tests/protocols/simple-protocol.test.js.map +1 -0
- package/dist/tests/setup.d.ts +24 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/setup.js +48 -0
- package/dist/tests/setup.js.map +1 -0
- package/dist/tests/utils/test-generator.d.ts +30 -0
- package/dist/tests/utils/test-generator.d.ts.map +1 -0
- package/dist/tests/utils/test-generator.js +153 -0
- package/dist/tests/utils/test-generator.js.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export type AftermathConfig = {
|
|
2
|
+
suiRpcUrl: string;
|
|
3
|
+
privateUrl?: string;
|
|
4
|
+
quoteParamOverrides?: Partial<AftermathSwapParams>;
|
|
5
|
+
};
|
|
6
|
+
export type AftermathPriceParams = {
|
|
7
|
+
/**
|
|
8
|
+
* Required token type for the input token
|
|
9
|
+
* The token the user is swapping from
|
|
10
|
+
*/
|
|
11
|
+
coinInType: string;
|
|
12
|
+
/**
|
|
13
|
+
* Required token type for the output token
|
|
14
|
+
* The token the user is swapping to
|
|
15
|
+
*/
|
|
16
|
+
coinOutType: string;
|
|
17
|
+
/**
|
|
18
|
+
* Required amount to swap (as BigInt or string)
|
|
19
|
+
*/
|
|
20
|
+
coinInAmount: BigInt | string;
|
|
21
|
+
/**
|
|
22
|
+
* Slippage tolerance as a decimal (0.01 = 1%)
|
|
23
|
+
*/
|
|
24
|
+
slippage?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Optional external fee configuration
|
|
27
|
+
*/
|
|
28
|
+
externalFee?: {
|
|
29
|
+
recipient: string;
|
|
30
|
+
feePercentage: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type AftermathRoutePool = {
|
|
34
|
+
poolId: string;
|
|
35
|
+
poolType: string;
|
|
36
|
+
tokenXType: string;
|
|
37
|
+
tokenYType: string;
|
|
38
|
+
fee: string;
|
|
39
|
+
tickSpacing?: number;
|
|
40
|
+
};
|
|
41
|
+
export type AftermathRouteStep = {
|
|
42
|
+
pool: AftermathRoutePool;
|
|
43
|
+
tokenIn: string;
|
|
44
|
+
tokenOut: string;
|
|
45
|
+
amountIn: string;
|
|
46
|
+
amountOut: string;
|
|
47
|
+
feeAmount: string;
|
|
48
|
+
};
|
|
49
|
+
export type AftermathRoute = {
|
|
50
|
+
steps: AftermathRouteStep[];
|
|
51
|
+
inputToken: string;
|
|
52
|
+
outputToken: string;
|
|
53
|
+
totalAmountIn: string;
|
|
54
|
+
totalAmountOut: string;
|
|
55
|
+
priceImpact: string;
|
|
56
|
+
gasEstimate?: string;
|
|
57
|
+
};
|
|
58
|
+
export type AftermathSwapParams = {
|
|
59
|
+
/**
|
|
60
|
+
* Required wallet address of the user initiating the swap
|
|
61
|
+
*/
|
|
62
|
+
walletAddress: string;
|
|
63
|
+
/**
|
|
64
|
+
* Complete route information from the price response
|
|
65
|
+
*/
|
|
66
|
+
completeRoute: AftermathRoute;
|
|
67
|
+
/**
|
|
68
|
+
* Slippage tolerance as a decimal (0.01 = 1%)
|
|
69
|
+
*/
|
|
70
|
+
slippage: number;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the transaction is sponsored
|
|
73
|
+
*/
|
|
74
|
+
isSponsoredTx?: boolean;
|
|
75
|
+
};
|
|
76
|
+
export type AftermathPriceResponse = {
|
|
77
|
+
inToken: string;
|
|
78
|
+
outToken: string;
|
|
79
|
+
inAmount: string;
|
|
80
|
+
outAmount: string;
|
|
81
|
+
inTokenTradeFee: string;
|
|
82
|
+
outTokenTradeFee: string;
|
|
83
|
+
spotPrice: string;
|
|
84
|
+
route: AftermathRoute;
|
|
85
|
+
slippage: number;
|
|
86
|
+
};
|
|
87
|
+
export type AftermathTransactionData = {
|
|
88
|
+
transactionBlock: string;
|
|
89
|
+
lastValidBlockHeight?: number;
|
|
90
|
+
gasEstimate?: {
|
|
91
|
+
computationCost: string;
|
|
92
|
+
storageCost: string;
|
|
93
|
+
storageRebate: string;
|
|
94
|
+
totalGas: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export type AftermathQuoteResponse = {
|
|
98
|
+
transactions: string[];
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=aftermath.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aftermath.types.d.ts","sourceRoot":"","sources":["../../../../src/protocols/aftermath/aftermath.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAA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3,"file":"aftermath.types.js","sourceRoot":"","sources":["../../../../src/protocols/aftermath/aftermath.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AftermathService } from './aftermath.service';
|
|
2
|
+
export type { AftermathConfig, AftermathPriceParams, AftermathRoutePool, AftermathRouteStep, AftermathRoute, AftermathSwapParams, AftermathPriceResponse, AftermathTransactionData, AftermathQuoteResponse, } from './aftermath.types';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/protocols/aftermath/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AftermathService = void 0;
|
|
4
|
+
// Aftermath Protocol - All exports
|
|
5
|
+
var aftermath_service_1 = require("./aftermath.service");
|
|
6
|
+
Object.defineProperty(exports, "AftermathService", { enumerable: true, get: function () { return aftermath_service_1.AftermathService; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/protocols/aftermath/index.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { DeBridgeConfig, DeBridgeQuoteResponse, DeBridgePriceParams, DeBridgeQuoteParams } from './debridge.types';
|
|
2
|
+
import { IIntentProtocol } from '../../interfaces/intent-protocol';
|
|
3
|
+
import { IntentPriceParams } from '../../types/price-params';
|
|
4
|
+
import { PriceResponse, RawProtocolPriceResponse } from '../../types/price-response';
|
|
5
|
+
import { IntentQuoteParams } from '../../types/quote-params';
|
|
6
|
+
import { QuoteResponse } from '../../types/quote-response';
|
|
7
|
+
import { IntentsSDKConfig } from '../../types/sdk-config';
|
|
8
|
+
import { ChainIdEnum, ProtocolEnum } from '../../types/enums';
|
|
9
|
+
/**
|
|
10
|
+
* The `DeBridgeService` class implements the IIntentProtocol interface for cross-chain
|
|
11
|
+
* token swaps using the DeBridge protocol. It provides functionality for fetching price
|
|
12
|
+
* quotes and generating transaction data for token transfers across multiple supported
|
|
13
|
+
* blockchains.
|
|
14
|
+
*
|
|
15
|
+
* @implements {IIntentProtocol}
|
|
16
|
+
*/
|
|
17
|
+
export declare class DeBridgeService implements IIntentProtocol {
|
|
18
|
+
/**
|
|
19
|
+
* RPC URLs for each supported blockchain network.
|
|
20
|
+
*/
|
|
21
|
+
protected readonly rpcUrls: Record<number, string | string[]>;
|
|
22
|
+
/**
|
|
23
|
+
* The protocol identifier for DeBridge.
|
|
24
|
+
*/
|
|
25
|
+
readonly protocol = ProtocolEnum.DEBRIDGE;
|
|
26
|
+
/**
|
|
27
|
+
* The list of blockchain networks supported by the DeBridge service.
|
|
28
|
+
*/
|
|
29
|
+
readonly chains: ChainIdEnum[];
|
|
30
|
+
/**
|
|
31
|
+
* Indicates that the service does not operate only on a single blockchain.
|
|
32
|
+
*/
|
|
33
|
+
readonly singleChain = false;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates that the service supports cross-chain operations.
|
|
36
|
+
*/
|
|
37
|
+
readonly multiChain = true;
|
|
38
|
+
/**
|
|
39
|
+
* The base URL for the DeBridge API.
|
|
40
|
+
*/
|
|
41
|
+
readonly baseUrl: string;
|
|
42
|
+
/**
|
|
43
|
+
* The chain ID used for Solana in the DeBridge protocol.
|
|
44
|
+
*/
|
|
45
|
+
readonly solanaChainIdEnum: number;
|
|
46
|
+
/**
|
|
47
|
+
* The chain ID used for Sonic in the DeBridge protocol.
|
|
48
|
+
*/
|
|
49
|
+
readonly sonicChainIdEnum: number;
|
|
50
|
+
/**
|
|
51
|
+
* Optional access token for the DeBridge API.
|
|
52
|
+
*/
|
|
53
|
+
readonly debridgeAccessToken: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new instance of the DeBridgeService.
|
|
56
|
+
*
|
|
57
|
+
* @param {IntentsSDKConfig & DeBridgeConfig} config - Configuration parameters for the service.
|
|
58
|
+
*
|
|
59
|
+
* @throws {SdkError} If no RPC URLs are provided for the supported blockchains.
|
|
60
|
+
*/
|
|
61
|
+
constructor(config?: IntentsSDKConfig & DeBridgeConfig);
|
|
62
|
+
isCorrectConfig<T extends {
|
|
63
|
+
[key: string]: string;
|
|
64
|
+
}>(config: {
|
|
65
|
+
[key: string]: string;
|
|
66
|
+
}): config is T;
|
|
67
|
+
/**
|
|
68
|
+
* Fetches a price quote for a cross-chain token swap from the DeBridge API.
|
|
69
|
+
*
|
|
70
|
+
* @param {IntentPriceParams} params - The parameters required for the price quote.
|
|
71
|
+
*
|
|
72
|
+
* @returns {Promise<PriceResponse>} A promise that resolves to a `PriceResponse` object containing:
|
|
73
|
+
* - The amount of output tokens expected from the swap.
|
|
74
|
+
* - The raw response from the DeBridge API.
|
|
75
|
+
*
|
|
76
|
+
* @throws {SdkError} If the parameters are invalid or unsupported.
|
|
77
|
+
* @throws {SdkError} If there's an error fetching the price from DeBridge.
|
|
78
|
+
*/
|
|
79
|
+
fetchPrice(params: IntentPriceParams): Promise<PriceResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Fetches a swap quote from the DeBridge API and builds the transaction data
|
|
82
|
+
* needed to execute the cross-chain swap.
|
|
83
|
+
*
|
|
84
|
+
* @param {IntentQuoteParams} params - The parameters required for the swap quote.
|
|
85
|
+
*
|
|
86
|
+
* @returns {Promise<QuoteResponse>} A promise that resolves to a `QuoteResponse` object containing:
|
|
87
|
+
* - The expected amount of output tokens.
|
|
88
|
+
* - The transaction data needed to execute the swap.
|
|
89
|
+
*
|
|
90
|
+
* @throws {SdkError} If the parameters are invalid or unsupported.
|
|
91
|
+
* @throws {SdkError} If the DeBridge API returns an invalid response.
|
|
92
|
+
* @throws {SdkError} If there's an error fetching the quote.
|
|
93
|
+
*/
|
|
94
|
+
fetchQuote(params: IntentQuoteParams): Promise<QuoteResponse>;
|
|
95
|
+
/**
|
|
96
|
+
* Converts a hexadecimal string representing a serialized transaction into a base58-encoded string.
|
|
97
|
+
*
|
|
98
|
+
* This method first decodes the input hex string into a buffer, deserializes it into a `VersionedTransaction`,
|
|
99
|
+
* then serializes the transaction and encodes the result using base58.
|
|
100
|
+
*
|
|
101
|
+
* @param hex - The hexadecimal string to convert. May optionally start with '0x'.
|
|
102
|
+
* @returns The base58-encoded string representation of the serialized transaction.
|
|
103
|
+
*/
|
|
104
|
+
formatSolanaTransaction(hex: string): Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Fetches a quote from the DeBridge DLN (Decentralized Liquidity Network) API.
|
|
107
|
+
*
|
|
108
|
+
* @param {DeBridgePriceParams & { to?: string; authority?: { networkInAddress: string; networkOutAddress: string; }}} params -
|
|
109
|
+
* The parameters for the quote request, including network IDs, token addresses, amounts, and authority addresses.
|
|
110
|
+
*
|
|
111
|
+
* @returns {Promise<DeBridgeQuoteResponse>} A promise that resolves to the quote response from DeBridge.
|
|
112
|
+
*
|
|
113
|
+
* @throws {SdkError} If there's an error with the HTTP request to the DeBridge API.
|
|
114
|
+
* @throws {Error} If the DeBridge API returns an error message.
|
|
115
|
+
*/
|
|
116
|
+
protected fetchDLNQuote(params: DeBridgePriceParams & {
|
|
117
|
+
to?: string;
|
|
118
|
+
authority?: {
|
|
119
|
+
networkInAddress: string;
|
|
120
|
+
networkOutAddress: string;
|
|
121
|
+
};
|
|
122
|
+
}): Promise<DeBridgeQuoteResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Validates the parameters for a price quote request.
|
|
125
|
+
*
|
|
126
|
+
* @param {IntentPriceParams} params - The parameters to validate.
|
|
127
|
+
*
|
|
128
|
+
* @throws {SdkError} If any of the parameters are invalid or unsupported.
|
|
129
|
+
*/
|
|
130
|
+
protected validatePriceParams(params: IntentPriceParams): void;
|
|
131
|
+
/**
|
|
132
|
+
* Validates the parameters for a quote request, extending the price parameters validation.
|
|
133
|
+
*
|
|
134
|
+
* @param {IntentQuoteParams} params - The parameters to validate.
|
|
135
|
+
*
|
|
136
|
+
* @throws {SdkError} If any of the parameters are invalid or missing.
|
|
137
|
+
*/
|
|
138
|
+
protected validateQuoteParams(params: IntentQuoteParams): void;
|
|
139
|
+
/**
|
|
140
|
+
* Transforms the price parameters to the format expected by the DeBridge API.
|
|
141
|
+
*
|
|
142
|
+
* @param {IntentPriceParams} params - The original price parameters.
|
|
143
|
+
*
|
|
144
|
+
* @returns {DeBridgePriceParams} The transformed parameters ready for the DeBridge API.
|
|
145
|
+
*/
|
|
146
|
+
protected transformPriceParams(params: IntentPriceParams): DeBridgePriceParams;
|
|
147
|
+
/**
|
|
148
|
+
* Transforms the quote parameters to the format expected by the DeBridge API.
|
|
149
|
+
*
|
|
150
|
+
* @param {IntentQuoteParams} params - The original quote parameters.
|
|
151
|
+
*
|
|
152
|
+
* @returns {DeBridgeQuoteParams} The transformed parameters ready for the DeBridge API.
|
|
153
|
+
*/
|
|
154
|
+
protected transformQuoteParams(params: IntentQuoteParams): DeBridgeQuoteParams;
|
|
155
|
+
protected isDeBridgePriceResponse(response: RawProtocolPriceResponse): response is DeBridgeQuoteResponse;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=debridge.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debridge.service.d.ts","sourceRoot":"","sources":["../../../../src/protocols/debridge/debridge.service.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mB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