@skate-org/amm-evm-v2 0.4.1

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +33 -0
  3. package/dist/chain-clients.d.ts +42 -0
  4. package/dist/chain-clients.d.ts.map +1 -0
  5. package/dist/devConfig.d.ts +23 -0
  6. package/dist/devConfig.d.ts.map +1 -0
  7. package/dist/errors.d.ts +53 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/events/index.d.ts +4 -0
  10. package/dist/events/index.d.ts.map +1 -0
  11. package/dist/events/kernel.d.ts +25 -0
  12. package/dist/events/kernel.d.ts.map +1 -0
  13. package/dist/events/periphery.d.ts +21 -0
  14. package/dist/events/periphery.d.ts.map +1 -0
  15. package/dist/events/watch.d.ts +23 -0
  16. package/dist/events/watch.d.ts.map +1 -0
  17. package/dist/index.cjs +997 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.cts +8 -0
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +952 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/kernel/index.d.ts +3 -0
  25. package/dist/kernel/index.d.ts.map +1 -0
  26. package/dist/kernel/reader.d.ts +77 -0
  27. package/dist/kernel/reader.d.ts.map +1 -0
  28. package/dist/kernel/tickBitmap.d.ts +30 -0
  29. package/dist/kernel/tickBitmap.d.ts.map +1 -0
  30. package/dist/math/fullMath.d.ts +28 -0
  31. package/dist/math/fullMath.d.ts.map +1 -0
  32. package/dist/math/index.d.ts +5 -0
  33. package/dist/math/index.d.ts.map +1 -0
  34. package/dist/math/liquidityMath.d.ts +18 -0
  35. package/dist/math/liquidityMath.d.ts.map +1 -0
  36. package/dist/math/sqrtPriceMath.d.ts +62 -0
  37. package/dist/math/sqrtPriceMath.d.ts.map +1 -0
  38. package/dist/math/tickMath.d.ts +36 -0
  39. package/dist/math/tickMath.d.ts.map +1 -0
  40. package/dist/periphery/index.d.ts +3 -0
  41. package/dist/periphery/index.d.ts.map +1 -0
  42. package/dist/periphery/reader.d.ts +75 -0
  43. package/dist/periphery/reader.d.ts.map +1 -0
  44. package/dist/periphery/submit.d.ts +63 -0
  45. package/dist/periphery/submit.d.ts.map +1 -0
  46. package/package.json +41 -0
@@ -0,0 +1,63 @@
1
+ import type { Address, Hex, WalletClient } from "viem";
2
+ import type { CHAIN, EnvModeWithConfig } from "@skate-org/amm-core-v2";
3
+ /**
4
+ * Pre-built source-chain transaction payload accepted by
5
+ * {@link submitAction}.
6
+ *
7
+ * The SDK does **not** fabricate calldata in Group 6 — callers build the
8
+ * payload (e.g. from a quote's `serializedCall`) and this submitter only
9
+ * broadcasts it. This keeps the SDK decoupled from any off-chain
10
+ * routing/quote surface.
11
+ */
12
+ export type SubmitActionParams = {
13
+ /** Source-chain id the wallet must be connected to. */
14
+ chain: CHAIN;
15
+ /** Destination address of the broadcast tx. */
16
+ to: Address;
17
+ /** Pre-encoded calldata. */
18
+ data: Hex;
19
+ /** Native-value payable amount; defaults to `0n`. */
20
+ value?: bigint;
21
+ };
22
+ /**
23
+ * Broadcast a pre-built periphery action tx from the caller's
24
+ * `WalletClient`.
25
+ *
26
+ * Guarantees:
27
+ * - Throws {@link EvmWriteError} immediately if
28
+ * `wallet.chain?.id !== params.chain` — no RPC call is made.
29
+ * - Throws {@link EvmWriteError} if `wallet.account` is not set.
30
+ * - Forwards the payload to `wallet.sendTransaction` and returns the
31
+ * resulting tx hash.
32
+ * - Wraps any thrown viem write-path error
33
+ * (`TransactionExecutionError`, `UserRejectedRequestError`,
34
+ * `ChainMismatchError`, …) into an {@link EvmWriteError} via
35
+ * {@link wrapWriteError}.
36
+ *
37
+ * The `mode` parameter is currently unused at runtime; it is accepted for
38
+ * API symmetry with the readers and as a forward-compat hook for a future
39
+ * mode-specific submission policy (e.g. DEV-only simulation, staging
40
+ * retries). The `_` prefix marks it unused for the TypeScript checker.
41
+ *
42
+ * Non-goals (per plan guardrails):
43
+ * - Does NOT sign — the caller brings a `WalletClient` wired to their
44
+ * signer.
45
+ * - Does NOT switch chains — callers are responsible for
46
+ * `wallet.switchChain(...)`.
47
+ * - Does NOT retry or manage nonces — delegated to the caller's wallet.
48
+ */
49
+ export declare function submitAction(wallet: WalletClient, params: SubmitActionParams, _mode: EnvModeWithConfig): Promise<Hex>;
50
+ /**
51
+ * Broadcast a periphery *swap* action — thin wrapper around
52
+ * {@link submitAction} that re-labels any unknown error as `submitSwap` to
53
+ * aid log-line triage. Behaviourally identical to `submitAction`; shares
54
+ * its pre-flight guards.
55
+ */
56
+ export declare function submitSwap(wallet: WalletClient, params: SubmitActionParams, mode: EnvModeWithConfig): Promise<Hex>;
57
+ /**
58
+ * Broadcast a periphery *approval* action (ERC-20 approve to the source
59
+ * chain's periphery contract) — thin wrapper around {@link submitAction}.
60
+ * See {@link submitSwap} for labeling rationale.
61
+ */
62
+ export declare function submitApproval(wallet: WalletClient, params: SubmitActionParams, mode: EnvModeWithConfig): Promise<Hex>;
63
+ //# sourceMappingURL=submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../src/periphery/submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGvE;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uDAAuD;IACvD,KAAK,EAAE,KAAK,CAAC;IACb,+CAA+C;IAC/C,EAAE,EAAE,OAAO,CAAC;IACZ,4BAA4B;IAC5B,IAAI,EAAE,GAAG,CAAC;IACV,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,GAAG,CAAC,CA6Bd;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,GAAG,CAAC,CAOd;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,GAAG,CAAC,CAOd"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@skate-org/amm-evm-v2",
3
+ "version": "0.4.1",
4
+ "description": "Skate AMM v2 SDK — EVM clients, kernel/periphery readers, uniswap-v3 math, submitters",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "CHANGELOG.md",
24
+ "README.md"
25
+ ],
26
+ "dependencies": {
27
+ "@skate-org/amm-bindings": "^1.0.0",
28
+ "viem": "^2.21.0",
29
+ "@skate-org/amm-core-v2": "0.4.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
35
+ "scripts": {
36
+ "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly && node -e \"require('fs').copyFileSync('dist/index.d.ts','dist/index.d.cts')\"",
37
+ "clean": "rm -rf dist",
38
+ "test": "vitest run --passWithNoTests",
39
+ "typecheck": "tsc --noEmit"
40
+ }
41
+ }