@andrewkimjoseph/celina-sdk 0.2.6 → 0.2.7

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.
@@ -0,0 +1,43 @@
1
+ export declare const permit2Abi: readonly [{
2
+ readonly name: "allowance";
3
+ readonly type: "function";
4
+ readonly stateMutability: "view";
5
+ readonly inputs: readonly [{
6
+ readonly name: "owner";
7
+ readonly type: "address";
8
+ }, {
9
+ readonly name: "token";
10
+ readonly type: "address";
11
+ }, {
12
+ readonly name: "spender";
13
+ readonly type: "address";
14
+ }];
15
+ readonly outputs: readonly [{
16
+ readonly name: "amount";
17
+ readonly type: "uint160";
18
+ }, {
19
+ readonly name: "expiration";
20
+ readonly type: "uint48";
21
+ }, {
22
+ readonly name: "nonce";
23
+ readonly type: "uint48";
24
+ }];
25
+ }, {
26
+ readonly name: "approve";
27
+ readonly type: "function";
28
+ readonly stateMutability: "nonpayable";
29
+ readonly inputs: readonly [{
30
+ readonly name: "token";
31
+ readonly type: "address";
32
+ }, {
33
+ readonly name: "spender";
34
+ readonly type: "address";
35
+ }, {
36
+ readonly name: "amount";
37
+ readonly type: "uint160";
38
+ }, {
39
+ readonly name: "expiration";
40
+ readonly type: "uint48";
41
+ }];
42
+ readonly outputs: readonly [];
43
+ }];
@@ -0,0 +1,30 @@
1
+ export const permit2Abi = [
2
+ {
3
+ name: "allowance",
4
+ type: "function",
5
+ stateMutability: "view",
6
+ inputs: [
7
+ { name: "owner", type: "address" },
8
+ { name: "token", type: "address" },
9
+ { name: "spender", type: "address" },
10
+ ],
11
+ outputs: [
12
+ { name: "amount", type: "uint160" },
13
+ { name: "expiration", type: "uint48" },
14
+ { name: "nonce", type: "uint48" },
15
+ ],
16
+ },
17
+ {
18
+ name: "approve",
19
+ type: "function",
20
+ stateMutability: "nonpayable",
21
+ inputs: [
22
+ { name: "token", type: "address" },
23
+ { name: "spender", type: "address" },
24
+ { name: "amount", type: "uint160" },
25
+ { name: "expiration", type: "uint48" },
26
+ ],
27
+ outputs: [],
28
+ },
29
+ ];
30
+ //# sourceMappingURL=permit2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permit2.js","sourceRoot":"","sources":["../../src/abis/permit2.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC;QACD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;SAClC;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;SACvC;QACD,OAAO,EAAE,EAAE;KACZ;CACO,CAAC"}
@@ -0,0 +1,34 @@
1
+ export declare const stateViewAbi: readonly [{
2
+ readonly name: "getSlot0";
3
+ readonly type: "function";
4
+ readonly stateMutability: "view";
5
+ readonly inputs: readonly [{
6
+ readonly name: "poolId";
7
+ readonly type: "bytes32";
8
+ }];
9
+ readonly outputs: readonly [{
10
+ readonly name: "sqrtPriceX96";
11
+ readonly type: "uint160";
12
+ }, {
13
+ readonly name: "tick";
14
+ readonly type: "int24";
15
+ }, {
16
+ readonly name: "protocolFee";
17
+ readonly type: "uint24";
18
+ }, {
19
+ readonly name: "lpFee";
20
+ readonly type: "uint24";
21
+ }];
22
+ }, {
23
+ readonly name: "getLiquidity";
24
+ readonly type: "function";
25
+ readonly stateMutability: "view";
26
+ readonly inputs: readonly [{
27
+ readonly name: "poolId";
28
+ readonly type: "bytes32";
29
+ }];
30
+ readonly outputs: readonly [{
31
+ readonly name: "liquidity";
32
+ readonly type: "uint128";
33
+ }];
34
+ }];
@@ -0,0 +1,22 @@
1
+ export const stateViewAbi = [
2
+ {
3
+ name: "getSlot0",
4
+ type: "function",
5
+ stateMutability: "view",
6
+ inputs: [{ name: "poolId", type: "bytes32" }],
7
+ outputs: [
8
+ { name: "sqrtPriceX96", type: "uint160" },
9
+ { name: "tick", type: "int24" },
10
+ { name: "protocolFee", type: "uint24" },
11
+ { name: "lpFee", type: "uint24" },
12
+ ],
13
+ },
14
+ {
15
+ name: "getLiquidity",
16
+ type: "function",
17
+ stateMutability: "view",
18
+ inputs: [{ name: "poolId", type: "bytes32" }],
19
+ outputs: [{ name: "liquidity", type: "uint128" }],
20
+ },
21
+ ];
22
+ //# sourceMappingURL=uniswap-state-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniswap-state-view.js","sourceRoot":"","sources":["../../src/abis/uniswap-state-view.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7C,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE;YACzC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;YAC/B,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;SAClC;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KAClD;CACO,CAAC"}
@@ -0,0 +1,86 @@
1
+ export declare const v4QuoterAbi: readonly [{
2
+ readonly name: "quoteExactInputSingle";
3
+ readonly type: "function";
4
+ readonly stateMutability: "nonpayable";
5
+ readonly inputs: readonly [{
6
+ readonly name: "params";
7
+ readonly type: "tuple";
8
+ readonly components: readonly [{
9
+ readonly name: "poolKey";
10
+ readonly type: "tuple";
11
+ readonly components: readonly [{
12
+ readonly name: "currency0";
13
+ readonly type: "address";
14
+ }, {
15
+ readonly name: "currency1";
16
+ readonly type: "address";
17
+ }, {
18
+ readonly name: "fee";
19
+ readonly type: "uint24";
20
+ }, {
21
+ readonly name: "tickSpacing";
22
+ readonly type: "int24";
23
+ }, {
24
+ readonly name: "hooks";
25
+ readonly type: "address";
26
+ }];
27
+ }, {
28
+ readonly name: "zeroForOne";
29
+ readonly type: "bool";
30
+ }, {
31
+ readonly name: "exactAmount";
32
+ readonly type: "uint128";
33
+ }, {
34
+ readonly name: "hookData";
35
+ readonly type: "bytes";
36
+ }];
37
+ }];
38
+ readonly outputs: readonly [{
39
+ readonly name: "amountOut";
40
+ readonly type: "uint256";
41
+ }, {
42
+ readonly name: "gasEstimate";
43
+ readonly type: "uint256";
44
+ }];
45
+ }, {
46
+ readonly name: "quoteExactInput";
47
+ readonly type: "function";
48
+ readonly stateMutability: "nonpayable";
49
+ readonly inputs: readonly [{
50
+ readonly name: "params";
51
+ readonly type: "tuple";
52
+ readonly components: readonly [{
53
+ readonly name: "exactCurrency";
54
+ readonly type: "address";
55
+ }, {
56
+ readonly name: "path";
57
+ readonly type: "tuple[]";
58
+ readonly components: readonly [{
59
+ readonly name: "intermediateCurrency";
60
+ readonly type: "address";
61
+ }, {
62
+ readonly name: "fee";
63
+ readonly type: "uint24";
64
+ }, {
65
+ readonly name: "tickSpacing";
66
+ readonly type: "int24";
67
+ }, {
68
+ readonly name: "hooks";
69
+ readonly type: "address";
70
+ }, {
71
+ readonly name: "hookData";
72
+ readonly type: "bytes";
73
+ }];
74
+ }, {
75
+ readonly name: "exactAmount";
76
+ readonly type: "uint128";
77
+ }];
78
+ }];
79
+ readonly outputs: readonly [{
80
+ readonly name: "amountOut";
81
+ readonly type: "uint256";
82
+ }, {
83
+ readonly name: "gasEstimate";
84
+ readonly type: "uint256";
85
+ }];
86
+ }];
@@ -0,0 +1,64 @@
1
+ export const v4QuoterAbi = [
2
+ {
3
+ name: "quoteExactInputSingle",
4
+ type: "function",
5
+ stateMutability: "nonpayable",
6
+ inputs: [
7
+ {
8
+ name: "params",
9
+ type: "tuple",
10
+ components: [
11
+ {
12
+ name: "poolKey",
13
+ type: "tuple",
14
+ components: [
15
+ { name: "currency0", type: "address" },
16
+ { name: "currency1", type: "address" },
17
+ { name: "fee", type: "uint24" },
18
+ { name: "tickSpacing", type: "int24" },
19
+ { name: "hooks", type: "address" },
20
+ ],
21
+ },
22
+ { name: "zeroForOne", type: "bool" },
23
+ { name: "exactAmount", type: "uint128" },
24
+ { name: "hookData", type: "bytes" },
25
+ ],
26
+ },
27
+ ],
28
+ outputs: [
29
+ { name: "amountOut", type: "uint256" },
30
+ { name: "gasEstimate", type: "uint256" },
31
+ ],
32
+ },
33
+ {
34
+ name: "quoteExactInput",
35
+ type: "function",
36
+ stateMutability: "nonpayable",
37
+ inputs: [
38
+ {
39
+ name: "params",
40
+ type: "tuple",
41
+ components: [
42
+ { name: "exactCurrency", type: "address" },
43
+ {
44
+ name: "path",
45
+ type: "tuple[]",
46
+ components: [
47
+ { name: "intermediateCurrency", type: "address" },
48
+ { name: "fee", type: "uint24" },
49
+ { name: "tickSpacing", type: "int24" },
50
+ { name: "hooks", type: "address" },
51
+ { name: "hookData", type: "bytes" },
52
+ ],
53
+ },
54
+ { name: "exactAmount", type: "uint128" },
55
+ ],
56
+ },
57
+ ],
58
+ outputs: [
59
+ { name: "amountOut", type: "uint256" },
60
+ { name: "gasEstimate", type: "uint256" },
61
+ ],
62
+ },
63
+ ];
64
+ //# sourceMappingURL=uniswap-v4-quoter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniswap-v4-quoter.js","sourceRoot":"","sources":["../../src/abis/uniswap-v4-quoter.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,OAAO;wBACb,UAAU,EAAE;4BACV,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;4BACtC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;4BACtC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAC/B,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE;4BACtC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;yBACnC;qBACF;oBACD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE;oBACpC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;oBACxC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE;iBACpC;aACF;SACF;QACD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;SACzC;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC1C;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,SAAS;wBACf,UAAU,EAAE;4BACV,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,SAAS,EAAE;4BACjD,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAC/B,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE;4BACtC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;4BAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE;yBACpC;qBACF;oBACD,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;iBACzC;aACF;SACF;QACD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;SACzC;KACF;CACO,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const universalRouterAbi: readonly [{
2
+ readonly name: "execute";
3
+ readonly type: "function";
4
+ readonly stateMutability: "payable";
5
+ readonly inputs: readonly [{
6
+ readonly name: "commands";
7
+ readonly type: "bytes";
8
+ }, {
9
+ readonly name: "inputs";
10
+ readonly type: "bytes[]";
11
+ }, {
12
+ readonly name: "deadline";
13
+ readonly type: "uint256";
14
+ }];
15
+ readonly outputs: readonly [];
16
+ }];
@@ -0,0 +1,14 @@
1
+ export const universalRouterAbi = [
2
+ {
3
+ name: "execute",
4
+ type: "function",
5
+ stateMutability: "payable",
6
+ inputs: [
7
+ { name: "commands", type: "bytes" },
8
+ { name: "inputs", type: "bytes[]" },
9
+ { name: "deadline", type: "uint256" },
10
+ ],
11
+ outputs: [],
12
+ },
13
+ ];
14
+ //# sourceMappingURL=universal-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"universal-router.js","sourceRoot":"","sources":["../../src/abis/universal-router.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,SAAS;QAC1B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE;YACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;SACtC;QACD,OAAO,EAAE,EAAE;KACZ;CACO,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const Actions: typeof import("@uniswap/v4-sdk").Actions, V4Planner: typeof import("@uniswap/v4-sdk").V4Planner;
2
+ export declare const CommandType: typeof import("@uniswap/universal-router-sdk").CommandType, RoutePlanner: typeof import("@uniswap/universal-router-sdk").RoutePlanner;
3
+ export declare const ChainId: typeof import("@uniswap/sdk-core").ChainId;
4
+ export type { SwapExactInSingle, SwapExactIn } from "@uniswap/v4-sdk";
@@ -0,0 +1,9 @@
1
+ import { createRequire } from "node:module";
2
+ const require = createRequire(import.meta.url);
3
+ const v4Sdk = require("@uniswap/v4-sdk");
4
+ const universalRouterSdk = require("@uniswap/universal-router-sdk");
5
+ const sdkCore = require("@uniswap/sdk-core");
6
+ export const { Actions, V4Planner } = v4Sdk;
7
+ export const { CommandType, RoutePlanner } = universalRouterSdk;
8
+ export const { ChainId } = sdkCore;
9
+ //# sourceMappingURL=uniswap-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniswap-sdk.js","sourceRoot":"","sources":["../../src/clients/uniswap-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAqC,CAAC;AAC7E,MAAM,kBAAkB,GACtB,OAAO,CAAC,+BAA+B,CAAmD,CAAC;AAC7F,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAuC,CAAC;AAEnF,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAC5C,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,kBAAkB,CAAC;AAChE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC"}
@@ -0,0 +1,36 @@
1
+ /** Uniswap v4 on Celo mainnet — https://docs.celo.org/tooling/contracts/uniswap-contracts */
2
+ export declare const UNISWAP_V4: {
3
+ readonly poolManager: "0x288dc841A52FCA2707c6947B3A777c5E56cd87BC";
4
+ readonly v4Quoter: "0x28566da1093609182dff2cb2a91cfd72e61d66cd";
5
+ readonly stateView: "0xbc21f8720babf4b20d195ee5c6e99c52b76f2bfb";
6
+ readonly universalRouter: "0xcb695bc5d3aa22cad1e6df07801b061a05a0233a";
7
+ readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
8
+ readonly zeroHooks: "0x0000000000000000000000000000000000000000";
9
+ readonly nativeCurrency: "0x0000000000000000000000000000000000000000";
10
+ };
11
+ export declare const UNISWAP_SUBGRAPH_URL = "https://api.studio.thegraph.com/query/111767/uniswap-v-4-celo/version/latest";
12
+ export declare const UNISWAP_POOL_CACHE_TTL_MS: number;
13
+ /** Common v4 fee tiers and default tick spacings (probed on-chain when building index). */
14
+ export declare const UNISWAP_FEE_TIERS: readonly [100, 500, 3000, 10000, 30000];
15
+ export declare const UNISWAP_DEFAULT_TICK_SPACING: Record<number, number>;
16
+ /** Hub tokens for on-chain pool index fallback (Uniswap routing graph). */
17
+ export declare const UNISWAP_HUB_CURRENCIES: readonly `0x${string}`[];
18
+ export type UniswapPoolKey = {
19
+ currency0: `0x${string}`;
20
+ currency1: `0x${string}`;
21
+ fee: number;
22
+ tickSpacing: number;
23
+ hooks: `0x${string}`;
24
+ };
25
+ export declare function sortUniswapCurrencies(a: `0x${string}`, b: `0x${string}`): [`0x${string}`, `0x${string}`];
26
+ export declare function normalizeUniswapPoolKey(poolKey: UniswapPoolKey): UniswapPoolKey;
27
+ /** Map registry token to Uniswap v4 currency address (native CELO → address(0)). */
28
+ export declare function toUniswapCurrency(address: `0x${string}` | "native"): `0x${string}`;
29
+ /**
30
+ * Map registry token to the currency used for pool discovery / quoting.
31
+ * Celo v4 liquidity is on WCELO pairs, not native address(0).
32
+ */
33
+ export declare function toUniswapRoutingCurrency(address: `0x${string}` | "native"): `0x${string}`;
34
+ /** ERC-20 used as swap input when registry token is native CELO. */
35
+ export declare function uniswapInputTokenAddress(address: `0x${string}` | "native"): `0x${string}` | "native";
36
+ export declare function isNativeUniswapCurrency(currency: `0x${string}`): boolean;
@@ -0,0 +1,67 @@
1
+ import { MENTO_CELO_ADDRESS } from "./chains.js";
2
+ /** Uniswap v4 on Celo mainnet — https://docs.celo.org/tooling/contracts/uniswap-contracts */
3
+ export const UNISWAP_V4 = {
4
+ poolManager: "0x288dc841A52FCA2707c6947B3A777c5E56cd87BC",
5
+ v4Quoter: "0x28566da1093609182dff2cb2a91cfd72e61d66cd",
6
+ stateView: "0xbc21f8720babf4b20d195ee5c6e99c52b76f2bfb",
7
+ universalRouter: "0xcb695bc5d3aa22cad1e6df07801b061a05a0233a",
8
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
9
+ zeroHooks: "0x0000000000000000000000000000000000000000",
10
+ nativeCurrency: "0x0000000000000000000000000000000000000000",
11
+ };
12
+ export const UNISWAP_SUBGRAPH_URL = "https://api.studio.thegraph.com/query/111767/uniswap-v-4-celo/version/latest";
13
+ export const UNISWAP_POOL_CACHE_TTL_MS = 5 * 60 * 1000;
14
+ /** Common v4 fee tiers and default tick spacings (probed on-chain when building index). */
15
+ export const UNISWAP_FEE_TIERS = [100, 500, 3000, 10000, 30000];
16
+ export const UNISWAP_DEFAULT_TICK_SPACING = {
17
+ 100: 1,
18
+ 500: 10,
19
+ 3000: 60,
20
+ 10000: 200,
21
+ 30000: 600,
22
+ };
23
+ /** Hub tokens for on-chain pool index fallback (Uniswap routing graph). */
24
+ export const UNISWAP_HUB_CURRENCIES = [
25
+ UNISWAP_V4.nativeCurrency,
26
+ MENTO_CELO_ADDRESS,
27
+ "0xceba9300f2b948710d2653dd7b07f33a8b32118c", // USDC
28
+ "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e", // USDT
29
+ "0xD221812de1BD094f35587EE8E174B07B6167D9Af", // WETH
30
+ "0x765de816845861e75a25fca122bb6898b8b1282a", // USDm
31
+ "0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A", // GoodDollar (G$)
32
+ ];
33
+ export function sortUniswapCurrencies(a, b) {
34
+ return a.toLowerCase() < b.toLowerCase() ? [a, b] : [b, a];
35
+ }
36
+ export function normalizeUniswapPoolKey(poolKey) {
37
+ const [currency0, currency1] = sortUniswapCurrencies(poolKey.currency0, poolKey.currency1);
38
+ return { ...poolKey, currency0, currency1 };
39
+ }
40
+ /** Map registry token to Uniswap v4 currency address (native CELO → address(0)). */
41
+ export function toUniswapCurrency(address) {
42
+ if (address === "native") {
43
+ return UNISWAP_V4.nativeCurrency;
44
+ }
45
+ return address;
46
+ }
47
+ /**
48
+ * Map registry token to the currency used for pool discovery / quoting.
49
+ * Celo v4 liquidity is on WCELO pairs, not native address(0).
50
+ */
51
+ export function toUniswapRoutingCurrency(address) {
52
+ if (address === "native") {
53
+ return MENTO_CELO_ADDRESS;
54
+ }
55
+ return address;
56
+ }
57
+ /** ERC-20 used as swap input when registry token is native CELO. */
58
+ export function uniswapInputTokenAddress(address) {
59
+ if (address === "native") {
60
+ return MENTO_CELO_ADDRESS;
61
+ }
62
+ return address;
63
+ }
64
+ export function isNativeUniswapCurrency(currency) {
65
+ return currency.toLowerCase() === UNISWAP_V4.nativeCurrency;
66
+ }
67
+ //# sourceMappingURL=uniswap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniswap.js","sourceRoot":"","sources":["../../src/config/uniswap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,WAAW,EAAE,4CAAqD;IAClE,QAAQ,EAAE,4CAAqD;IAC/D,SAAS,EAAE,4CAAqD;IAChE,eAAe,EAAE,4CAAqD;IACtE,OAAO,EAAE,4CAAqD;IAC9D,SAAS,EAAE,4CAAqD;IAChE,cAAc,EAAE,4CAAqD;CAC7D,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAC/B,8EAA8E,CAAC;AAEjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAEzE,MAAM,CAAC,MAAM,4BAA4B,GAA2B;IAClE,GAA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C;IAEjC,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAuB;IAC7D,OAAO,QAAQ,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,cAAc,CAAC;AAC9D,CAAC"}
package/build/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { EnsService } from "./services/ens.service.js";
7
7
  import { GoodDollarService } from "./services/gooddollar.service.js";
