@waiaas/actions 2.6.0-rc.7 → 2.6.0-rc.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/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -7
- package/dist/index.js.map +1 -1
- package/dist/providers/zerox-swap/config.d.ts +31 -0
- package/dist/providers/zerox-swap/config.d.ts.map +1 -0
- package/dist/providers/zerox-swap/config.js +70 -0
- package/dist/providers/zerox-swap/config.js.map +1 -0
- package/dist/providers/zerox-swap/index.d.ts +10 -0
- package/dist/providers/zerox-swap/index.d.ts.map +1 -0
- package/dist/providers/zerox-swap/index.js +131 -0
- package/dist/providers/zerox-swap/index.js.map +1 -0
- package/dist/providers/zerox-swap/schemas.d.ts +641 -0
- package/dist/providers/zerox-swap/schemas.d.ts.map +1 -0
- package/dist/providers/zerox-swap/schemas.js +59 -0
- package/dist/providers/zerox-swap/schemas.js.map +1 -0
- package/dist/providers/zerox-swap/zerox-api-client.d.ts +29 -0
- package/dist/providers/zerox-swap/zerox-api-client.d.ts.map +1 -0
- package/dist/providers/zerox-swap/zerox-api-client.js +43 -0
- package/dist/providers/zerox-swap/zerox-api-client.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -8,17 +8,26 @@ import type { IActionProvider } from '@waiaas/core';
|
|
|
8
8
|
export { JupiterSwapActionProvider } from './providers/jupiter-swap/index.js';
|
|
9
9
|
export { JUPITER_PROGRAM_ID, JUPITER_SWAP_DEFAULTS } from './providers/jupiter-swap/config.js';
|
|
10
10
|
export type { JupiterSwapConfig } from './providers/jupiter-swap/config.js';
|
|
11
|
+
export { ZeroExSwapActionProvider } from './providers/zerox-swap/index.js';
|
|
12
|
+
export { ALLOWANCE_HOLDER_ADDRESSES, ZEROX_SWAP_DEFAULTS, CHAIN_ID_MAP, getAllowanceHolderAddress } from './providers/zerox-swap/config.js';
|
|
13
|
+
export type { ZeroExSwapConfig } from './providers/zerox-swap/config.js';
|
|
11
14
|
export { ActionApiClient } from './common/action-api-client.js';
|
|
12
15
|
export { asBps, asPct, clampSlippageBps, bpsToPct, pctToBps } from './common/slippage.js';
|
|
13
16
|
export type { SlippageBps, SlippagePct } from './common/slippage.js';
|
|
14
|
-
interface
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
/** Minimal settings reader interface compatible with SettingsService.get(). */
|
|
18
|
+
export interface SettingsReader {
|
|
19
|
+
get(key: string): string;
|
|
17
20
|
}
|
|
18
21
|
interface ProviderRegistry {
|
|
19
22
|
register(provider: IActionProvider): void;
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Register built-in DeFi action providers from Admin Settings.
|
|
26
|
+
*
|
|
27
|
+
* Reads provider config from SettingsReader (DB > config.toml > default fallback chain).
|
|
28
|
+
* Each provider is registered when its `actions.{name}_enabled` setting is 'true'.
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerBuiltInProviders(registry: ProviderRegistry, settingsReader: SettingsReader): {
|
|
22
31
|
loaded: string[];
|
|
23
32
|
skipped: string[];
|
|
24
33
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAKpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC/F,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC5I,YAAY,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1F,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMrE,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,gBAAgB,EAC1B,cAAc,EAAE,cAAc,GAC7B;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CA8DzC"}
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,66 @@
|
|
|
1
1
|
import { JupiterSwapActionProvider } from './providers/jupiter-swap/index.js';
|
|
2
|
+
import { ZeroExSwapActionProvider } from './providers/zerox-swap/index.js';
|
|
2
3
|
// Re-export provider classes
|
|
3
4
|
export { JupiterSwapActionProvider } from './providers/jupiter-swap/index.js';
|
|
4
5
|
export { JUPITER_PROGRAM_ID, JUPITER_SWAP_DEFAULTS } from './providers/jupiter-swap/config.js';
|
|
6
|
+
export { ZeroExSwapActionProvider } from './providers/zerox-swap/index.js';
|
|
7
|
+
export { ALLOWANCE_HOLDER_ADDRESSES, ZEROX_SWAP_DEFAULTS, CHAIN_ID_MAP, getAllowanceHolderAddress } from './providers/zerox-swap/config.js';
|
|
5
8
|
// Re-export common utilities
|
|
6
9
|
export { ActionApiClient } from './common/action-api-client.js';
|
|
7
10
|
export { asBps, asPct, clampSlippageBps, bpsToPct, pctToBps } from './common/slippage.js';
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Register built-in DeFi action providers from Admin Settings.
|
|
13
|
+
*
|
|
14
|
+
* Reads provider config from SettingsReader (DB > config.toml > default fallback chain).
|
|
15
|
+
* Each provider is registered when its `actions.{name}_enabled` setting is 'true'.
|
|
16
|
+
*/
|
|
17
|
+
export function registerBuiltInProviders(registry, settingsReader) {
|
|
9
18
|
const loaded = [];
|
|
10
19
|
const skipped = [];
|
|
11
20
|
const providers = [
|
|
12
21
|
{
|
|
13
22
|
key: 'jupiter_swap',
|
|
14
|
-
|
|
23
|
+
enabledKey: 'actions.jupiter_swap_enabled',
|
|
24
|
+
factory: () => {
|
|
25
|
+
const config = {
|
|
26
|
+
enabled: true,
|
|
27
|
+
apiBaseUrl: settingsReader.get('actions.jupiter_swap_api_base_url'),
|
|
28
|
+
apiKey: settingsReader.get('actions.jupiter_swap_api_key'),
|
|
29
|
+
defaultSlippageBps: Number(settingsReader.get('actions.jupiter_swap_default_slippage_bps')),
|
|
30
|
+
maxSlippageBps: Number(settingsReader.get('actions.jupiter_swap_max_slippage_bps')),
|
|
31
|
+
maxPriceImpactPct: Number(settingsReader.get('actions.jupiter_swap_max_price_impact_pct')),
|
|
32
|
+
jitoTipLamports: Number(settingsReader.get('actions.jupiter_swap_jito_tip_lamports')),
|
|
33
|
+
requestTimeoutMs: Number(settingsReader.get('actions.jupiter_swap_request_timeout_ms')),
|
|
34
|
+
};
|
|
35
|
+
return new JupiterSwapActionProvider(config);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'zerox_swap',
|
|
40
|
+
enabledKey: 'actions.zerox_swap_enabled',
|
|
41
|
+
factory: () => {
|
|
42
|
+
const config = {
|
|
43
|
+
enabled: true,
|
|
44
|
+
apiKey: settingsReader.get('actions.zerox_swap_api_key'),
|
|
45
|
+
defaultSlippageBps: Number(settingsReader.get('actions.zerox_swap_default_slippage_bps')),
|
|
46
|
+
maxSlippageBps: Number(settingsReader.get('actions.zerox_swap_max_slippage_bps')),
|
|
47
|
+
requestTimeoutMs: Number(settingsReader.get('actions.zerox_swap_request_timeout_ms')),
|
|
48
|
+
};
|
|
49
|
+
return new ZeroExSwapActionProvider(config);
|
|
50
|
+
},
|
|
15
51
|
},
|
|
16
52
|
];
|
|
17
|
-
for (const { key, factory } of providers) {
|
|
18
|
-
|
|
19
|
-
if (cfg?.enabled) {
|
|
53
|
+
for (const { key, enabledKey, factory } of providers) {
|
|
54
|
+
if (settingsReader.get(enabledKey) === 'true') {
|
|
20
55
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
56
|
+
const provider = factory();
|
|
57
|
+
if (provider) {
|
|
58
|
+
registry.register(provider);
|
|
59
|
+
loaded.push(key);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
skipped.push(key);
|
|
63
|
+
}
|
|
23
64
|
}
|
|
24
65
|
catch (err) {
|
|
25
66
|
console.warn(`Built-in provider '${key}' registration failed:`, err);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,6BAA6B;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC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E,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0x Swap configuration type, defaults, and AllowanceHolder address mapping.
|
|
3
|
+
*
|
|
4
|
+
* Uses 0x Swap API v2 with the AllowanceHolder flow (not Permit2).
|
|
5
|
+
* See: https://0x.org/docs/api#tag/Swap
|
|
6
|
+
*/
|
|
7
|
+
export interface ZeroExSwapConfig {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
apiBaseUrl: string;
|
|
10
|
+
apiKey: string;
|
|
11
|
+
defaultSlippageBps: number;
|
|
12
|
+
maxSlippageBps: number;
|
|
13
|
+
requestTimeoutMs: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const ZEROX_SWAP_DEFAULTS: ZeroExSwapConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Supported chain IDs for 0x Swap API v2 AllowanceHolder flow.
|
|
18
|
+
* Cancun 19 chains + Mantle = 20 total.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ALLOWANCE_HOLDER_ADDRESSES: ReadonlyMap<number, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Get AllowanceHolder contract address for a given chain ID.
|
|
23
|
+
* @throws Error if chain ID is not supported by 0x Swap API.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAllowanceHolderAddress(chainId: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Maps WAIaaS network type names to EVM chain IDs.
|
|
28
|
+
* Only includes mainnet networks that are supported by both WAIaaS and 0x API.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CHAIN_ID_MAP: Record<string, number>;
|
|
31
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/providers/zerox-swap/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,mBAAmB,EAAE,gBAOjC,CAAC;AAQF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAqBjE,CAAC;AAEH;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQjE;AAMD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM/C,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0x Swap configuration type, defaults, and AllowanceHolder address mapping.
|
|
3
|
+
*
|
|
4
|
+
* Uses 0x Swap API v2 with the AllowanceHolder flow (not Permit2).
|
|
5
|
+
* See: https://0x.org/docs/api#tag/Swap
|
|
6
|
+
*/
|
|
7
|
+
export const ZEROX_SWAP_DEFAULTS = {
|
|
8
|
+
enabled: false,
|
|
9
|
+
apiBaseUrl: 'https://api.0x.org',
|
|
10
|
+
apiKey: '',
|
|
11
|
+
defaultSlippageBps: 100, // 1% (ZXSW-06)
|
|
12
|
+
maxSlippageBps: 500, // 5% (ZXSW-06)
|
|
13
|
+
requestTimeoutMs: 10_000, // (ZXSW-10)
|
|
14
|
+
};
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// AllowanceHolder contract address (same on all supported chains) (ZXSW-09)
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
const ALLOWANCE_HOLDER_ADDRESS = '0x0000000000001fF3684f28c67538d4D072C22734';
|
|
19
|
+
/**
|
|
20
|
+
* Supported chain IDs for 0x Swap API v2 AllowanceHolder flow.
|
|
21
|
+
* Cancun 19 chains + Mantle = 20 total.
|
|
22
|
+
*/
|
|
23
|
+
export const ALLOWANCE_HOLDER_ADDRESSES = new Map([
|
|
24
|
+
[1, ALLOWANCE_HOLDER_ADDRESS], // Ethereum
|
|
25
|
+
[10, ALLOWANCE_HOLDER_ADDRESS], // Optimism
|
|
26
|
+
[56, ALLOWANCE_HOLDER_ADDRESS], // BNB Chain
|
|
27
|
+
[130, ALLOWANCE_HOLDER_ADDRESS], // Unichain
|
|
28
|
+
[137, ALLOWANCE_HOLDER_ADDRESS], // Polygon
|
|
29
|
+
[1329, ALLOWANCE_HOLDER_ADDRESS], // SEI
|
|
30
|
+
[1868, ALLOWANCE_HOLDER_ADDRESS], // Soneium
|
|
31
|
+
[2741, ALLOWANCE_HOLDER_ADDRESS], // Abstract
|
|
32
|
+
[5000, ALLOWANCE_HOLDER_ADDRESS], // Mantle
|
|
33
|
+
[8453, ALLOWANCE_HOLDER_ADDRESS], // Base
|
|
34
|
+
[33139, ALLOWANCE_HOLDER_ADDRESS], // Apechain
|
|
35
|
+
[34443, ALLOWANCE_HOLDER_ADDRESS], // Mode
|
|
36
|
+
[42161, ALLOWANCE_HOLDER_ADDRESS], // Arbitrum
|
|
37
|
+
[42220, ALLOWANCE_HOLDER_ADDRESS], // Celo
|
|
38
|
+
[43114, ALLOWANCE_HOLDER_ADDRESS], // Avalanche
|
|
39
|
+
[57073, ALLOWANCE_HOLDER_ADDRESS], // Ink
|
|
40
|
+
[59144, ALLOWANCE_HOLDER_ADDRESS], // Linea
|
|
41
|
+
[80084, ALLOWANCE_HOLDER_ADDRESS], // Berachain
|
|
42
|
+
[81457, ALLOWANCE_HOLDER_ADDRESS], // Blast
|
|
43
|
+
[534352, ALLOWANCE_HOLDER_ADDRESS], // Scroll
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* Get AllowanceHolder contract address for a given chain ID.
|
|
47
|
+
* @throws Error if chain ID is not supported by 0x Swap API.
|
|
48
|
+
*/
|
|
49
|
+
export function getAllowanceHolderAddress(chainId) {
|
|
50
|
+
const address = ALLOWANCE_HOLDER_ADDRESSES.get(chainId);
|
|
51
|
+
if (!address) {
|
|
52
|
+
throw new Error(`Unsupported chain ID ${chainId} for 0x Swap. Supported: ${[...ALLOWANCE_HOLDER_ADDRESSES.keys()].join(', ')}`);
|
|
53
|
+
}
|
|
54
|
+
return address;
|
|
55
|
+
}
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Network name -> Chain ID mapping (only networks in NETWORK_TYPES)
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
/**
|
|
60
|
+
* Maps WAIaaS network type names to EVM chain IDs.
|
|
61
|
+
* Only includes mainnet networks that are supported by both WAIaaS and 0x API.
|
|
62
|
+
*/
|
|
63
|
+
export const CHAIN_ID_MAP = {
|
|
64
|
+
'ethereum-mainnet': 1,
|
|
65
|
+
'polygon-mainnet': 137,
|
|
66
|
+
'arbitrum-mainnet': 42161,
|
|
67
|
+
'optimism-mainnet': 10,
|
|
68
|
+
'base-mainnet': 8453,
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/providers/zerox-swap/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,MAAM,CAAC,MAAM,mBAAmB,GAAqB;IACnD,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,oBAAoB;IAChC,MAAM,EAAE,EAAE;IACV,kBAAkB,EAAE,GAAG,EAAI,eAAe;IAC1C,cAAc,EAAE,GAAG,EAAQ,eAAe;IAC1C,gBAAgB,EAAE,MAAM,EAAG,YAAY;CACxC,CAAC;AAEF,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAE9E,MAAM,wBAAwB,GAAG,4CAA4C,CAAC;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAgC,IAAI,GAAG,CAAC;IAC7E,CAAC,CAAC,EA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CAAC,GAAG,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,kBAAkB,EAAE,CAAC;IACrB,iBAAiB,EAAE,GAAG;IACtB,kBAAkB,EAAE,KAAK;IACzB,kBAAkB,EAAE,EAAE;IACtB,cAAc,EAAE,IAAI;CACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IActionProvider, ActionProviderMetadata, ActionDefinition, ActionContext, ContractCallRequest } from '@waiaas/core';
|
|
2
|
+
import { type ZeroExSwapConfig } from './config.js';
|
|
3
|
+
export declare class ZeroExSwapActionProvider implements IActionProvider {
|
|
4
|
+
readonly metadata: ActionProviderMetadata;
|
|
5
|
+
readonly actions: readonly ActionDefinition[];
|
|
6
|
+
private readonly config;
|
|
7
|
+
constructor(config?: Partial<ZeroExSwapConfig>);
|
|
8
|
+
resolve(actionName: string, params: Record<string, unknown>, context: ActionContext): Promise<ContractCallRequest[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/zerox-swap/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,aAAa,CAAC;AAwCrB,qBAAa,wBAAyB,YAAW,eAAe;IAC9D,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAE9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;gBAE9B,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAyBxC,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC;CA4ElC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0x Swap Action Provider.
|
|
3
|
+
*
|
|
4
|
+
* Implements IActionProvider to resolve 0x DEX swap requests
|
|
5
|
+
* into ContractCallRequest arrays for the sequential pipeline.
|
|
6
|
+
*
|
|
7
|
+
* ERC-20 sells produce [approve, swap] (2 elements).
|
|
8
|
+
* Native ETH sells produce [swap] (1 element).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { ChainError } from '@waiaas/core';
|
|
12
|
+
import { ZeroExApiClient } from './zerox-api-client.js';
|
|
13
|
+
import { ZEROX_SWAP_DEFAULTS, getAllowanceHolderAddress, CHAIN_ID_MAP, } from './config.js';
|
|
14
|
+
import { clampSlippageBps, asBps } from '../../common/slippage.js';
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Native ETH placeholder address used by 0x API
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
const NATIVE_ETH_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// ERC-20 approve calldata encoder
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
/**
|
|
23
|
+
* Encode ERC-20 approve(address spender, uint256 amount) calldata.
|
|
24
|
+
* Function selector: 0x095ea7b3
|
|
25
|
+
*/
|
|
26
|
+
function encodeApproveCalldata(spender, amount) {
|
|
27
|
+
const selector = '0x095ea7b3';
|
|
28
|
+
const paddedSpender = spender.slice(2).toLowerCase().padStart(64, '0');
|
|
29
|
+
const paddedAmount = BigInt(amount).toString(16).padStart(64, '0');
|
|
30
|
+
return `${selector}${paddedSpender}${paddedAmount}`;
|
|
31
|
+
}
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Input schema for the swap action
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
const SwapInputSchema = z.object({
|
|
36
|
+
sellToken: z.string().min(1, 'sellToken is required'),
|
|
37
|
+
buyToken: z.string().min(1, 'buyToken is required'),
|
|
38
|
+
sellAmount: z.string().min(1, 'sellAmount is required (in smallest units)'),
|
|
39
|
+
slippageBps: z.number().int().optional(),
|
|
40
|
+
chainId: z.number().int().optional(),
|
|
41
|
+
});
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Provider implementation
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
export class ZeroExSwapActionProvider {
|
|
46
|
+
metadata;
|
|
47
|
+
actions;
|
|
48
|
+
config;
|
|
49
|
+
constructor(config) {
|
|
50
|
+
this.config = { ...ZEROX_SWAP_DEFAULTS, ...config };
|
|
51
|
+
this.metadata = {
|
|
52
|
+
name: 'zerox_swap',
|
|
53
|
+
description: '0x DEX aggregator for EVM token swaps via AllowanceHolder flow',
|
|
54
|
+
version: '1.0.0',
|
|
55
|
+
chains: ['ethereum'],
|
|
56
|
+
mcpExpose: true,
|
|
57
|
+
requiresApiKey: true,
|
|
58
|
+
requiredApis: ['0x'],
|
|
59
|
+
};
|
|
60
|
+
this.actions = [
|
|
61
|
+
{
|
|
62
|
+
name: 'swap',
|
|
63
|
+
description: 'Swap tokens on EVM chains via 0x aggregator with slippage protection and AllowanceHolder approval',
|
|
64
|
+
chain: 'ethereum',
|
|
65
|
+
inputSchema: SwapInputSchema,
|
|
66
|
+
riskLevel: 'medium',
|
|
67
|
+
defaultTier: 'DELAY',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
async resolve(actionName, params, context) {
|
|
72
|
+
// Validate action name
|
|
73
|
+
if (actionName !== 'swap') {
|
|
74
|
+
throw new ChainError('INVALID_INSTRUCTION', 'ethereum', { message: `Unknown action: ${actionName}` });
|
|
75
|
+
}
|
|
76
|
+
// Parse and validate input
|
|
77
|
+
const input = SwapInputSchema.parse(params);
|
|
78
|
+
// SAFE-05: Block same-token swap
|
|
79
|
+
if (input.sellToken.toLowerCase() === input.buyToken.toLowerCase()) {
|
|
80
|
+
throw new ChainError('INVALID_INSTRUCTION', 'ethereum', { message: 'Cannot swap a token for itself' });
|
|
81
|
+
}
|
|
82
|
+
// Resolve chainId: explicit input > CHAIN_ID_MAP lookup > default 1 (Ethereum mainnet)
|
|
83
|
+
const chainId = input.chainId ?? CHAIN_ID_MAP['ethereum-mainnet'] ?? 1;
|
|
84
|
+
// ZXSW-06: Clamp slippage -- default 100bps (1%), max 500bps (5%)
|
|
85
|
+
const slippageBps = clampSlippageBps(input.slippageBps ?? 0, asBps(this.config.defaultSlippageBps), asBps(this.config.maxSlippageBps));
|
|
86
|
+
// Create API client with resolved chainId
|
|
87
|
+
const apiClient = new ZeroExApiClient(this.config, chainId);
|
|
88
|
+
// Get quote from 0x API
|
|
89
|
+
const quote = await apiClient.getQuote({
|
|
90
|
+
sellToken: input.sellToken,
|
|
91
|
+
buyToken: input.buyToken,
|
|
92
|
+
sellAmount: input.sellAmount,
|
|
93
|
+
taker: context.walletAddress,
|
|
94
|
+
slippageBps,
|
|
95
|
+
});
|
|
96
|
+
// ZXSW-07: Check liquidity availability
|
|
97
|
+
if (!quote.liquidityAvailable) {
|
|
98
|
+
throw new ChainError('INVALID_INSTRUCTION', 'ethereum', {
|
|
99
|
+
message: 'No liquidity available for this swap pair',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// ZXSW-09: Validate AllowanceHolder address
|
|
103
|
+
const expectedAllowanceHolder = getAllowanceHolderAddress(chainId);
|
|
104
|
+
if (quote.transaction.to.toLowerCase() !== expectedAllowanceHolder.toLowerCase()) {
|
|
105
|
+
throw new ChainError('INVALID_INSTRUCTION', 'ethereum', {
|
|
106
|
+
message: `AllowanceHolder address mismatch: expected ${expectedAllowanceHolder}, got ${quote.transaction.to}`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// Build result array
|
|
110
|
+
const isNativeEthSell = input.sellToken.toLowerCase() === NATIVE_ETH_ADDRESS;
|
|
111
|
+
const swapRequest = {
|
|
112
|
+
type: 'CONTRACT_CALL',
|
|
113
|
+
to: quote.transaction.to,
|
|
114
|
+
calldata: quote.transaction.data,
|
|
115
|
+
value: quote.transaction.value,
|
|
116
|
+
};
|
|
117
|
+
if (isNativeEthSell) {
|
|
118
|
+
// Native ETH sell: single swap element
|
|
119
|
+
return [swapRequest];
|
|
120
|
+
}
|
|
121
|
+
// ERC-20 sell: approve + swap (ZXSW-04)
|
|
122
|
+
const approveRequest = {
|
|
123
|
+
type: 'CONTRACT_CALL',
|
|
124
|
+
to: input.sellToken,
|
|
125
|
+
calldata: encodeApproveCalldata(expectedAllowanceHolder, input.sellAmount),
|
|
126
|
+
value: '0',
|
|
127
|
+
};
|
|
128
|
+
return [approveRequest, swapRequest];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/zerox-swap/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAEL,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;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AAK,CAAC,WAAW,CAAC,EAAE;YACxB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI;YAChC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK;SAC/B,CAAC;QAEF,IAAI,eAAe,EAAE,CAAC;YACpB,uCAAuC;YACvC,OAAO,CAAC,WAAW,CAAC,CAAC;QACvB,CAAC;QAED,wCAAwC;QACxC,MAAM,cAAc,GAAwB;YAC1C,IAAI,EAAE,eAAe;YACrB,EAAE,EAAE,KAAK,CAAC,SAAS;YACnB,QAAQ,EAAE,qBAAqB,CAAC,uBAAuB,EAAE,KAAK,CAAC,UAAU,CAAC;YAC1E,KAAK,EAAE,GAAG;SACX,CAAC;QAEF,OAAO,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for 0x Swap API v2 responses.
|
|
3
|
+
* Runtime validation to detect API drift early.
|
|
4
|
+
*
|
|
5
|
+
* Endpoints:
|
|
6
|
+
* - /swap/allowance-holder/price -> PriceResponseSchema
|
|
7
|
+
* - /swap/allowance-holder/quote -> QuoteResponseSchema
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const PriceResponseSchema: z.ZodObject<{
|
|
11
|
+
blockNumber: z.ZodString;
|
|
12
|
+
buyAmount: z.ZodString;
|
|
13
|
+
buyToken: z.ZodString;
|
|
14
|
+
fees: z.ZodObject<{
|
|
15
|
+
integratorFee: z.ZodNullable<z.ZodUnknown>;
|
|
16
|
+
zeroExFee: z.ZodNullable<z.ZodObject<{
|
|
17
|
+
amount: z.ZodString;
|
|
18
|
+
token: z.ZodString;
|
|
19
|
+
type: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
type: string;
|
|
22
|
+
amount: string;
|
|
23
|
+
token: string;
|
|
24
|
+
}, {
|
|
25
|
+
type: string;
|
|
26
|
+
amount: string;
|
|
27
|
+
token: string;
|
|
28
|
+
}>>;
|
|
29
|
+
gasFee: z.ZodNullable<z.ZodUnknown>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
zeroExFee: {
|
|
32
|
+
type: string;
|
|
33
|
+
amount: string;
|
|
34
|
+
token: string;
|
|
35
|
+
} | null;
|
|
36
|
+
integratorFee?: unknown;
|
|
37
|
+
gasFee?: unknown;
|
|
38
|
+
}, {
|
|
39
|
+
zeroExFee: {
|
|
40
|
+
type: string;
|
|
41
|
+
amount: string;
|
|
42
|
+
token: string;
|
|
43
|
+
} | null;
|
|
44
|
+
integratorFee?: unknown;
|
|
45
|
+
gasFee?: unknown;
|
|
46
|
+
}>;
|
|
47
|
+
gas: z.ZodString;
|
|
48
|
+
gasPrice: z.ZodString;
|
|
49
|
+
liquidityAvailable: z.ZodBoolean;
|
|
50
|
+
minBuyAmount: z.ZodString;
|
|
51
|
+
route: z.ZodObject<{
|
|
52
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
53
|
+
from: z.ZodString;
|
|
54
|
+
to: z.ZodString;
|
|
55
|
+
source: z.ZodString;
|
|
56
|
+
proportionBps: z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
from: string;
|
|
59
|
+
to: string;
|
|
60
|
+
source: string;
|
|
61
|
+
proportionBps: string;
|
|
62
|
+
}, {
|
|
63
|
+
from: string;
|
|
64
|
+
to: string;
|
|
65
|
+
source: string;
|
|
66
|
+
proportionBps: string;
|
|
67
|
+
}>, "many">;
|
|
68
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
69
|
+
address: z.ZodString;
|
|
70
|
+
symbol: z.ZodString;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
symbol: string;
|
|
73
|
+
address: string;
|
|
74
|
+
}, {
|
|
75
|
+
symbol: string;
|
|
76
|
+
address: string;
|
|
77
|
+
}>, "many">;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
fills: {
|
|
80
|
+
from: string;
|
|
81
|
+
to: string;
|
|
82
|
+
source: string;
|
|
83
|
+
proportionBps: string;
|
|
84
|
+
}[];
|
|
85
|
+
tokens: {
|
|
86
|
+
symbol: string;
|
|
87
|
+
address: string;
|
|
88
|
+
}[];
|
|
89
|
+
}, {
|
|
90
|
+
fills: {
|
|
91
|
+
from: string;
|
|
92
|
+
to: string;
|
|
93
|
+
source: string;
|
|
94
|
+
proportionBps: string;
|
|
95
|
+
}[];
|
|
96
|
+
tokens: {
|
|
97
|
+
symbol: string;
|
|
98
|
+
address: string;
|
|
99
|
+
}[];
|
|
100
|
+
}>;
|
|
101
|
+
sellAmount: z.ZodString;
|
|
102
|
+
sellToken: z.ZodString;
|
|
103
|
+
totalNetworkFee: z.ZodString;
|
|
104
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
105
|
+
blockNumber: z.ZodString;
|
|
106
|
+
buyAmount: z.ZodString;
|
|
107
|
+
buyToken: z.ZodString;
|
|
108
|
+
fees: z.ZodObject<{
|
|
109
|
+
integratorFee: z.ZodNullable<z.ZodUnknown>;
|
|
110
|
+
zeroExFee: z.ZodNullable<z.ZodObject<{
|
|
111
|
+
amount: z.ZodString;
|
|
112
|
+
token: z.ZodString;
|
|
113
|
+
type: z.ZodString;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
type: string;
|
|
116
|
+
amount: string;
|
|
117
|
+
token: string;
|
|
118
|
+
}, {
|
|
119
|
+
type: string;
|
|
120
|
+
amount: string;
|
|
121
|
+
token: string;
|
|
122
|
+
}>>;
|
|
123
|
+
gasFee: z.ZodNullable<z.ZodUnknown>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
zeroExFee: {
|
|
126
|
+
type: string;
|
|
127
|
+
amount: string;
|
|
128
|
+
token: string;
|
|
129
|
+
} | null;
|
|
130
|
+
integratorFee?: unknown;
|
|
131
|
+
gasFee?: unknown;
|
|
132
|
+
}, {
|
|
133
|
+
zeroExFee: {
|
|
134
|
+
type: string;
|
|
135
|
+
amount: string;
|
|
136
|
+
token: string;
|
|
137
|
+
} | null;
|
|
138
|
+
integratorFee?: unknown;
|
|
139
|
+
gasFee?: unknown;
|
|
140
|
+
}>;
|
|
141
|
+
gas: z.ZodString;
|
|
142
|
+
gasPrice: z.ZodString;
|
|
143
|
+
liquidityAvailable: z.ZodBoolean;
|
|
144
|
+
minBuyAmount: z.ZodString;
|
|
145
|
+
route: z.ZodObject<{
|
|
146
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
147
|
+
from: z.ZodString;
|
|
148
|
+
to: z.ZodString;
|
|
149
|
+
source: z.ZodString;
|
|
150
|
+
proportionBps: z.ZodString;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
from: string;
|
|
153
|
+
to: string;
|
|
154
|
+
source: string;
|
|
155
|
+
proportionBps: string;
|
|
156
|
+
}, {
|
|
157
|
+
from: string;
|
|
158
|
+
to: string;
|
|
159
|
+
source: string;
|
|
160
|
+
proportionBps: string;
|
|
161
|
+
}>, "many">;
|
|
162
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
163
|
+
address: z.ZodString;
|
|
164
|
+
symbol: z.ZodString;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
symbol: string;
|
|
167
|
+
address: string;
|
|
168
|
+
}, {
|
|
169
|
+
symbol: string;
|
|
170
|
+
address: string;
|
|
171
|
+
}>, "many">;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
fills: {
|
|
174
|
+
from: string;
|
|
175
|
+
to: string;
|
|
176
|
+
source: string;
|
|
177
|
+
proportionBps: string;
|
|
178
|
+
}[];
|
|
179
|
+
tokens: {
|
|
180
|
+
symbol: string;
|
|
181
|
+
address: string;
|
|
182
|
+
}[];
|
|
183
|
+
}, {
|
|
184
|
+
fills: {
|
|
185
|
+
from: string;
|
|
186
|
+
to: string;
|
|
187
|
+
source: string;
|
|
188
|
+
proportionBps: string;
|
|
189
|
+
}[];
|
|
190
|
+
tokens: {
|
|
191
|
+
symbol: string;
|
|
192
|
+
address: string;
|
|
193
|
+
}[];
|
|
194
|
+
}>;
|
|
195
|
+
sellAmount: z.ZodString;
|
|
196
|
+
sellToken: z.ZodString;
|
|
197
|
+
totalNetworkFee: z.ZodString;
|
|
198
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
199
|
+
blockNumber: z.ZodString;
|
|
200
|
+
buyAmount: z.ZodString;
|
|
201
|
+
buyToken: z.ZodString;
|
|
202
|
+
fees: z.ZodObject<{
|
|
203
|
+
integratorFee: z.ZodNullable<z.ZodUnknown>;
|
|
204
|
+
zeroExFee: z.ZodNullable<z.ZodObject<{
|
|
205
|
+
amount: z.ZodString;
|
|
206
|
+
token: z.ZodString;
|
|
207
|
+
type: z.ZodString;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
type: string;
|
|
210
|
+
amount: string;
|
|
211
|
+
token: string;
|
|
212
|
+
}, {
|
|
213
|
+
type: string;
|
|
214
|
+
amount: string;
|
|
215
|
+
token: string;
|
|
216
|
+
}>>;
|
|
217
|
+
gasFee: z.ZodNullable<z.ZodUnknown>;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
zeroExFee: {
|
|
220
|
+
type: string;
|
|
221
|
+
amount: string;
|
|
222
|
+
token: string;
|
|
223
|
+
} | null;
|
|
224
|
+
integratorFee?: unknown;
|
|
225
|
+
gasFee?: unknown;
|
|
226
|
+
}, {
|
|
227
|
+
zeroExFee: {
|
|
228
|
+
type: string;
|
|
229
|
+
amount: string;
|
|
230
|
+
token: string;
|
|
231
|
+
} | null;
|
|
232
|
+
integratorFee?: unknown;
|
|
233
|
+
gasFee?: unknown;
|
|
234
|
+
}>;
|
|
235
|
+
gas: z.ZodString;
|
|
236
|
+
gasPrice: z.ZodString;
|
|
237
|
+
liquidityAvailable: z.ZodBoolean;
|
|
238
|
+
minBuyAmount: z.ZodString;
|
|
239
|
+
route: z.ZodObject<{
|
|
240
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
241
|
+
from: z.ZodString;
|
|
242
|
+
to: z.ZodString;
|
|
243
|
+
source: z.ZodString;
|
|
244
|
+
proportionBps: z.ZodString;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
from: string;
|
|
247
|
+
to: string;
|
|
248
|
+
source: string;
|
|
249
|
+
proportionBps: string;
|
|
250
|
+
}, {
|
|
251
|
+
from: string;
|
|
252
|
+
to: string;
|
|
253
|
+
source: string;
|
|
254
|
+
proportionBps: string;
|
|
255
|
+
}>, "many">;
|
|
256
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
257
|
+
address: z.ZodString;
|
|
258
|
+
symbol: z.ZodString;
|
|
259
|
+
}, "strip", z.ZodTypeAny, {
|
|
260
|
+
symbol: string;
|
|
261
|
+
address: string;
|
|
262
|
+
}, {
|
|
263
|
+
symbol: string;
|
|
264
|
+
address: string;
|
|
265
|
+
}>, "many">;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
fills: {
|
|
268
|
+
from: string;
|
|
269
|
+
to: string;
|
|
270
|
+
source: string;
|
|
271
|
+
proportionBps: string;
|
|
272
|
+
}[];
|
|
273
|
+
tokens: {
|
|
274
|
+
symbol: string;
|
|
275
|
+
address: string;
|
|
276
|
+
}[];
|
|
277
|
+
}, {
|
|
278
|
+
fills: {
|
|
279
|
+
from: string;
|
|
280
|
+
to: string;
|
|
281
|
+
source: string;
|
|
282
|
+
proportionBps: string;
|
|
283
|
+
}[];
|
|
284
|
+
tokens: {
|
|
285
|
+
symbol: string;
|
|
286
|
+
address: string;
|
|
287
|
+
}[];
|
|
288
|
+
}>;
|
|
289
|
+
sellAmount: z.ZodString;
|
|
290
|
+
sellToken: z.ZodString;
|
|
291
|
+
totalNetworkFee: z.ZodString;
|
|
292
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
293
|
+
export type PriceResponse = z.infer<typeof PriceResponseSchema>;
|
|
294
|
+
export declare const QuoteResponseSchema: z.ZodObject<{
|
|
295
|
+
blockNumber: z.ZodString;
|
|
296
|
+
buyAmount: z.ZodString;
|
|
297
|
+
buyToken: z.ZodString;
|
|
298
|
+
fees: z.ZodObject<{
|
|
299
|
+
integratorFee: z.ZodNullable<z.ZodUnknown>;
|
|
300
|
+
zeroExFee: z.ZodNullable<z.ZodObject<{
|
|
301
|
+
amount: z.ZodString;
|
|
302
|
+
token: z.ZodString;
|
|
303
|
+
type: z.ZodString;
|
|
304
|
+
}, "strip", z.ZodTypeAny, {
|
|
305
|
+
type: string;
|
|
306
|
+
amount: string;
|
|
307
|
+
token: string;
|
|
308
|
+
}, {
|
|
309
|
+
type: string;
|
|
310
|
+
amount: string;
|
|
311
|
+
token: string;
|
|
312
|
+
}>>;
|
|
313
|
+
gasFee: z.ZodNullable<z.ZodUnknown>;
|
|
314
|
+
}, "strip", z.ZodTypeAny, {
|
|
315
|
+
zeroExFee: {
|
|
316
|
+
type: string;
|
|
317
|
+
amount: string;
|
|
318
|
+
token: string;
|
|
319
|
+
} | null;
|
|
320
|
+
integratorFee?: unknown;
|
|
321
|
+
gasFee?: unknown;
|
|
322
|
+
}, {
|
|
323
|
+
zeroExFee: {
|
|
324
|
+
type: string;
|
|
325
|
+
amount: string;
|
|
326
|
+
token: string;
|
|
327
|
+
} | null;
|
|
328
|
+
integratorFee?: unknown;
|
|
329
|
+
gasFee?: unknown;
|
|
330
|
+
}>;
|
|
331
|
+
gas: z.ZodString;
|
|
332
|
+
gasPrice: z.ZodString;
|
|
333
|
+
liquidityAvailable: z.ZodBoolean;
|
|
334
|
+
minBuyAmount: z.ZodString;
|
|
335
|
+
route: z.ZodObject<{
|
|
336
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
337
|
+
from: z.ZodString;
|
|
338
|
+
to: z.ZodString;
|
|
339
|
+
source: z.ZodString;
|
|
340
|
+
proportionBps: z.ZodString;
|
|
341
|
+
}, "strip", z.ZodTypeAny, {
|
|
342
|
+
from: string;
|
|
343
|
+
to: string;
|
|
344
|
+
source: string;
|
|
345
|
+
proportionBps: string;
|
|
346
|
+
}, {
|
|
347
|
+
from: string;
|
|
348
|
+
to: string;
|
|
349
|
+
source: string;
|
|
350
|
+
proportionBps: string;
|
|
351
|
+
}>, "many">;
|
|
352
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
353
|
+
address: z.ZodString;
|
|
354
|
+
symbol: z.ZodString;
|
|
355
|
+
}, "strip", z.ZodTypeAny, {
|
|
356
|
+
symbol: string;
|
|
357
|
+
address: string;
|
|
358
|
+
}, {
|
|
359
|
+
symbol: string;
|
|
360
|
+
address: string;
|
|
361
|
+
}>, "many">;
|
|
362
|
+
}, "strip", z.ZodTypeAny, {
|
|
363
|
+
fills: {
|
|
364
|
+
from: string;
|
|
365
|
+
to: string;
|
|
366
|
+
source: string;
|
|
367
|
+
proportionBps: string;
|
|
368
|
+
}[];
|
|
369
|
+
tokens: {
|
|
370
|
+
symbol: string;
|
|
371
|
+
address: string;
|
|
372
|
+
}[];
|
|
373
|
+
}, {
|
|
374
|
+
fills: {
|
|
375
|
+
from: string;
|
|
376
|
+
to: string;
|
|
377
|
+
source: string;
|
|
378
|
+
proportionBps: string;
|
|
379
|
+
}[];
|
|
380
|
+
tokens: {
|
|
381
|
+
symbol: string;
|
|
382
|
+
address: string;
|
|
383
|
+
}[];
|
|
384
|
+
}>;
|
|
385
|
+
sellAmount: z.ZodString;
|
|
386
|
+
sellToken: z.ZodString;
|
|
387
|
+
totalNetworkFee: z.ZodString;
|
|
388
|
+
} & {
|
|
389
|
+
transaction: z.ZodObject<{
|
|
390
|
+
to: z.ZodString;
|
|
391
|
+
data: z.ZodString;
|
|
392
|
+
gas: z.ZodString;
|
|
393
|
+
gasPrice: z.ZodString;
|
|
394
|
+
value: z.ZodString;
|
|
395
|
+
}, "strip", z.ZodTypeAny, {
|
|
396
|
+
value: string;
|
|
397
|
+
data: string;
|
|
398
|
+
gas: string;
|
|
399
|
+
gasPrice: string;
|
|
400
|
+
to: string;
|
|
401
|
+
}, {
|
|
402
|
+
value: string;
|
|
403
|
+
data: string;
|
|
404
|
+
gas: string;
|
|
405
|
+
gasPrice: string;
|
|
406
|
+
to: string;
|
|
407
|
+
}>;
|
|
408
|
+
permit2: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
409
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
410
|
+
blockNumber: z.ZodString;
|
|
411
|
+
buyAmount: z.ZodString;
|
|
412
|
+
buyToken: z.ZodString;
|
|
413
|
+
fees: z.ZodObject<{
|
|
414
|
+
integratorFee: z.ZodNullable<z.ZodUnknown>;
|
|
415
|
+
zeroExFee: z.ZodNullable<z.ZodObject<{
|
|
416
|
+
amount: z.ZodString;
|
|
417
|
+
token: z.ZodString;
|
|
418
|
+
type: z.ZodString;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
type: string;
|
|
421
|
+
amount: string;
|
|
422
|
+
token: string;
|
|
423
|
+
}, {
|
|
424
|
+
type: string;
|
|
425
|
+
amount: string;
|
|
426
|
+
token: string;
|
|
427
|
+
}>>;
|
|
428
|
+
gasFee: z.ZodNullable<z.ZodUnknown>;
|
|
429
|
+
}, "strip", z.ZodTypeAny, {
|
|
430
|
+
zeroExFee: {
|
|
431
|
+
type: string;
|
|
432
|
+
amount: string;
|
|
433
|
+
token: string;
|
|
434
|
+
} | null;
|
|
435
|
+
integratorFee?: unknown;
|
|
436
|
+
gasFee?: unknown;
|
|
437
|
+
}, {
|
|
438
|
+
zeroExFee: {
|
|
439
|
+
type: string;
|
|
440
|
+
amount: string;
|
|
441
|
+
token: string;
|
|
442
|
+
} | null;
|
|
443
|
+
integratorFee?: unknown;
|
|
444
|
+
gasFee?: unknown;
|
|
445
|
+
}>;
|
|
446
|
+
gas: z.ZodString;
|
|
447
|
+
gasPrice: z.ZodString;
|
|
448
|
+
liquidityAvailable: z.ZodBoolean;
|
|
449
|
+
minBuyAmount: z.ZodString;
|
|
450
|
+
route: z.ZodObject<{
|
|
451
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
452
|
+
from: z.ZodString;
|
|
453
|
+
to: z.ZodString;
|
|
454
|
+
source: z.ZodString;
|
|
455
|
+
proportionBps: z.ZodString;
|
|
456
|
+
}, "strip", z.ZodTypeAny, {
|
|
457
|
+
from: string;
|
|
458
|
+
to: string;
|
|
459
|
+
source: string;
|
|
460
|
+
proportionBps: string;
|
|
461
|
+
}, {
|
|
462
|
+
from: string;
|
|
463
|
+
to: string;
|
|
464
|
+
source: string;
|
|
465
|
+
proportionBps: string;
|
|
466
|
+
}>, "many">;
|
|
467
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
468
|
+
address: z.ZodString;
|
|
469
|
+
symbol: z.ZodString;
|
|
470
|
+
}, "strip", z.ZodTypeAny, {
|
|
471
|
+
symbol: string;
|
|
472
|
+
address: string;
|
|
473
|
+
}, {
|
|
474
|
+
symbol: string;
|
|
475
|
+
address: string;
|
|
476
|
+
}>, "many">;
|
|
477
|
+
}, "strip", z.ZodTypeAny, {
|
|
478
|
+
fills: {
|
|
479
|
+
from: string;
|
|
480
|
+
to: string;
|
|
481
|
+
source: string;
|
|
482
|
+
proportionBps: string;
|
|
483
|
+
}[];
|
|
484
|
+
tokens: {
|
|
485
|
+
symbol: string;
|
|
486
|
+
address: string;
|
|
487
|
+
}[];
|
|
488
|
+
}, {
|
|
489
|
+
fills: {
|
|
490
|
+
from: string;
|
|
491
|
+
to: string;
|
|
492
|
+
source: string;
|
|
493
|
+
proportionBps: string;
|
|
494
|
+
}[];
|
|
495
|
+
tokens: {
|
|
496
|
+
symbol: string;
|
|
497
|
+
address: string;
|
|
498
|
+
}[];
|
|
499
|
+
}>;
|
|
500
|
+
sellAmount: z.ZodString;
|
|
501
|
+
sellToken: z.ZodString;
|
|
502
|
+
totalNetworkFee: z.ZodString;
|
|
503
|
+
} & {
|
|
504
|
+
transaction: z.ZodObject<{
|
|
505
|
+
to: z.ZodString;
|
|
506
|
+
data: z.ZodString;
|
|
507
|
+
gas: z.ZodString;
|
|
508
|
+
gasPrice: z.ZodString;
|
|
509
|
+
value: z.ZodString;
|
|
510
|
+
}, "strip", z.ZodTypeAny, {
|
|
511
|
+
value: string;
|
|
512
|
+
data: string;
|
|
513
|
+
gas: string;
|
|
514
|
+
gasPrice: string;
|
|
515
|
+
to: string;
|
|
516
|
+
}, {
|
|
517
|
+
value: string;
|
|
518
|
+
data: string;
|
|
519
|
+
gas: string;
|
|
520
|
+
gasPrice: string;
|
|
521
|
+
to: string;
|
|
522
|
+
}>;
|
|
523
|
+
permit2: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
524
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
525
|
+
blockNumber: z.ZodString;
|
|
526
|
+
buyAmount: z.ZodString;
|
|
527
|
+
buyToken: z.ZodString;
|
|
528
|
+
fees: z.ZodObject<{
|
|
529
|
+
integratorFee: z.ZodNullable<z.ZodUnknown>;
|
|
530
|
+
zeroExFee: z.ZodNullable<z.ZodObject<{
|
|
531
|
+
amount: z.ZodString;
|
|
532
|
+
token: z.ZodString;
|
|
533
|
+
type: z.ZodString;
|
|
534
|
+
}, "strip", z.ZodTypeAny, {
|
|
535
|
+
type: string;
|
|
536
|
+
amount: string;
|
|
537
|
+
token: string;
|
|
538
|
+
}, {
|
|
539
|
+
type: string;
|
|
540
|
+
amount: string;
|
|
541
|
+
token: string;
|
|
542
|
+
}>>;
|
|
543
|
+
gasFee: z.ZodNullable<z.ZodUnknown>;
|
|
544
|
+
}, "strip", z.ZodTypeAny, {
|
|
545
|
+
zeroExFee: {
|
|
546
|
+
type: string;
|
|
547
|
+
amount: string;
|
|
548
|
+
token: string;
|
|
549
|
+
} | null;
|
|
550
|
+
integratorFee?: unknown;
|
|
551
|
+
gasFee?: unknown;
|
|
552
|
+
}, {
|
|
553
|
+
zeroExFee: {
|
|
554
|
+
type: string;
|
|
555
|
+
amount: string;
|
|
556
|
+
token: string;
|
|
557
|
+
} | null;
|
|
558
|
+
integratorFee?: unknown;
|
|
559
|
+
gasFee?: unknown;
|
|
560
|
+
}>;
|
|
561
|
+
gas: z.ZodString;
|
|
562
|
+
gasPrice: z.ZodString;
|
|
563
|
+
liquidityAvailable: z.ZodBoolean;
|
|
564
|
+
minBuyAmount: z.ZodString;
|
|
565
|
+
route: z.ZodObject<{
|
|
566
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
567
|
+
from: z.ZodString;
|
|
568
|
+
to: z.ZodString;
|
|
569
|
+
source: z.ZodString;
|
|
570
|
+
proportionBps: z.ZodString;
|
|
571
|
+
}, "strip", z.ZodTypeAny, {
|
|
572
|
+
from: string;
|
|
573
|
+
to: string;
|
|
574
|
+
source: string;
|
|
575
|
+
proportionBps: string;
|
|
576
|
+
}, {
|
|
577
|
+
from: string;
|
|
578
|
+
to: string;
|
|
579
|
+
source: string;
|
|
580
|
+
proportionBps: string;
|
|
581
|
+
}>, "many">;
|
|
582
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
583
|
+
address: z.ZodString;
|
|
584
|
+
symbol: z.ZodString;
|
|
585
|
+
}, "strip", z.ZodTypeAny, {
|
|
586
|
+
symbol: string;
|
|
587
|
+
address: string;
|
|
588
|
+
}, {
|
|
589
|
+
symbol: string;
|
|
590
|
+
address: string;
|
|
591
|
+
}>, "many">;
|
|
592
|
+
}, "strip", z.ZodTypeAny, {
|
|
593
|
+
fills: {
|
|
594
|
+
from: string;
|
|
595
|
+
to: string;
|
|
596
|
+
source: string;
|
|
597
|
+
proportionBps: string;
|
|
598
|
+
}[];
|
|
599
|
+
tokens: {
|
|
600
|
+
symbol: string;
|
|
601
|
+
address: string;
|
|
602
|
+
}[];
|
|
603
|
+
}, {
|
|
604
|
+
fills: {
|
|
605
|
+
from: string;
|
|
606
|
+
to: string;
|
|
607
|
+
source: string;
|
|
608
|
+
proportionBps: string;
|
|
609
|
+
}[];
|
|
610
|
+
tokens: {
|
|
611
|
+
symbol: string;
|
|
612
|
+
address: string;
|
|
613
|
+
}[];
|
|
614
|
+
}>;
|
|
615
|
+
sellAmount: z.ZodString;
|
|
616
|
+
sellToken: z.ZodString;
|
|
617
|
+
totalNetworkFee: z.ZodString;
|
|
618
|
+
} & {
|
|
619
|
+
transaction: z.ZodObject<{
|
|
620
|
+
to: z.ZodString;
|
|
621
|
+
data: z.ZodString;
|
|
622
|
+
gas: z.ZodString;
|
|
623
|
+
gasPrice: z.ZodString;
|
|
624
|
+
value: z.ZodString;
|
|
625
|
+
}, "strip", z.ZodTypeAny, {
|
|
626
|
+
value: string;
|
|
627
|
+
data: string;
|
|
628
|
+
gas: string;
|
|
629
|
+
gasPrice: string;
|
|
630
|
+
to: string;
|
|
631
|
+
}, {
|
|
632
|
+
value: string;
|
|
633
|
+
data: string;
|
|
634
|
+
gas: string;
|
|
635
|
+
gasPrice: string;
|
|
636
|
+
to: string;
|
|
637
|
+
}>;
|
|
638
|
+
permit2: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
639
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
640
|
+
export type QuoteResponse = z.infer<typeof QuoteResponseSchema>;
|
|
641
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/providers/zerox-swap/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAgChB,CAAC;AAEjB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAMhE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAShB,CAAC;AAEjB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for 0x Swap API v2 responses.
|
|
3
|
+
* Runtime validation to detect API drift early.
|
|
4
|
+
*
|
|
5
|
+
* Endpoints:
|
|
6
|
+
* - /swap/allowance-holder/price -> PriceResponseSchema
|
|
7
|
+
* - /swap/allowance-holder/quote -> QuoteResponseSchema
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Price Response (/swap/allowance-holder/price) (ZXSW-02)
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
export const PriceResponseSchema = z.object({
|
|
14
|
+
blockNumber: z.string(),
|
|
15
|
+
buyAmount: z.string(),
|
|
16
|
+
buyToken: z.string(),
|
|
17
|
+
fees: z.object({
|
|
18
|
+
integratorFee: z.unknown().nullable(),
|
|
19
|
+
zeroExFee: z.object({
|
|
20
|
+
amount: z.string(),
|
|
21
|
+
token: z.string(),
|
|
22
|
+
type: z.string(),
|
|
23
|
+
}).nullable(),
|
|
24
|
+
gasFee: z.unknown().nullable(),
|
|
25
|
+
}),
|
|
26
|
+
gas: z.string(),
|
|
27
|
+
gasPrice: z.string(),
|
|
28
|
+
liquidityAvailable: z.boolean(), // ZXSW-07: must validate this
|
|
29
|
+
minBuyAmount: z.string(),
|
|
30
|
+
route: z.object({
|
|
31
|
+
fills: z.array(z.object({
|
|
32
|
+
from: z.string(),
|
|
33
|
+
to: z.string(),
|
|
34
|
+
source: z.string(),
|
|
35
|
+
proportionBps: z.string(),
|
|
36
|
+
})),
|
|
37
|
+
tokens: z.array(z.object({
|
|
38
|
+
address: z.string(),
|
|
39
|
+
symbol: z.string(),
|
|
40
|
+
})),
|
|
41
|
+
}),
|
|
42
|
+
sellAmount: z.string(),
|
|
43
|
+
sellToken: z.string(),
|
|
44
|
+
totalNetworkFee: z.string(),
|
|
45
|
+
}).passthrough(); // Allow extra fields from API updates
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Quote Response (/swap/allowance-holder/quote) (ZXSW-03)
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
export const QuoteResponseSchema = PriceResponseSchema.extend({
|
|
50
|
+
transaction: z.object({
|
|
51
|
+
to: z.string(), // AllowanceHolder contract
|
|
52
|
+
data: z.string(), // calldata (hex)
|
|
53
|
+
gas: z.string(),
|
|
54
|
+
gasPrice: z.string(),
|
|
55
|
+
value: z.string(), // native token value (wei)
|
|
56
|
+
}),
|
|
57
|
+
permit2: z.unknown().nullable().optional(), // null for AllowanceHolder flow
|
|
58
|
+
}).passthrough();
|
|
59
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +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E;SAC1B,CAAC,CAAC;QACH,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;YACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;SACnB,CAAC,CAAC;KACJ,CAAC;IACF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;CAC5B,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,sCAAsC;AAIxD,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAC5D,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAO,2BAA2B;QAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAK,iBAAiB;QACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAI,2BAA2B;KACjD,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAG,gCAAgC;CAC9E,CAAC,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0x Swap REST API client (v2).
|
|
3
|
+
* Wraps /swap/allowance-holder/price and /swap/allowance-holder/quote endpoints.
|
|
4
|
+
*
|
|
5
|
+
* All requests include chainId as query parameter and 0x-version: v2 header.
|
|
6
|
+
* Auth is via 0x-api-key header (optional for price, required for quote).
|
|
7
|
+
*/
|
|
8
|
+
import { ActionApiClient } from '../../common/action-api-client.js';
|
|
9
|
+
import type { PriceResponse, QuoteResponse } from './schemas.js';
|
|
10
|
+
import type { ZeroExSwapConfig } from './config.js';
|
|
11
|
+
export declare class ZeroExApiClient extends ActionApiClient {
|
|
12
|
+
private readonly chainId;
|
|
13
|
+
constructor(config: ZeroExSwapConfig, chainId: number);
|
|
14
|
+
getPrice(params: {
|
|
15
|
+
sellToken: string;
|
|
16
|
+
buyToken: string;
|
|
17
|
+
sellAmount: string;
|
|
18
|
+
taker: string;
|
|
19
|
+
slippageBps: number;
|
|
20
|
+
}): Promise<PriceResponse>;
|
|
21
|
+
getQuote(params: {
|
|
22
|
+
sellToken: string;
|
|
23
|
+
buyToken: string;
|
|
24
|
+
sellAmount: string;
|
|
25
|
+
taker: string;
|
|
26
|
+
slippageBps: number;
|
|
27
|
+
}): Promise<QuoteResponse>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=zerox-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zerox-api-client.d.ts","sourceRoot":"","sources":["../../../src/providers/zerox-swap/zerox-api-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,qBAAa,eAAgB,SAAQ,eAAe;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;IAW/C,QAAQ,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,aAAa,CAAC;IAWpB,QAAQ,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,aAAa,CAAC;CAU3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0x Swap REST API client (v2).
|
|
3
|
+
* Wraps /swap/allowance-holder/price and /swap/allowance-holder/quote endpoints.
|
|
4
|
+
*
|
|
5
|
+
* All requests include chainId as query parameter and 0x-version: v2 header.
|
|
6
|
+
* Auth is via 0x-api-key header (optional for price, required for quote).
|
|
7
|
+
*/
|
|
8
|
+
import { ActionApiClient } from '../../common/action-api-client.js';
|
|
9
|
+
import { PriceResponseSchema, QuoteResponseSchema } from './schemas.js';
|
|
10
|
+
export class ZeroExApiClient extends ActionApiClient {
|
|
11
|
+
chainId;
|
|
12
|
+
constructor(config, chainId) {
|
|
13
|
+
const headers = {
|
|
14
|
+
'0x-version': 'v2', // ZXSW-01
|
|
15
|
+
};
|
|
16
|
+
if (config.apiKey) {
|
|
17
|
+
headers['0x-api-key'] = config.apiKey; // ZXSW-01
|
|
18
|
+
}
|
|
19
|
+
super(config.apiBaseUrl, config.requestTimeoutMs, headers); // ZXSW-10
|
|
20
|
+
this.chainId = chainId;
|
|
21
|
+
}
|
|
22
|
+
async getPrice(params) {
|
|
23
|
+
return this.get('swap/allowance-holder/price', PriceResponseSchema, {
|
|
24
|
+
chainId: String(this.chainId), // ZXSW-01
|
|
25
|
+
sellToken: params.sellToken,
|
|
26
|
+
buyToken: params.buyToken,
|
|
27
|
+
sellAmount: params.sellAmount,
|
|
28
|
+
taker: params.taker,
|
|
29
|
+
slippageBps: String(params.slippageBps),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async getQuote(params) {
|
|
33
|
+
return this.get('swap/allowance-holder/quote', QuoteResponseSchema, {
|
|
34
|
+
chainId: String(this.chainId), // ZXSW-01
|
|
35
|
+
sellToken: params.sellToken,
|
|
36
|
+
buyToken: params.buyToken,
|
|
37
|
+
sellAmount: params.sellAmount,
|
|
38
|
+
taker: params.taker,
|
|
39
|
+
slippageBps: String(params.slippageBps),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=zerox-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zerox-api-client.js","sourceRoot":"","sources":["../../../src/providers/zerox-swap/zerox-api-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAIxE,MAAM,OAAO,eAAgB,SAAQ,eAAe;IACjC,OAAO,CAAS;IAEjC,YAAY,MAAwB,EAAE,OAAe;QACnD,MAAM,OAAO,GAA2B;YACtC,YAAY,EAAE,IAAI,EAAW,UAAU;SACxC,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAE,UAAU;QACpD,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAE,UAAU;QACvE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAMd;QACC,OAAO,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,mBAAmB,EAAE;YAClE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAG,UAAU;YAC1C,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAMd;QACC,OAAO,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,mBAAmB,EAAE;YAClE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAG,UAAU;YAC1C,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waiaas/actions",
|
|
3
|
-
"version": "2.6.0-rc.
|
|
3
|
+
"version": "2.6.0-rc.8",
|
|
4
4
|
"description": "WAIaaS built-in DeFi Action Provider implementations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"zod": "^3.24.0",
|
|
32
|
-
"@waiaas/core": "2.6.0-rc.
|
|
32
|
+
"@waiaas/core": "2.6.0-rc.8"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^25.2.3",
|