8
8
  import { GovernanceService } from "./services/governance.service.js";
9
9
  import { MentoFxService } from "./services/mento-fx.service.js";
10
+ import { UniswapService } from "./services/uniswap.service.js";
10
11
  import { NftService } from "./services/nft.service.js";
11
12
  import { StakingService } from "./services/staking.service.js";
12
13
  import { TokenService } from "./services/token.service.js";
@@ -25,6 +26,8 @@ export interface CelinaClient {
25
26
  transaction: TransactionService;
26
27
  /** Mento FX quotes, estimates, and `prepareFx` flows. */
27
28
  mentoFx: MentoFxService;
29
+ /** Uniswap v4 quotes, estimates, and `prepareSwap` flows. */
30
+ uniswap: UniswapService;
28
31
  /** Aave V3 `prepareSupply` and `prepareWithdraw` flows on Celo. */
29
32
  aave: AaveService;
30
33
  /** GoodDollar IdentityV4 whitelist status. */
@@ -50,5 +53,6 @@ export { serializePreparedFlow } from "./types/prepared.js";
50
53
  export type { SdkConfig } from "./config/sdk-config.js";
51
54
  export type { ResolvedToken } from "./services/token.service.js";
52
55
  export type { MentoFxParams } from "./services/mento-fx.service.js";
56
+ export type { UniswapSwapParams } from "./services/uniswap.service.js";
53
57
  export type { GovernanceProposalsOptions } from "./services/governance.service.js";
54
58
  export type { ContractCallParams } from "./services/contract.service.js";
package/build/index.js CHANGED
@@ -15,6 +15,7 @@ import { EnsService } from "./services/ens.service.js";
15
15
  import { GoodDollarService } from "./services/gooddollar.service.js";
16
16
  import { GovernanceService } from "./services/governance.service.js";
17
17
  import { MentoFxService } from "./services/mento-fx.service.js";
18
+ import { UniswapService } from "./services/uniswap.service.js";
18
19
  import { NftService } from "./services/nft.service.js";
19
20
  import { StakingService } from "./services/staking.service.js";
20
21
  import { TokenService } from "./services/token.service.js";
@@ -33,6 +34,7 @@ export function createCelinaClient(opts) {
33
34
  token: new TokenService(clientFactory),
34
35
  transaction: new TransactionService(clientFactory),
35
36
  mentoFx: new MentoFxService(clientFactory),
37
+ uniswap: new UniswapService(clientFactory),
36
38
  aave: new AaveService(clientFactory),
37
39
  gooddollar: new GoodDollarService(clientFactory),
38
40
  ens: new EnsService(ensClientFactory),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC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AAI,iBAAiB,CAAC,aAAa,CAAC;QAChD,GAAG,EAAE,IAAI,UAAU,CAAC,gBAAgB,CAAC;QACrC,UAAU,EAAE,IAAI,iBAAiB,CAAC,aAAa,CAAC;QAChD,OAAO,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC;QAC1C,GAAG,EAAE,IAAI,UAAU,CAAC,aAAa,CAAC;QAClC,QAAQ,EAAE,IAAI,eAAe,CAAC,aAAa,CAAC;KAC7C,CAAC;AACJ,CAAC;AAQD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { PublicClient } from "viem";
2
+ import { type UniswapPoolKey } from "../config/uniswap.js";
3
+ export type UniswapPathKey = {
4
+ intermediateCurrency: `0x${string}`;
5
+ fee: number;
6
+ tickSpacing: number;
7
+ hooks: `0x${string}`;
8
+ hookData: `0x${string}`;
9
+ };
10
+ export type UniswapSwapRoute = {
11
+ currencyIn: `0x${string}`;
12
+ currencyOut: `0x${string}`;
13
+ pools: UniswapPoolKey[];
14
+ pathKeys: UniswapPathKey[];
15
+ hops: number;
16
+ };
17
+ export declare function findBestUniswapRoute(client: PublicClient, currencyIn: `0x${string}`, currencyOut: `0x${string}`, amountIn: bigint): Promise<{
18
+ route: UniswapSwapRoute;
19
+ amountOut: bigint;
20
+ indexSource: string;
21
+ } | null>;
22
+ export declare function applySlippage(amountOut: bigint, slippagePercent: number): bigint;